Description
This is an odd one.
I have a custom process which is trying to parse the assemblies of this project, and generate stubs in another language. As part of that, I've found what might be an error in the assemblies. And I cannot figure out exactly whether it is an error, or some artifact of my process.
Working against the assemblies in the 17.4.0 NuGet package.
Within Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestSessionPool class, there is a method named set_Instance. It's the setter for the static Instance property. Applied to this method is an "AllowNullAttribute". You can see this in code:
However, within the assembly within the Nuget package, this attribute is of type [Microsoft.TestPlatform.CoreUtilities]System.Diagnostics.CodeAnalysis.AllowNullAttribute
. Notice that it's supposed to be located in the Microsoft.TestPlatform.CoreUtilities
assemby. It appears as a TypeRef.
The output of ildsm against TestSessionpool:
.method assembly hidebysig specialname static
void set_Instance(class Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestSessionPool 'value') cil managed
{
.param [1]
.custom instance void [Microsoft.TestPlatform.CoreUtilities]System.Diagnostics.CodeAnalysis.AllowNullAttribute::.ctor() = ( 01 00 00 00 )
// Code size 9 (0x9)
.maxstack 8
IL_0000: ldarg.0
IL_0001: volatile.
IL_0003: stsfld class Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestSessionPool modreq([netstandard]System.Runtime.CompilerServices.IsVolatile) Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestSessionPool::s_instance
IL_0008: ret
} // end of method TestSessionPool::set_Instance
See the attribute applied.
However, Microsoft.TestPlatform.CoreUtilities
from the same NuGet package has no such attribute.
I suspect this has something to do with how ya'll are adding these custom attributes for down level assemblies: https://github.com/microsoft/vstest/blob/main/shared/NullableAttributes.cs
But I'm not sure. Not sure what you could be doing wrong.
Maybe what I'm seeing is that the NuGet package has a mix of assemblies? I don't know. I see that you've got NullableAttributes.cs included into CoreUtilities. There's a bunch of IFDEFs. Is it possible that the version of CoreUtilities being distributed is different than the one the CrossPlatEngine is built against?