With xaml compilation turned on, why do I get this runtime exception (that doesn't happen when off)?

kevinsalotkevinsalot USUniversity ✭✭

I turned on XAML compilation in my project. I needed to create a couple type converters to get the compilation to pass. Now, at runtime, while running InitializeComponent() for the first page, I get this exception:

"System.BadImageFormatException: Method with open type while not compiling gshared"

I get this exception for both android and iOS. With Xaml compilation turned off, the application runs fine (without making any other code changes). I haven't been able to find examples of this exception anywhere else. Could someone please help point me in the right direction for how to correct this?

Best Answer

Answers

  • I had the same error : "System.BadImageFormatException: Method with open type while not compiling gshared"

    It was in a TabbedPage, and defining tabs events in Xaml makes this crash. So I remove the event (i.e. CurrentPageChanged) in Xaml and defines it in code-behind. All is working.

Sign In or Register to comment.