macOS crash on start #438

Open
opened 2026-01-29 22:12:05 +00:00 by claunia · 3 comments
Owner

Originally created by @ghost on GitHub (Mar 2, 2021).

I get this: Could not load the file 'System.Runtime.CompilerServices.Unsafe'

at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x00073] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/corlib/System/AppDomain.cs:758
at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/corlib/System/AppDomain.cs:724
at (wrapper remoting-invoke-with-check) System.AppDomain.Load(System.Reflection.AssemblyName)
at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/corlib/System.Reflection/Assembly.cs:440
at ObjCRuntime.Runtime.CollectReferencedAssemblies (System.Collections.Generic.List1[T] assemblies, System.Reflection.Assembly assembly) [0x00085] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:545 at ObjCRuntime.Runtime.CollectReferencedAssemblies (System.Collections.Generic.List1[T] assemblies, System.Reflection.Assembly assembly) [0x00085] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:545
at ObjCRuntime.Runtime.RegisterEntryAssembly (System.Reflection.Assembly entry_assembly) [0x00032] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:506
at ObjCRuntime.Runtime.RegisterAssemblies () [0x00001] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:482
at AppKit.NSApplication.Init () [0x00022] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/AppKit/NSApplication.cs:56
at ....MainClass.Main (System.String[] args) [0x00001] in /Users/ivanicin/Projects/.../Main.cs:9

Everything works in the version 0.26.

It is possible that it is a bug in Xamarin.Mac, as there are no problems in Xamarin.iOS but I would need some confirmation to submit it there.

Originally created by @ghost on GitHub (Mar 2, 2021). I get this: Could not load the file 'System.Runtime.CompilerServices.Unsafe' at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x00073] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/corlib/System/AppDomain.cs:758 at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/corlib/System/AppDomain.cs:724 at (wrapper remoting-invoke-with-check) System.AppDomain.Load(System.Reflection.AssemblyName) at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/corlib/System.Reflection/Assembly.cs:440 at ObjCRuntime.Runtime.CollectReferencedAssemblies (System.Collections.Generic.List`1[T] assemblies, System.Reflection.Assembly assembly) [0x00085] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:545 at ObjCRuntime.Runtime.CollectReferencedAssemblies (System.Collections.Generic.List`1[T] assemblies, System.Reflection.Assembly assembly) [0x00085] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:545 at ObjCRuntime.Runtime.RegisterEntryAssembly (System.Reflection.Assembly entry_assembly) [0x00032] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:506 at ObjCRuntime.Runtime.RegisterAssemblies () [0x00001] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:482 at AppKit.NSApplication.Init () [0x00022] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/AppKit/NSApplication.cs:56 at ....MainClass.Main (System.String[] args) [0x00001] in /Users/ivanicin/Projects/.../Main.cs:9 Everything works in the version 0.26. It is possible that it is a bug in Xamarin.Mac, as there are no problems in Xamarin.iOS but I would need some confirmation to submit it there.
Author
Owner

@adamhathcock commented on GitHub (Mar 2, 2021):

Honesty, not really sure.

I'm unfamiliar with what library targets Xamarin.Mac would use. Must be NET Standard 2.0.

Looks like I updated to CodePages 5.0.0 with 0.27 but also added more Unsafe and memory/span usage.

I'm guessing Xamarin.Mac isn't updated as quickly as Xamarin.iOS. Hopefully, MAUI will fix a possible out of date issue.

@adamhathcock commented on GitHub (Mar 2, 2021): Honesty, not really sure. I'm unfamiliar with what library targets Xamarin.Mac would use. Must be NET Standard 2.0. Looks like I updated to CodePages 5.0.0 with 0.27 but also added more Unsafe and memory/span usage. I'm guessing Xamarin.Mac isn't updated as quickly as Xamarin.iOS. Hopefully, MAUI will fix a possible out of date issue.
Author
Owner

@tlecomte commented on GitHub (Jul 22, 2021):

I had the same error (Could not load the file 'System.Runtime.CompilerServices.Unsafe') on Windows, and in my case the problem was that I did not have the correct binding redirects. I guess Xamarin.Mac also relies on binding redirects the same way ?

@tlecomte commented on GitHub (Jul 22, 2021): I had the same error (`Could not load the file 'System.Runtime.CompilerServices.Unsafe'`) on Windows, and in my case the problem was that I did not have the correct binding redirects. I guess Xamarin.Mac also relies on binding redirects the same way ?
Author
Owner

@ghost commented on GitHub (Jul 22, 2021):

As advised in the related issue on Xamarin Github I have installed System.Runtime.CompilerServices.Unsafe nuget and now it works. However it should work out of the box so possibly you should add this to the list of dependencies. My personal opinion is that this should come with Xamarin.Mac, but as they deny that I guess this should be the solution then.

@ghost commented on GitHub (Jul 22, 2021): As advised in the related issue on Xamarin Github I have installed `System.Runtime.CompilerServices.Unsafe` nuget and now it works. However it should work out of the box so possibly you should add this to the list of dependencies. My personal opinion is that this should come with Xamarin.Mac, but as they deny that I guess this should be the solution then.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#438