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
David Ortinau
@davidortinau

working in Swift/SwiftUI and .NET in the same project is on our radar to be being further investigated, primarily for WidgetKit and App Clips. The same concepts could be applied to watchOS.

The Embeddinator experiment is one idea, but as you note it's not actively in development and is a complex solution. Another solution is to initially offer the build/bundling of the Swift artifact (the watch app for example) with the .NET app for iOS, and provide a communication solution for passing messages between them.

Chris Hamons
@chamons
I’ll be sure to poke you folks if/when we have news. Would either of you be interested in opening an issue at https://github.com/xamarin/xamarin-macios/issues/new with details on your specific use case (SwiftUI, swift-only extensions, etc)
Damian Mehers
@DamianMehers
@chamons I'll try to draft something and pass it by you to see if it would help as an issue. I suspect I'm an edge-case. But then a lot of people are, each just in their own way.
kiddailey
@kiddailey
Silly question and apologies in advance - I've found and fixed an issue that includes minor changes to both the root Xamarin.MaciOS repository and the Xamarin.MacDev submodule and trying to figure out how to handle submitting the pull request(s). I assume that I should issue one on MaciOS and one on MacDev and cross-reference them in the descriptions. Is this correct? Thanks!
Rolf Bjarne Kvinge
@rolfbjarne
first create one in the Xamarin.MacDev submodule
then create the one in xamarin-macios once the first one has been merged
kiddailey
@kiddailey
Awesome, thanks!
juepiezhongren
@juepiezhongren
@davidortinau , do u mean that "call from native to .net " abilities r in development? .net6?
Chris Hamons
@chamons
Hey @DamianMehers @Csaba8472 - Super early work suggests we can embed arbitrary iOS extensions (written in Swift) into a Xamarin.iOS main application
I’ve got a PR up suggesting a possible extension point
However, it would involve some other party (json file, web server, shared uidocument/cloudkit data) shoving the data between C# iOS app and Swift extension
I think using something like Embeddinator would be difficult to make work to the level of reliability needed here
I’m poking you both since you expressed interest and concerns
Damian Mehers
@DamianMehers

@chamons sounds like a clean workaround, but since my main Xamarin platform is WatchOS, I personally would need support there too ... from what you are saying would I be right in assuming that the extension and the main app could run at the same time, and you'd use a IPC mechanism to communicate?

I've been all-in on Xamarin since 2012, but I'm looking seriously to moving to Swift/SwiftUI on Apple platforms because I can't do some things such as SwiftUI/complications on WatchOS. I was recently taken aback when I found I could not use RealityKit with Xamarin at one of my consulting clients (I'd created a scene in Reality Composer and wanted to export it as a .reality file and use it from Xamarin). I know I am not typical because WatchOS is where 90% of my app sales are (Android, Tizen, WearOS, UWP, xBox and MacOS are the other platforms I support, using Xamarin and a NetStandard library to share almost all my code https://www.youtube.com/watch?v=TOaJ1R4eLSw

There are other factors - when I started, C# was so far ahead of Objective C that it was a no-brainer. Swift is definitely behind C# (IMO - e.g async/await), but not too far behind. I'm also worried that Microsoft won't be able to track new APIs/technologies that are exposed purely in Swift/SwiftUI - I can't rely on doing everything from C# that can be done natively - I used to push that when selling Xamarin a few years back.

I'm not saying Microsoft would be wrong to stop updating support for WatchOS, I'm just an unintended casualty, and I can live with that. Swift/SwiftUI would be "as well as" .NET/C# not "instead of"

Damian Mehers
@DamianMehers
I've just checked out your pull request - I'd assumed (incorrectly) that you were allowing a C# extension to be embedded in a Swift iOS app, so that I could re-use my C# business logic from a Swift app, meaning I could do all the Swift/SwiftUI stuff in my main app, but still re-use a C# library/business logic/engine.
Damian Mehers
@DamianMehers
I thought there might be a generic extension type that I had not come across that just contained code.
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)