Coder Social home page Coder Social logo

Comments (10)

zspitz avatar zspitz commented on June 2, 2024

@bartjekwartje

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 .vs folder in the project.

Perhaps also try deleting and re-downloading the visualizer.

I would greatly appreciate it if you could keep me informed of further developments, thanks.

from expressiontreevisualizer.

bartjekwartje avatar bartjekwartje commented on June 2, 2024

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
Version 16.4.2
VisualStudio.16.Release/16.4.2+29613.14
Microsoft .NET Framework
Version 4.8.03761

Installed Version: Community

Azure App Service Tools v3.0.0 16.4.457.38025
Azure App Service Tools v3.0.0

C# Tools 3.4.1-beta4-19610-02+c4e5d138903b899477649a17f197abd2bcb22f9e
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

NpgsqlVSPackage Extension 1.0
NpgsqlVSPackage Visual Studio Extension Detailed Info

NuGet Package Manager 5.4.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools 16.0.61912.09160
Microsoft SQL Server Data Tools

Visual Basic Tools 3.4.1-beta4-19610-02+c4e5d138903b899477649a17f197abd2bcb22f9e
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.4 for F# 4.6 16.4.0-beta.19556.5+e7597deb7042710a7142bdccabd6f92b0840d354
Microsoft Visual F# Tools 10.4 for F# 4.6

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

VsVim 2.8.0.0
VsVim is a Vim emulator for Visual Studio

from expressiontreevisualizer.

zspitz avatar zspitz commented on June 2, 2024

@bartjekwartje Thanks for your patience. Do you think you could upload here up a minimal project that reproduces the problem?

from expressiontreevisualizer.

zspitz avatar zspitz commented on June 2, 2024

@bartjekwartje Could you download the visualizer once more and try again?

from expressiontreevisualizer.

bartjekwartje avatar bartjekwartje commented on June 2, 2024

@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:

https://github.com/zspitz/ExpressionTreeVisualizer/releases/download/1.7.91/ExpressionTreeVisualizer.2019.zip

Quit visual studio

Then copied the zip's tree/contents to:
xx:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Packages\Debugger\Visualizers

Restarted Visual studio

Ran my code and set a breakpoint on a line with the following code:
lambda = Expression.Lambda<Func<payments, bool>>(methodExp, param);

Added 'lambda' to the watch window.

Clicked on the Expression Tree Visualizer Magnifying Glass, which then presented me three visualizers to pick from:
Readable Expressions Visualizer
Expression Tree Visualizer
Readable Expressions Visualizer

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:
c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Packages\Debugger\Visualizers

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:
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.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 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)

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:
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.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 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)

I copy the files from the zip-file mentioned above to the second folder mentioned above.
(xx:\Users\xx\Documents\Visual Studio 2019\Visualizers)

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:
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.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 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)

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.

from expressiontreevisualizer.

zspitz avatar zspitz commented on June 2, 2024

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 ExpressionTreeToString. There may be other visualizers in that subfolder, such as the built-in WPF tree visualizer and the DataSet visualizer.

(NB I am unaffiliated with the ReadableExpressions visualizer; you might want to post an issue about the duplicate menu entries there.)

from expressiontreevisualizer.

zspitz avatar zspitz commented on June 2, 2024

@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.

from expressiontreevisualizer.

bartjekwartje avatar bartjekwartje commented on June 2, 2024

from expressiontreevisualizer.

zspitz avatar zspitz commented on June 2, 2024

Could you prepare a sample project, reproducing the issue? If not, I'll have to close this issue.

from expressiontreevisualizer.

Saragani avatar Saragani commented on June 2, 2024

If your App Config file contains the following configuration under assemblyBinding, then remove it:

  <dependentAssembly>
    <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
  </dependentAssembly>

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

from expressiontreevisualizer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.