Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is MarkdownSharpe Threadsafe? #48

Closed
GoogleCodeExporter opened this issue Jan 27, 2016 · 2 comments
Closed

Is MarkdownSharpe Threadsafe? #48

GoogleCodeExporter opened this issue Jan 27, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link

I cannot find anywhere if it is thread safe.

What steps will reproduce the problem?
1. Use a single instance of Markdown in an ASP.NET app
2. Open many pages at once, in each page format some text

What is the expected output? What do you see instead?
I intermittently get the following exception: 
System.Collections.Generic.Dictionary`2.get_Item(TKey key) +12681071
   MarkdownSharp.Markdown.FormParagraphs(String text) in D:\Development\OpenSource\MarkdownSharp\MarkdownSharp\Markdown.cs:437
   MarkdownSharp.Markdown.RunBlockGamut(String text) in D:\Development\OpenSource\MarkdownSharp\MarkdownSharp\Markdown.cs:389
   MarkdownSharp.Markdown.Transform(String text) in D:\Development\OpenSource\MarkdownSharp\MarkdownSharp\Markdown.cs:363

What version of the product are you using? On what operating system?
markdownsharp-20100703-v113.7z

Please provide any additional information below.


Original issue reported on code.google.com by Iain.Rob...@gmail.com on 21 Sep 2011 at 4:19

@GoogleCodeExporter
Copy link
Author

It is not threadsafe if you use a single instance.

You should create a new instance for each conversion you do, or at least make 
sure that the same instance isn't used by several threads at once. The former 
should be just fine; the setup cost for creating a new instance isn't very 
high. That's what we do on Stack Overflow.

Since the instance stores information about the current state of the 
conversion, having two threads use the same instance is indeed bound to fail. 
That is by design.

Original comment by ahp...@googlemail.com on 12 Oct 2011 at 2:36

  • Changed state: Invalid

@GoogleCodeExporter
Copy link
Author

Thanks for letting me know.

Original comment by Iain.Rob...@gmail.com on 12 Oct 2011 at 10:15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant