Open omajid opened 5 months ago
https://github.com/jbevain/cecil/blob/8e1ae7b4ea67ccc38cb8db3ded6802643109ffd7/Mono.Cecil/ModuleDefinition.cs#L387-L393
It seems like this sequence of events might be possible, resulting in creation of an DefaultAssemblyResolver instance that's never disposed:
assembly_resolver.value == null
lock
assembly_resolver
The instance in step 3 is now lost and was never disposed.
I agree, using if/lock/if would be appropriate as it's a standard pattern, or just changing = to ??= in this case.
if
=
??=
https://github.com/jbevain/cecil/blob/8e1ae7b4ea67ccc38cb8db3ded6802643109ffd7/Mono.Cecil/ModuleDefinition.cs#L387-L393
It seems like this sequence of events might be possible, resulting in creation of an DefaultAssemblyResolver instance that's never disposed:
assembly_resolver.value == null
assembly_resolver.value == null
lock
block and setsassembly_resolver
to a new instancelock
block and re-setsassembly_resolver
to a new instanceThe instance in step 3 is now lost and was never disposed.