Version Used:
dac98b9 (latest commit on the main branch as of this writing), the most recent commit to the document is 0e94007
Steps to Reproduce:
The code of RazorDocumentServiceProviderWrapper is formally incorrect in terms of parallelism. It applies the double-checked locking pattern without marking the respective fields as volatile.
Expected Behavior:
One possible solution is marking the fields _spanMappingService, _excerptService, and _documentPropertiesService as volatile to conform to C#'s memory-model.
Actual Behavior:
Formally incorrect, see Exploring the Singleton Design Pattern (docs.microsoft.com)
Version Used:
dac98b9 (latest commit on the main branch as of this writing), the most recent commit to the document is 0e94007
Steps to Reproduce:
The code of RazorDocumentServiceProviderWrapper is formally incorrect in terms of parallelism. It applies the double-checked locking pattern without marking the respective fields as
volatile.Expected Behavior:
One possible solution is marking the fields
_spanMappingService,_excerptService, and_documentPropertiesServiceasvolatileto conform to C#'s memory-model.Actual Behavior:
Formally incorrect, see Exploring the Singleton Design Pattern (docs.microsoft.com)