You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[5.0.100-rc.1.20454.5] Build/Launch NuGetPackageExplorer failed due to exception "Could not find type 'System.Runtime.Versioning.MinimumOSPlatformAttribute'"
#13458
Closed
jiangzeng01 opened this issue
Sep 9, 2020
· 6 comments
Application Name: NuGetPackageExplorer OS: Windows 10 RS5 CPU: X64 .NET Build Number: 5.0.100-rc.1.20454.5 App Source on GitHub link:https://github.com/NuGetPackageExplorer/NuGetPackageExplorer (this source is new, we test old version )
(We found this bug when we are trying to upgrade the NuGetPackageExplorer app, and build with latest RC1 SDK.)
Repro steps:
open command prompt window.
Run "cd C:\Users\Appcompat\Documents\NuGetPackageExplorer" command, navigate to the app path.
Run "dotnet NuGetPackageExplorer.dll" to lanuch the app.
Expected Result:
Open NuGetPackageExplorer successful.
Actual Result:
Unable to lanuch NuGetPackageExplorer
Exception Log:
Unhandled exception. System.TypeLoadException: Could not load type 'System.Runtime.Versioning.MinimumOSPlatformAttribute' from assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctorWithParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
at System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)
at System.Reflection.CustomAttributeExtensions.GetCustomAttributes[T](Assembly element)
at NuGetPe.Utility.AppVersionTelemetryInitializer..ctor() in C:\Users\Appcompat\Downloads\NuGetPackageExplorer-5.8.2\NuGetPackageExplorer-5.8.2\Core\Utility\AppVersionTelemetryInitializer.cs:line 19
at NuGetPe.DiagnosticsClient.Initialize() in C:\Users\Appcompat\Downloads\NuGetPackageExplorer-5.8.2\NuGetPackageExplorer-5.8.2\Core\Utility\DiagnosticsClient.cs:line 17
at PackageExplorer.App..ctor() in C:\Users\Appcompat\Downloads\NuGetPackageExplorer-5.8.2\NuGetPackageExplorer-5.8.2\PackageExplorer\App.xaml.cs:line 30
at PackageExplorer.App.Main()
Findings :
We search the this change on Github and found this class name is changed from MinimumOSPlatformAttribute to SupportedOSPlatformAttribute: #12775
If we change the sdk version to "5.0.100-rc.1.20454.5", we will get exception when building the app.
{
"sdk": {
"version": "5.0.100-rc.1.20454.5"
}
}
Exception from the sample code above :
C:\Users\Appcompat\source\repos\MinimumOSPlatformAttributeExceptionSample\MinimumOSPlatformAttributeExceptionSample\Program.cs(10,13): error CS0246: The type or namespace name 'MinimumOSPlatformAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Appcompat\source\repos\MinimumOSPlatformAttributeExceptionSample\MinimumOSPlatformAttributeExceptionSample\MinimumOSPlatformAttributeExceptionSample.csproj]
C:\Users\Appcompat\source\repos\MinimumOSPlatformAttributeExceptionSample\MinimumOSPlatformAttributeExceptionSample\Program.cs(10,57): error CS0246: The type or namespace name 'MinimumOSPlatformAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Appcompat\source\repos\MinimumOSPlatformAttributeExceptionSample\MinimumOSPlatformAttributeExceptionSample\MinimumOSPlatformAttributeExceptionSample.csproj]
@adamsitnik We found that it was changed in PR #12775.
It looks by design, and it caused issue when we use the latest RC1 SDK to build the app which are using property "MinimumOSPlatformAttribute".
We need to confirm and see if any break change document for this?
@jiangzeng01 We did not yet write it, since we don't typically produce breaking change documents between preview releases. But due to the impact this has caused, I've labeled dotnet/runtime#40360 with needs-breaking-change-doc-created to capture that task and we will get it written very soon.
Application Name: NuGetPackageExplorer
OS: Windows 10 RS5
CPU: X64
.NET Build Number: 5.0.100-rc.1.20454.5
App Source on GitHub link: https://github.com/NuGetPackageExplorer/NuGetPackageExplorer (this source is new, we test old version )
(We found this bug when we are trying to upgrade the NuGetPackageExplorer app, and build with latest RC1 SDK.)
Verify Scenarios:
1). Windows 10 RS5 X64 + .NET Core SDK build 5.0.100-rc.1.20454.5: Fail
2). Windows 10 RS5 X64 + .NET Core SDK build 5.0.100-preview.8.20417.9-win-x64: Pass
Repro Machine:
See in bug: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1198579/
Repro steps:
open command prompt window.
Run "cd C:\Users\Appcompat\Documents\NuGetPackageExplorer" command, navigate to the app path.
Run "dotnet NuGetPackageExplorer.dll" to lanuch the app.
Expected Result:
Open NuGetPackageExplorer successful.
Actual Result:
Unable to lanuch NuGetPackageExplorer
Exception Log:
Findings :
We search the this change on Github and found this class name is changed from MinimumOSPlatformAttribute to SupportedOSPlatformAttribute:
#12775
We also created a simple reproduce project:
https://github.com/jiangzeng01/MinimumOSPlatformAttributeExceptionSample.git
When we set sdk version as "5.0.100-preview.8.20417.9" in global.json file, the project can be built and run successful:
If we change the sdk version to "5.0.100-rc.1.20454.5", we will get exception when building the app.
Exception from the sample code above :
cc @dotnet-actwx-bot
The text was updated successfully, but these errors were encountered: