by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 02 2016 16:31
    @chamons banned @IfErrThrowBrick_twitter
Chris Hamons
@chamons
Yes, this PR is a first step in making of “hybrid” app bundles, where the main app is in C# but you can extend it with Swift extensions for the areas we don’t have support yet
Embedding C# into other languages is part of what the Embeddinator I referenced does (https://github.com/mono/Embeddinator-4000), but it turns out that problem is exceptionally difficult to get right
Right now ^ has a lot of sharp edges and isn’t a good general solution for the common use case
Which is why my example used json serialization instead of directly calling C# logic
You can imagine a backend web server or iCloud (UIDocument, etc) as another path of shoveling data between main and extension
Csaba8472
@Csaba8472
hi @chamons, I think as long as xamarin doesn't wrap swiftui like it wraps uikit, we'll go with hybrids solutions like you did. Tried to run the project and it seems with this approach I can create a standalone watch app or widget or etc within the main xamarin project and with c# embedding I could reuse .net libs. Checked embeddinator but it seems it's not ready for this use case: "Support for watchOS will be available in a future release and will be very similar to iOS/tvOS."
Csaba8472
@Csaba8472
BTW thank you for the PR!
Chris Hamons
@chamons
watchOS is always hard due to bitcode.
Csaba8472
@Csaba8472
yep, what confuses me is, I can add watchos extension to a xamarin project and I can also create "standalone" tvos project(mentioned tvos only because bitcode must be enabled like in a watchos project), but can't create standalone watchos project. I'm not sure whether it is too difficult to do that or just not on the roadmap. I have a client who recently started xamarin projects and one of the main reason they've chosen xamarin is, that it supports smartwatches(especially watchos), what was definitely true 2 years ago, but today I can't really confirm that.
Damian Mehers
@DamianMehers
@spouliot gave a talk last year where he explained that on Apple TV the bitcode can simply wrap the native code, whereas on WatchOS it can’t. It is a really good talk https://youtu.be/hVYcscby13k
Damian Mehers
@DamianMehers
This is a link to the tvOS section: https://youtu.be/hVYcscby13k?t=1770
Sebastien Pouliot
@spouliot
@DamianMehers you’re welcome :)
Csaba8472
@Csaba8472
thank you, wasn't aware of that
honkmother
@honkmother
i know this is a dev channel but i am getting desperate
NSFileManager.DefaultManager.SetAttributes works, sets the attributes
and then immediately segfaults
any ideas why?
Chris Hamons
@chamons
Posting the crash log might help people guess better.
honkmother
@honkmother
Crash log is non-figuratively: "SegFault: 11"
No exceptions, no real errors.
I couldn't get lldb to run under dotnet for some reason.
captainjono
@captainjono

hi all - ive used xam before across mobile devices extensively but this is my first foray into macOS and im usually a win user... im looking for a little advice on debugging binding issues.
Im trying to leverage embedded chrome/ CEF.framework using CefGlue via xam.mac or .net core but im having very little luck getting examples to work always for the same reason - cant find the native cef library at runtime.

ive traweled docs and i feel like i am doing everything correctly. i then came across this - https://stackoverflow.com/questions/47538368/how-to-properly-map-an-expected-dll-name-to-a-native-mac-framework-for-mono
i found this person who was having similiar issues and they mentioned a "lib" appending issue. so i experimented and was finally able to get past the .dll load by renaming "chromeinium embedded framework.framework/chromeinium embedded framework" to "../liblibcef", but fails soon after because it cant find other expected framework/bundle files that are located in "chromeinium embedded framework.framework/Resources". im assuming there is a proper way to achieve this linking that i just cant work out is. is there a config i need to update to provide the mapping? (<dll import= ?).

cefglue binds using this approach:
[DllImport("libcef", EntryPoint = "cef_initialize", CallingConvention = libcef.CEF_CALL)]
public static extern int initialize(cef_main_args_t args, cef_settings_t settings, cef_app_t* application);

looking for suggestions / links that will help me down the right path on setting up these native ".framework" references? i would like to generate my own in future using sharpie so i want to fully understand the mechanics here.
is using something like dtrace/opensnoop the right approach to debugging these load failures (wasnt highlighting the probing paths for me :| )?

