Application run - The process was terminated due to an unhandled exception. System.ArgumentException at System.RuntimeType.TryChangeType

Georgy Gorelko 1 Reputation point Microsoft Employee
2022-10-06T20:47:52.26+00:00

VS 2022 crashes in the middle of project compilation with the event exception below. We have MSBuild.Corext.17.3.4 and VS 2022 17.3.5
Please advise.

Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException
at System.RuntimeType.TryChangeType(System.Object, System.Reflection.Binder, System.Globalization.CultureInfo, Boolean)
at System.Reflection.RtFieldInfo.UnsafeSetValue(System.Object, System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Globalization.CultureInfo)
at System.Runtime.Serialization.FormatterServices.SerializationSetValue(System.Reflection.MemberInfo, System.Object, System.Object)
at System.Runtime.Serialization.ObjectManager.CompleteObject(System.Runtime.Serialization.ObjectHolder, Boolean)
at System.Runtime.Serialization.ObjectManager.DoNewlyRegisteredObjectFixups(System.Runtime.Serialization.ObjectHolder)
at System.Runtime.Serialization.ObjectManager.RegisterObject(System.Object, Int64, System.Runtime.Serialization.SerializationInfo, Int64, System.Reflection.MemberInfo, Int32[])
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.RegisterObject(System.Object, System.Runtime.Serialization.Formatters.Binary.ParseRecord, System.Runtime.Serialization.Formatters.Binary.ParseRecord, Boolean)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObjectEnd(System.Runtime.Serialization.Formatters.Binary.ParseRecord)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(System.Runtime.Remoting.Messaging.HeaderHandler, System.Runtime.Serialization.Formatters.Binary.__BinaryParser, Boolean, Boolean, System.Runtime.Remoting.Messaging.IMethodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(System.IO.Stream, System.Runtime.Remoting.Messaging.HeaderHandler, Boolean, Boolean, System.Runtime.Remoting.Messaging.IMethodCallMessage)
at Microsoft.Build.BackEnd.BinaryTranslator+BinaryReadTranslator.TranslateDotNet[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]
at Microsoft.Build.Shared.LogMessagePacketBase.ReadFromStream(Microsoft.Build.BackEnd.ITranslator)
at Microsoft.Build.BackEnd.LogMessagePacket.FactoryForDeserialization(Microsoft.Build.BackEnd.ITranslator)
at Microsoft.Build.BackEnd.NodePacketFactory+PacketFactoryRecord.DeserializeAndRoutePacket(Int32, Microsoft.Build.BackEnd.ITranslator)
at Microsoft.Build.BackEnd.NodePacketFactory.DeserializeAndRoutePacket(Int32, Microsoft.Build.BackEnd.NodePacketType, Microsoft.Build.BackEnd.ITranslator)
at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase+NodeContext.ReadAndRoutePacket(Microsoft.Build.BackEnd.NodePacketType, Byte[], Int32)
at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase+NodeContext.BodyReadComplete(System.IAsyncResult)
at System.IO.Pipes.PipeStream.AsyncPSCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)

Developer technologies | Visual Studio | Debugging
Developer technologies | Visual Studio | Other
Community Center | Not monitored
{count} votes

1 answer

Sort by: Most helpful
  1. Georgy Gorelko 1 Reputation point Microsoft Employee
    2022-10-18T19:46:25.55+00:00

    We have identified the root cause of issue was FXCopyTask failing being referenced to v16 and crashing in VS 2022. After upgrading Visual Studio Static AnalysisTools.Corext package to v17 issue has been fixed:

    <package id="VisualStudio.StaticAnalysisTools.Corext"         version="17.0.0" />  
    

    Similar question has been raised and discussed in SO - https://stackoverflow.microsoft.com/questions/308964

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.