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
RAR is slower when using the .NET 6 Preview 4 SDK.
MSBuild caches assembly reference information on behalf of users to make the ResolveAssemblyReference task faster. This caching includes serializing the cache to disk and reading it back if necessary. A change that went into the .NET 6 preview 4 SDK prevented creating strong name key pairs for AssemblyNames. RAR's serialization currently tries to set the KeyPair to null when reading the cache, which fails for that reason. The error is caught and turned into a message, so the user only sees a slower build.
The change (from MSBuild's perspective) that introduced the serialization code was #6094. The change that suppressed the warning (turning it into a message) was #6243.
Steps to Reproduce
Use the .NET 6 Preview 4 SDK to build twice.
Expected Behavior
Correct deserialization of RAR caches and fast RAR execution (for the second build, at least).
Actual Behavior
On the surface, a message (in a diagnostic (maybe normal?) verbosity build log) like:
Could not read state file "obj\Debug\net6.0\cons.csproj.AssemblyReference.cache". Strong-name signing is not supported on this platform. (TaskId:62)
Debugging into it:
Strong-name signing is not supported on this platform.
at System.Reflection.AssemblyName.set_KeyPair(StrongNameKeyPair value)
at Microsoft.Build.BackEnd.TranslatorHelpers.Translate(ITranslator translator, AssemblyName& assemblyName) in /_/src/Shared/TranslatorHelpers.cs:line 254
at Microsoft.Build.Shared.AssemblyNameExtension.Translate(ITranslator translator) in /_/src/Shared/AssemblyNameExtension.cs:line 1021
at Microsoft.Build.Tasks.SystemState.FileState.<>c.<Translate>b__8_0(ITranslator t) in /_/src/Tasks/SystemState.cs:line 173
at Microsoft.Build.BackEnd.TranslatorHelpers.Translate[T](ITranslator translator, T& instance, NodePacketValueFactory`1 valueFactory) in /_/src/Shared/TranslatorHelpers.cs:line 38
at Microsoft.Build.Tasks.SystemState.FileState.Translate(ITranslator translator) in /_/src/Tasks/SystemState.cs:line 174
at Microsoft.Build.Tasks.SystemState.<>c.<Translate>b__22_0(ITranslator t) in /_/src/Tasks/SystemState.cs:line 331
at Microsoft.Build.BackEnd.TranslatorHelpers.Translate[T](ITranslator translator, T& instance, NodePacketValueFactory`1 valueFactory) in /_/src/Shared/TranslatorHelpers.cs:line 38
at Microsoft.Build.BackEnd.TranslatorHelpers.<>c__DisplayClass1_0`1.<AdaptFactory>g__TranslateUsingValueFactory|0(ITranslator translator, T& objectToTranslate) in /_/src/Shared/TranslatorHelpers.cs:line 51
at Microsoft.Build.BackEnd.BinaryTranslator.BinaryReadTranslator.TranslateDictionary[T](Dictionary`2& dictionary, IEqualityComparer`1 comparer, ObjectTranslator`1 objectTranslator) in /_/src/Shared/BinaryTranslator.cs:line 600
at Microsoft.Build.BackEnd.TranslatorHelpers.TranslateDictionary[T](ITranslator translator, Dictionary`2& dictionary, IEqualityComparer`1 comparer, NodePacketValueFactory`1 valueFactory) in /_/src/Shared/TranslatorHelpers.cs:line 88
at Microsoft.Build.Tasks.SystemState.Translate(ITranslator translator) in /_/src/Tasks/SystemState.cs:line 332
at Microsoft.Build.Tasks.SystemState.DeserializeCacheByTranslator(String stateFile, TaskLoggingHelper log) in /_/src/Tasks/SystemState.cs:line 302
Analysis
Serializing should work fine because nothing is actually being written. Deserializing attempts to set the (StrongName) KeyPair to null, which caused the above exception. It should instead not be set.
Issue Description
RAR is slower when using the .NET 6 Preview 4 SDK.
MSBuild caches assembly reference information on behalf of users to make the ResolveAssemblyReference task faster. This caching includes serializing the cache to disk and reading it back if necessary. A change that went into the .NET 6 preview 4 SDK prevented creating strong name key pairs for AssemblyNames. RAR's serialization currently tries to set the KeyPair to null when reading the cache, which fails for that reason. The error is caught and turned into a message, so the user only sees a slower build.
The change (from MSBuild's perspective) that introduced the serialization code was #6094. The change that suppressed the warning (turning it into a message) was #6243.
Steps to Reproduce
Use the .NET 6 Preview 4 SDK to build twice.
Expected Behavior
Correct deserialization of RAR caches and fast RAR execution (for the second build, at least).
Actual Behavior
On the surface, a message (in a diagnostic (maybe normal?) verbosity build log) like:
Debugging into it:
Analysis
Serializing should work fine because nothing is actually being written. Deserializing attempts to set the (StrongName) KeyPair to null, which caused the above exception. It should instead not be set.
I put my fix in #6395
/cc: @rokonec
The text was updated successfully, but these errors were encountered: