-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
The piece of code causing the issue at RazorMachine.cs
protected MemoryContentProvider MemoryContentProvider {
get {
var provider = Context.TemplateFactory.ContentManager.TryGetContentProvider<MemoryContentProvider>();
if (provider == null)
Context.TemplateFactory.ContentManager.AddContentProvider(provider = new MemoryContentProvider());
return provider;
}
}When two threads reach the getter at the same time (using one RazorMachine instance) it is possible that both of them add new MemoryContentProvider to the context and each next call to Context.TemplateFactory.ContentManager.TryGetContentProvider() will throw an exception (SingleOrDefault at CompositeContentProvider.TryGetContentProvider(Type type)).
This situation is possible only when calling the MemoryContentProvider getter first time, but this can leave the RazorMachine object in unusable state.
Metadata
Metadata
Assignees
Labels
No labels