-
Notifications
You must be signed in to change notification settings - Fork 26
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I was unable to reproduce this. What is the precise version of Visual Studio 2019 that you're using? And what is the precise .NET Framework version you have installed? Both are available via Help -> About Microsoft Visual Studio. Click Copy info and paste it here. It seems to be because there was a point in time when ValueTuple was not marked serializible. But I'm not sure how that changed all of a sudden. Do you see this problem in multiple projects? If not, perhaps try deleting the Perhaps also try deleting and re-downloading the visualizer. I would greatly appreciate it if you could keep me informed of further developments, thanks. |
I removed the old installation and installed the latest version of the visualizer. I also took your recommendation of deleting the .vs folders. Whereas before I said that the error ocurred in two separate projects, it now only appears in one of those projects. (It is possible that in my first post I incorrectly assumed it wasn't working in that one project it now works in.) In other projects I tested it worked fine. Precise Info (As requested): Microsoft Visual Studio Community 2019 Installed Version: Community Azure App Service Tools v3.0.0 16.4.457.38025 C# Tools 3.4.1-beta4-19610-02+c4e5d138903b899477649a17f197abd2bcb22f9e Common Azure Tools 1.10 IntelliCode Extension 1.0 Microsoft JVM Debugger 1.0 Microsoft MI-Based Debugger 1.0 NpgsqlVSPackage Extension 1.0 NuGet Package Manager 5.4.0 ProjectServicesPackage Extension 1.0 SQL Server Data Tools 16.0.61912.09160 Visual Basic Tools 3.4.1-beta4-19610-02+c4e5d138903b899477649a17f197abd2bcb22f9e Visual F# Tools 10.4 for F# 4.6 16.4.0-beta.19556.5+e7597deb7042710a7142bdccabd6f92b0840d354 Visual Studio Code Debug Adapter Host Package 1.0 VsVim 2.8.0.0 |
@bartjekwartje Thanks for your patience. Do you think you could upload here up a minimal project that reproduces the problem? |
@bartjekwartje Could you download the visualizer once more and try again? |
@zspitz I followed up on your request to download the visualizer once more and try again. The following describes the steps I undertook and what these resulted in. I downloaded the zip-file at: Quit visual studio Then copied the zip's tree/contents to: Restarted Visual studio Ran my code and set a breakpoint on a line with the following code: Added 'lambda' to the watch window. Clicked on the Expression Tree Visualizer Magnifying Glass, which then presented me three visualizers to pick from: Note that 'Readable Expressions Visualizer' appears twice. After selecting any of those two, a dialog appears showing information which seems to indicate that that visualizer does work. But after selecting 'Expression Tree Visualizer' a dialog opens showing the following text: Unable to load the custom visualizer. Additional information: Could not load type 'ExpressionTreeVisualizer.Serialization.VisualizerDataOptions' from assembly 'ExpressionTreeVisualizer.Debuggee, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Learn more about managed custom visualizers Then I quit visual studio. Removed the files I copied to: Renamed the offending project's .vs folder After running the project again, breaking into it and putting 'lambda' in the watch window, I can still choose from three visualizers, including ExpressionTreeVisualizer. Selecting it shows a dialog with the following error information: An unhandled exception of type 'System.Runtime.Serialization.SerializationException' was thrown by the custom visualizer component in the process being debugged. Additional Information: Stack Trace Then I discover a second folder that contains your visualizer from 30-12-2019: xx:\Users\xx\Documents\Visual Studio 2019\Visualizers\ I delete the visualizer from that folder and its three subfolders (4 files in total). After running the project again, breaking into it and putting 'lambda' in the watch window, the options shown do not include ExpressionTreeVisualizer anymore. I again copy the files from the zip-file mentioned above to the first folder mentioned above. After running the project again, breaking into it and putting 'lambda' in the watch window, I can choose from three visualizers again, including ExpressionTreeVisualizer. Selecting it shows a dialog with the following error information: An unhandled exception of type 'System.Runtime.Serialization.SerializationException' was thrown by the custom visualizer component in the process being debugged. Additional Information: Stack Trace I copy the files from the zip-file mentioned above to the second folder mentioned above. After running the project again, breaking into it and putting 'lambda' in the watch window, I can, as before, choose from three visualizers, including ExpressionTreeVisualizer. Selecting it shows a dialog with the following error information: An unhandled exception of type 'System.Runtime.Serialization.SerializationException' was thrown by the custom visualizer component in the process being debugged. Additional Information: Stack Trace After all that I opened a different project. There the visualizer worked perfectly. @zspitz As for your request to create a minimal package. It seems a lot of work. But I might try in the future. |
Let me sum up my understanding of the current situation: In a project targeting .NET Framework 4.7.2, you're getting the same SerializationException message, whether you install the visualizer in the Visualizers subfolder under Documents, or the Visualizer subfolder in the VS install path. I don't understand what is going on. There was a brief period of time when ValueTuple wasn't marked as serializable (I think it was after .NET Framework 4.7); but that was fixed since 4.7.2. As long as you have 4.7.2 installed on your machine, it should work, even for projects targeting 4.7.1 and earlier. @bartjekwartje Could I trouble you again to clear out both Visualizer subfolders, and re-download and try the latest release? Warning: Don't delete all the files in the Visualizer subfolder, only those that start with (NB I am unaffiliated with the ReadableExpressions visualizer; you might want to post an issue about the duplicate menu entries there.) |
@bartjekwartje What is the current status? Does the visualizer work for you? I may add a reference to the NuGet ValueTuple package, which uses the value tuple provided by the target framework if available, but will provide it's own implementation if needed. |
I believe the cause lies in inclusion of entity framework in a project.
…On Friday, November 6, 2020, Zev Spitz ***@***.***> wrote:
@bartjekwartje <https://github.com/bartjekwartje> What is the current
status? Does the visualizer work for you? I may add a reference to the
NuGet ValueTuple package, which uses the value tuple provided by the target
framework if available, but will provide it's own implementation if needed.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#107 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2CUSG5W3PZUS37RIYTFRTSOOXCBANCNFSM4LD5H7VA>
.
|
Could you prepare a sample project, reproducing the issue? If not, I'll have to close this issue. |
If your App Config file contains the following configuration under assemblyBinding, then remove it:
I've encountered the same issue with a code that worked for 10 years and then stopped working after the configuration above was added (probably automatically by visual studio) to the app config. This was as well an issue with Binary Formatter |
The visualizer used to work, but after not using it for a few weeks, it stopped working.
I'm using Visual Studio 2019.
The error (see below) happens in at least two projects (haven't tested any others.)
The error happens with 'Target framework' set to:
(haven't tested any other frameworks.)
The following error occurs after selecting the visualizer from the list that appears after clicking the magnifying glass from the watch window:
Error:
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' was thrown by the custom visualizer component in the process being debugged.
Additional Information:
Type 'System.ValueTuple`2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' in Assembly 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' is not marked as serializable.
Stack Trace:
at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
at System.Runtime.Serialization.FormatterServices.<>c__DisplayClass9_0.b__0(MemberHolder _)
at System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey key, Func
2 valueFactory)at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at Microsoft.VisualStudio.DebuggerVisualizers.VisualizerObjectSource.Serialize(Stream serializationStream, Object target)
at ExpressionTreeVisualizer.VisualizerDataObjectSource.TransferData(Object target, Stream incomingData, Stream outgoingData)
at Microsoft.VisualStudio.DebuggerVisualizers.DebuggeeSide.Impl.ClrCustomVisualizerDebuggeeHost.TransferData(Object visualizedObject, Byte[] uiSideData)
The text was updated successfully, but these errors were encountered: