mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-12 21:39:32 +00:00
WebAssembly functionally broken between 0.28.1 and 0.29.0 #534
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @wleader on GitHub (Apr 22, 2022).
I was testing with some very simple code and I have observed the following:
This code does work in a .Net 6.0 Console application with version 0.29.0 & 0.28.1
This code does work in a .Net 6.0 Blazor Web Assembly project with version 0.28.1 and several earlier versions (28.0, 27.0, 22.0).
This code does not work in a .Net 6.0 Blazor Web Assembly project with version 0.29.0 and later.
By 'not work' what I observered is that the result of .ToHtml is an empty string. It is not null. No exceptions are thrown,
So as far as I can tell, something between 28.1 an 29.0 broke the ability for the library to function correctly within Blazor WebAssembly projects. I did review https://github.com/xoofx/markdig/compare/0.28.1...0.29.0 but nothing there jumped out at me as an obvious culprit.
Unfortunately its not that easy to debug .Net code running as WASM in a browser, so I am running up against my ability to work out what is going on here. I did attempt to set the Builder's DebugLog to Console.Out, to see if that would get me anything, but then a code search has turned up that almost nothing writes to DebugLog.
At the moment, I will be forced to stay on 0.28.1.
@MihaZupan commented on GitHub (Apr 22, 2022):
Among those changes, my guess is it's something about #621. I'll have to dig in to find out which change doesn't like WASM.
@MihaZupan commented on GitHub (Apr 22, 2022):
It is indeed
76e25833ad.Specifically
b32e71aaeb/src/Markdig/Renderers/RendererBase.cs (L183-L184)The MT pointer (or whatever that memory is in WASM) appears to be always 0.
@RayWangQvQ commented on GitHub (Apr 23, 2022):
Version

0.30.1has the same problem:Hope it can be fixed as soon as possible.
BTW, I don't understand why such an obvious bug would be exposed to the release.
Since many WASM projects recommend using markdig, I wonder if WASM testing can be added to the test standard in the future to avoid similar bugs.
@xoofx commented on GitHub (Apr 23, 2022):
I didn't know that markdig was used in the context of WASM 😅
So feel free to make a PR. At work we had to add WASM testing for a complete different project and that was quite a work and struggle. If with Blazor that's easy, then you are welcome.
@xoofx commented on GitHub (Apr 23, 2022):
0.30.2was just released and should fix this problem.@NickPolyder commented on GitHub (Jun 11, 2023):
Hello @xoofx,
I have the version
0.31.0and it still appears to be the same issue for me.thats what I have
@xoofx commented on GitHub (Jun 11, 2023):
Open a new issue. It might be a different problem. Personally, won't have time to investigate.
@NickPolyder commented on GitHub (Jun 11, 2023):
Thank you for the quick response @xoofx.
Actually after a lot of research I found out that the reason that it was not working was the header of the file that I was reading it from.
It had a header of
\uFEFFwhich is the byte array{ 239, 187, 191 }and it appears to be for utf8 files and that was making the whole first line to not be able to be parsed.I dont know if there is any place you would like me to post this for the next person to find or if there is a documentation that I could post it in case someone else has the same issue.
Best,