question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting System.TypeInitializationException on OSX

See original GitHub issue

I don’t know how to reproduce this. On my machine, using either stage0 or stage1/2 gives me the following exception:

Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.Extensions.PlatformAbstractions.PlatformServices' threw an exception. 
---> System.PlatformNotSupportedException: Error reading Darwin Kernel Version 
---> System.DllNotFoundException: Unable to load DLL 'libc': The specified module could not be found.
 (Exception from HRESULT: 0x8007007E)
   at Microsoft.Extensions.PlatformAbstractions.Native.NativeMethods.Darwin.sysctl(Int32* name, UInt32 namelen, Byte* oldp, UInt32* oldlenp, IntPtr newp, UInt32 newlen)
   at Microsoft.Extensions.PlatformAbstractions.Native.NativeMethods.Darwin.GetKernelRelease()
   --- End of inner exception stack trace ---
   at Microsoft.Extensions.PlatformAbstractions.Native.NativeMethods.Darwin.GetKernelRelease()
   at Microsoft.Extensions.PlatformAbstractions.Native.PlatformApis.GetDarwinVersion()
   at Microsoft.Extensions.PlatformAbstractions.Native.PlatformApis.GetOSVersion()
   at Microsoft.Extensions.PlatformAbstractions.DefaultRuntimeEnvironment..ctor()
   at Microsoft.Extensions.PlatformAbstractions.DefaultPlatformServices..ctor()
   at Microsoft.Extensions.PlatformAbstractions.PlatformServices..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.Extensions.PlatformAbstractions.PlatformServices.get_Default()
   at Microsoft.DotNet.Cli.Telemetry..ctor()
   at Microsoft.DotNet.Cli.Program.Main(String[] args)
Abort trap: 6
uname -a
Darwin miac 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64

OSX 10.11.4

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cdmihaicommented, Apr 29, 2016

Problem solved. …

I had the following three items in my ~/.bash_profile file:

export CPATH=/usr/include
export LIBRARY_PATH=$CPATH
export DYLD_FALLBACK_LIBRARY_PATH=$CPATH

After commenting those out, stuff works. No idea what tool wrote those lines there, I’ll see if anything else starts breaking all of the sudden 😃

0reactions
cdmihaicommented, Oct 6, 2016

@ballance Look into your ~/.bash_profile for anything odd, maybe relating to C libraries. The nuclear option would be to back it up and try a vanilla one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mac OS: Unhandled Exception: System. ...
TypeInitializationException: The type initializer for 'Crypto' threw an exception. ---> System.TypeInitializationException: The type initializer ...
Read more >
dotnet core in macOS: "The type initializer for 'Crypto' threw ...
Any idea how to install those? mymac:~ naveen.vijay$ dotnet new Unhandled Exception: System.TypeInitializationException: The ...
Read more >
TypeInitializationException:The type initializer for 'Gdip ...
I'm building an application that runs on both windows and macos. This application converts dng to bmp. On Windows (10) it works but...
Read more >
Why i am getting TypeInitializationException - Microsoft Q&A
System.TypeInitializationException: The type initializer for 'Microsoft.Maui.Controls.Shapes.Shape' threw an exception. ---> System.
Read more >
Maperitive won't open on my Mac: Unhandled Exception
Try these steps: Install Mono Framework via Homebrew's Cask: brew cask install mono-mdk. After this step you should have the Mono Framework ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found