• A
    Avoid a race around initialization of TypeWithAnnotations structure and IsDefault check. (#38230) · 9e200000
    AlekseyTs 提交于
    Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/797080.
    
    We have several Watson buckets that imply that a TypeWithAnnotations structure returned by RetargetingMethodSymbol.ReturnTypeWithAnnotations and RetargetingPropertySymbol.TypeWithAnnotations has null as its Type property. The properties are backed by fields that are initialized by an API that never produces structures like that (with null Type property). I suspect that the situation can arise in case of a race between two threads, where the structure is only partially initialized so that IsDefault check fails in one thread, but the underlying information for the Type property is still not initialized by another thread.
    
    This change eliminates possibility of races like that.
    
    Related to #38247.
    9e200000
LocalFunctionSymbol.cs 19.5 KB