Chris Hamons
@chamons
This channel is for hacking on Xamarin.iOS and Mac, not use, and I know nothing about CEF but I will note that I’ve heard from a very experienced fellow engineer that embedding CEF is a complete nightmare to get right
If you set the environmental variables MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll you should see spam on what mono is looking for that may be useful
Miguel de Icaza
@migueldeicaza
Hello folks, we have been relying on a cool bridge to bring the Xamarin team with the open source community going, but that might be coming to an end.
I have created a Discord server to discuss the internal evolution of Mono and .NET
https://discord.gg/A982BT
Jared Updike
@jupdike
On my macOS Catalina MacBook Pro, I am using Xcode 11.5 for some personal Swift projects, but using Xamarin.iOS, .Android, and Xamarin.Mac in Visual Studio for Mac 8.6.5 for C# projects for my job, both on the same machine. If I upgrade to Xcode 12 beta 2 so I can try out some new stuff with Swift (independent of C#), will it break my ability to get work done in C#/Xamarin/VS for Mac? targeting iOS <= 13, stuff that currently works fine? (I understand that iOS 14 and Big Sur support are coming to Xamarin later in the summer/early fall. I don't expect to need that stuff for C# this summer, just Swift. And I absolutely need existing/older C# stuff to continue to work this summer, on the same machine with a single installation of Xcode.) Is it safe to upgrade? (acknowledging that there may be Xcode bugs on Apple's end)
Manuel de la Pena
@mandel-macaque
Julien Pelc you should be able to have both of the xcode installed in you machine and swich between them using xcode-select. Should not be an issue. We work that way in the team with several installations. Just leave stable in /Applications/Xcode.app and install the beta via the delveloper portal in a diff path
Dan Siegel
@dansiegel
@migueldeicaza that invite has expired
Alexander Köplinger
@akoeplinger
@dansiegel here's a new invite that shouldn't expire: https://discord.gg/qgqQqch
Tomasz Cielecki
@Cheesebaron
I have a colleague which is seeing some crashes in RayGun with only this information: NSInvalidArgumentException: *** -streamStatus only defined for abstract class. Define -[System_Net_Http_NSUrlSessionHandler_WrappedNSInputStream streamStatus]!. Has any of you seen anything like that before?
I've looked at the NSUrlSessionHandler code and can't really see there should be any problem with WrappedNSInputStream in there
captainjono
@captainjono
thanks for the advice, these logs helped me solve my issue. another question - If i create a NSWindow in a .dynlib that i have p/invoked from main(); and use a callback to give its handle back to xam.mac - am i able somehow dereference this handle to a NSWindow somehow and work with it (ie resize, fullscreent etc)? ie. looking at the api doco i assume this function could help me NSWindow.fromWindowRef(Int.Ptr) but i havnt been able to get it working...?
Rolf Bjarne Kvinge
@rolfbjarne
Use (NSWindow) ObjCRuntime.GetNSObject (ptr)
strike that
Use (NSWindow) ObjCRuntime.Runtime.GetNSObject (ptr)
captainjono
@captainjono
thats returning null for me... seems from the doco it says "if a managed object exists". this window was created in objective-C land in the .dynlib
Rolf Bjarne Kvinge
@rolfbjarne
it'll create the managed NSWindow instance if it doesn't already exist
unless ptr == IntPtr.Zero, in which case it'll return null
captainjono
@captainjono

ok thanks for this info- i didnt know if what i was trying todo was legal. the handle i am passing definitely looks valid in the debugger - this is the callback code
https://github.com/chromelyapps/Chromely/blob/9bf2efb2c25e6a9ea31b6cba8b6f422647d2642c/src/mac/chromely_mac.mm#L262

i'll keep hacking at it.

captainjono
@captainjono
was using tryget not get! and now its returned a nswindow correctly. i then do mainWin.InvokeOnMainThread(() => mainWin.ToggleFullScreen()) which throws a UI Consistancy error..? i tried multiple ways to invoke, nothing seems to come off?
Rolf Bjarne Kvinge
@rolfbjarne
did you call NSApplication.Init ()?
captainjono
@captainjono

yeh i did - but i am doing it a little later in the app bootstrapper to allow CEF to startup correctly if needs be (its a multi-process architecture that executes the host process multiple times with different commandline args and can timeout if not snappy). Could that effect Init()?

It seems like its on the correct thread to me; im doing the work in the create handler, and if i throw at that point,I can see the .dynlib createWindow in the stack. Cef has its own methods to call on the UI thread, could also try them.

captainjono
@captainjono
If i inspect the window variable in the debugger, the debugger crashes out with the same error. I can see the correct window title on a prop before it crashes, though so it feels like its connected properly to the underling api / mac window handle on some level.
captainjono
@captainjono
So i went ahead and integrated eto.forms where i was trying to hook into the window handling as i required it for other aspects of the application and have gotten it setup to the point where i can use its UI.Invoke methods to get my calls onto the right thread. i'll step through the source code and see how its achieving the integration, I want to understand the mechanics of whats going on here.
Rolf Bjarne Kvinge
@rolfbjarne
as long as the managed NSApplication.Init () method is called before you do anything else in managed code, you should be fine
Matheus Dadalto
@mthdadalto
Anyone has any idea of how to disable this from mac/win-xamarin?
 touch ~/.mtouch-launch-with-lldb
/
You must now execute:
lldb -s /tmp/mtouch-lldb-prep-cmds
Rolf Bjarne Kvinge
@rolfbjarne
execute rm ~/.mtouch-launch-with-lldb from a terminal
on the mac
Matheus Dadalto
@mthdadalto
worked, thanks