An Exception was thrown by the type initializer RRS feed

  • Question

  • User33705 posted

    I'm getting this exception when i run my application in release mode. Works fine in debug. I thought initially it had to do with the linker, but i have removed that and now include everything and still receiving the error. the app is using TinyIOC,

    I Inherited this app and this is the first time I've actually had to do anything with it, the top error occurs even if i run in debug mode, not sure if that could be the root of the issue but i don't think so.

    Please see attached image for error received.

    Monday, June 22, 2015 11:59 AM

All replies

  • User112 posted

    Do you have any #if directives in code?

    Monday, June 22, 2015 2:41 PM
  • User33705 posted

    Hi @MihaMarkic thanks for your response, well the app is using TinyIOC and SQLLite which both use directives, and it seems to be causing the issue when trying to resolve the object using TinyIOC when in Release mode.

    E/AndroidRuntime(19928): at TinyIoC.TinyIoCContainer.ResolveInternal (TinyIoC.TinyIoCContainer/TypeRegistration,TinyIoC.NamedParameterOverloads,TinyIoC.ResolveOptions)

    but there's no more directives.

    Monday, June 22, 2015 3:00 PM
  • User112 posted

    You sure you are not linking anything?

    Monday, June 22, 2015 3:03 PM
  • User33705 posted

    I've set the app to not link to try resolve the issue. the app should be around 17mb and now its 43. Cheers for your help. I've tried this step a few times on both Visual studio and Xamarin Studio, both with same result.

    Cheers for helping, given me more things to look into

    Monday, June 22, 2015 3:58 PM
  • User112 posted

    You could create a simple sample that reproduces the problem and post it here.

    Tuesday, June 23, 2015 6:13 AM
  • User33705 posted

    @MihaMarkic i've been able to replicate it in a sample app. Will work in debug mode but throws the same exception above. I've used TinyIoc in the sample app also but i've tested without and same issue occurs.

    I'm going to try update the NetTopologySuite that it references.

    I have also built this app as a console application and it works in release.

    Tuesday, June 23, 2015 2:16 PM
  • User33705 posted

    I've no idea what the issue is or what's causing the issue. The only resolution was to revert back to Xamarin 3.9.547. Since Xamarin 3.11.445 the issue arises.

    Thursday, June 25, 2015 10:15 AM