IndexOutOfRangeException in Release-Distribution #495

Closed
opened 2026-01-29 14:38:09 +00:00 by claunia · 3 comments
Owner

Originally created by @stephanblaurock on GitHub (Jan 19, 2022).

I'm trying to render a simple MD-String I get following error:

var output = Markdown.ToHtml("# This is a test");

System.TypeInitializationException: The type initializer for 'Markig.Markdown' threw an exception. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array. at Markdig.Markdown..cctor()..

In the simulator, everything works fine in both DEBUG build and RELEASE build
On the physical device (via InHouse-Distribution) everything works in the DEBUG build but NOT in the RELEASE build :-(

My environment:
MacOSX Big Sur (11.6.1)
Visual Studio for Mac (8.10.16 build 2)
Xamarin Forms (5.0.0.2291)
Markdig (0.26.0)
iOS-Simulator (15.2)
iOS-Device (15.2)

Originally created by @stephanblaurock on GitHub (Jan 19, 2022). I'm trying to render a simple MD-String I get following error: `var output = Markdown.ToHtml("# This is a test");` `System.TypeInitializationException: The type initializer for 'Markig.Markdown' threw an exception. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array. at Markdig.Markdown..cctor()..` In the simulator, everything works fine in both DEBUG build and RELEASE build On the physical device (via InHouse-Distribution) everything works in the DEBUG build but NOT in the RELEASE build :-( My environment: MacOSX Big Sur (11.6.1) Visual Studio for Mac (8.10.16 build 2) Xamarin Forms (5.0.0.2291) Markdig (0.26.0) iOS-Simulator (15.2) iOS-Device (15.2)
claunia added the question label 2026-01-29 14:38:09 +00:00
Author
Owner

@MihaZupan commented on GitHub (Jan 19, 2022):

This is most likely the same as #536 and #564.

The problem is not with Markdig, but with Xamarin iOS (e.g. a linker being too aggressive in removing attributes).

My suggestion is the same as for the other issues https://github.com/xoofx/markdig/issues/564#issuecomment-894346086 - file an issue with Xamarin so they can investigate.
Or if you are interested in doing the investigation yourself, a good start would be

Something you could try is to build Markdig yourself and remove this line to see if the problem still reproduces. If it requires an actual device, I'm afraid I can't validate the change myself.

@MihaZupan commented on GitHub (Jan 19, 2022): This is most likely the same as #536 and #564. The problem is not with Markdig, but with Xamarin iOS (e.g. a linker being too aggressive in removing attributes). My suggestion is the same as for the other issues https://github.com/xoofx/markdig/issues/564#issuecomment-894346086 - file an issue with Xamarin so they can investigate. Or if you are interested in doing the investigation yourself, a good start would be > Something you could try is to build Markdig yourself and remove [this line](https://github.com/xoofx/markdig/blob/cdd4b40469bc62258ede879fb7ed38237ef8a2fb/src/Markdig/Markdown.cs#L22) to see if the problem still reproduces. If it requires an actual device, I'm afraid I can't validate the change myself.
Author
Owner

@ptrkbmn commented on GitHub (Mar 9, 2022):

Should be fixed with #600

@ptrkbmn commented on GitHub (Mar 9, 2022): Should be fixed with #600
Author
Owner

@MihaZupan commented on GitHub (Mar 30, 2022):

Closing as fixed.

@MihaZupan commented on GitHub (Mar 30, 2022): Closing as fixed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#495