反序列化二进制文件时如何调试TargetInvocationException?

时间:2017-09-25 20:30:38

标签: c# deserialization

每当我打开一个序列化文件(二进制)创建一个旧版本的应用程序(我在这里工作之前)时,我就会收到此错误。它看起来像这样:

例外:

"Exception has been thrown by the target of an invocation." System.Reflection.TargetInvocationException

内心的预期:

InnerException  {"Could not load type 'ENTRY CLASS' from assembly 'PROJECT', Version=1.0.6477.29527, Culture=neutral, PublicKeyToken=null'.":"ENTRY CLASS"} System.Exception {System.TypeLoadException}

堆栈追踪:

       at System.RuntimeMethodHandle.SerializationInvoke(IRuntimeMethodInfo method, Object target, SerializationInfo info, StreamingContext& context)
   at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)
   at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
   at System.Runtime.Serialization.ObjectManager.DoFixups()
   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
   at PACKAGE.NavigationManager.OpenSavedFile(String filePath) in C:IRL 205
   at NFPA_Checker.NavigationManager.OpenFileDialog_FileOk(Object sender, CancelEventArgs e) in C:\IRL 192
   at Microsoft.Win32.FileDialog.OnFileOk(CancelEventArgs e)
   at Microsoft.Win32.FileDialog.HandleVistaFileOk(IFileDialog dialog)
   at Microsoft.Win32.FileDialog.VistaDialogEvents.MS.Internal.AppModel.IFileDialogEvents.OnFileOk(IFileDialog pfd)

您似乎没有从错误中获得足够的信息。你如何调试这样的错误?

0 个答案:

没有答案