axuno / SmartFormat

A lightweight text templating library written in C# which can be a drop-in replacement for string.Format
Other
1.1k stars 105 forks source link

Exceptions with multi-threading #283

Closed alfkonee closed 2 years ago

alfkonee commented 2 years ago

Hi! Thanks for reporting this bug!

Please fill in the relevant information from this template so that we can help you best.

Smart.Format version: 3.0.0

Framework version: net6.0

axunonb commented 2 years ago

Without a working example it's hard to tell what went wrong. My guess are 2 things:

  1. As multi-threading or async seems to be used, SmartSettings.IsThreadSafeMode = true must be set. The default is false.
  2. Smart.Format(...) methods can't be used in this case, as they use a static SmartFormatter instance. A new SmartFormatter must be created for each thread.

See the Wiki and the hint in the README for details.

alfkonee commented 2 years ago

Thanks for the info about the thread safety I guess it's a 3.0 Feature that was added Right??

Yes I'm working in a Highly Multi threaded Environment will apply the fix and feedback the performance updates

axunonb commented 2 years ago

We just published release v3.1.0: