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
I happened to be building under debugger, and saw the serialization exception in DateTime ctor (which usually signals corrupt data) when reading the state file: obj\Debug\TestSolution.csproj.AssemblyReference.cache
mscorlib DateTime..ctor Line 159
Microsoft.Build.Tasks.Core BinaryTranslator.BinaryReadTranslator.Translate Line 330
Microsoft.Build.Tasks.Core SystemState.FileState.Translate Line 164
Microsoft.Build.Tasks.Core SystemState.FileState..ctor Line 154
Microsoft.Build.Tasks.Core SystemState.<>c.<Translate>b__18_0 Line 251
Microsoft.Build.Tasks.Core TranslatorHelpers.Translate Line 38
Microsoft.Build.Tasks.Core TranslatorHelpers.<>c__DisplayClass1_0`1.<AdaptFactory>g__TranslateUsingValueFactory|0 Line 51
Microsoft.Build.Tasks.Core BinaryTranslator.BinaryReadTranslator.TranslateDictionary Line 600
Microsoft.Build.Tasks.Core TranslatorHelpers.TranslateDictionary Line 88
Microsoft.Build.Tasks.Core SystemState.Translate Line 255
Microsoft.Build.Tasks.Core SystemState..ctor Line 223
[Internal Frame, 'U-->M']
mscorlib RuntimeConstructorInfo.Invoke Line 753
mscorlib ConstructorInfo.Invoke Line 105
Microsoft.Build.Tasks.Core StateFileBase.DeserializeCache Line 88
Microsoft.Build.Tasks.Core ResolveAssemblyReference.ReadStateFile Line 2006
Microsoft.Build.Tasks.Core ResolveAssemblyReference.Execute Line 2262
Microsoft.Build.Tasks.Core ResolveAssemblyReference.Execute Line 3150
Since there's a try catch around reading the cache, the error is benign (I think?).
But I'd be curious what happened, either the format of serialized dictionaries changed across MSBuild versions or something else.
Yeah; we looked into this because it was preventing caches from being read.
The cache actually does have a version. What is a bug is that the version is read, then the rest is deserialized, then the version is checked, which is not a rational ordering.
This came up with #6350. In addition to removing BF from all other StateFileBases (it had already been removed from SystemState), I combined their serialization code so they'd all go through the same path instead of having essentially just copied code.
The temporary fix is just to update the SDK used to build the SDK, since then it serializes it the same way it's expected to be serialized. I did that, and I'm planning to test that momentarily. This issue will recur, however, should the format change again, so it would be good to move the version check up.
Fixes#6659
The version check was previously after having deserialized everything else. This doesn't make sense and can lead to errors. In this PR, I moved it up.
I happened to be building under debugger, and saw the serialization exception in DateTime ctor (which usually signals corrupt data) when reading the state file:
obj\Debug\TestSolution.csproj.AssemblyReference.cache
The .cache file is attached:
TestSolution.csproj.AssemblyReference.zip
Since there's a try catch around reading the cache, the error is benign (I think?).
But I'd be curious what happened, either the format of serialized dictionaries changed across MSBuild versions or something else.
@Forgind any ideas?
The text was updated successfully, but these errors were encountered: