|
|
|
|
@ -209,14 +209,19 @@ namespace ICSharpCode.ILSpyX
@@ -209,14 +209,19 @@ namespace ICSharpCode.ILSpyX
|
|
|
|
|
/// </remarks>
|
|
|
|
|
public ICompilation? GetTypeSystemOrNull() |
|
|
|
|
{ |
|
|
|
|
return LazyInitializer.EnsureInitialized(ref this.typeSystem, () => { |
|
|
|
|
var value = Volatile.Read(ref this.typeSystem); |
|
|
|
|
if (value == null) |
|
|
|
|
{ |
|
|
|
|
var module = GetMetadataFileOrNull(); |
|
|
|
|
if (module == null || module.IsMetadataOnly) |
|
|
|
|
return null!; |
|
|
|
|
return new SimpleCompilation( |
|
|
|
|
return null; |
|
|
|
|
value = new SimpleCompilation( |
|
|
|
|
module.WithOptions(TypeSystemOptions.Default | TypeSystemOptions.Uncached | TypeSystemOptions.KeepModifiers), |
|
|
|
|
MinimalCorlib.Instance); |
|
|
|
|
}); |
|
|
|
|
value = LazyInit.GetOrSet(ref this.typeSystem, value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return value; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
readonly object typeSystemWithOptionsLockObj = new object(); |
|
|
|
|
|