The type initializer for 'Markdig.Wpf.MarkdownViewer' threw an exception #245

Open
opened 2026-01-29 14:31:35 +00:00 by claunia · 0 comments
Owner

Originally created by @FoggyFinder on GitHub (Dec 16, 2018).

The code below doesn't compile with new version of markdig (0.15.5)

open FsXaml

type TestWindowBase = XAML<"TestWindow.xaml">

type TestWindow(md) as self =
     inherit TestWindowBase ()

     do self.mdviewer.Markdown <- md

let sampleMD = """
| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |
"""

let window = sampleMD |> TestWindow 

[<EntryPoint>]
[<System.STAThread>]
let main argv =
    System.Windows.Application().Run window

where TestWindow.xaml is:

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf">
    <Grid>
        <markdig:MarkdownViewer Name="mdviewer" />
    </Grid>
</Window>

It works fine with 0.15.4 although.

Initally I opened issue in markdig.wpf. Still not sure where it should be open.

Originally created by @FoggyFinder on GitHub (Dec 16, 2018). The code below doesn't compile with new version of markdig (0.15.5) ```fsharp open FsXaml type TestWindowBase = XAML<"TestWindow.xaml"> type TestWindow(md) as self = inherit TestWindowBase () do self.mdviewer.Markdown <- md let sampleMD = """ | Tables | Are | Cool | | ------------- |:-------------:| -----:| | col 3 is | right-aligned | $1600 | | col 2 is | centered | $12 | | zebra stripes | are neat | $1 | """ let window = sampleMD |> TestWindow [<EntryPoint>] [<System.STAThread>] let main argv = System.Windows.Application().Run window ``` where `TestWindow.xaml` is: ```xaml <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf"> <Grid> <markdig:MarkdownViewer Name="mdviewer" /> </Grid> </Window> ``` It works fine with 0.15.4 although. Initally I opened issue in [markdig.wpf](https://github.com/Kryptos-FR/markdig.wpf/issues/20). Still not sure where it should be open.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#245