accord-net / framework

Machine learning, computer vision, statistics and general scientific computing for .NET
http://accord-framework.net
GNU Lesser General Public License v2.1
4.49k stars 1.99k forks source link

Debug Visualizer #1043

Open fdncred opened 6 years ago

fdncred commented 6 years ago

What would you like to submit? (put an 'x' inside the bracket that applies)

Issue description @cesarsouza, I'm not sure exactly what this is - bug, question, feature. Every time you release a new version of Accord, the DebugVisualizer stops working because the assemblys are different. This is what the error looks like.

An unhandled exception of type 'System.InvalidCastException' was thrown by the custom visualizer component in the process being debugged.

Additional information:
[A]Accord.Imaging.UnmanagedImage cannot be cast to [B]Accord.Imaging.UnmanagedImage. Type A originates from 'Accord.Imaging, Version=3.8.0.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7' in the context 'Default' at location 'C:\Users\user\Documents\Visual Studio 2017\Projects\blah\blah\bin\Debug\Accord.Imaging.dll'. Type B originates from 'Accord.Imaging, Version=3.6.4.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7' in the context 'LoadFrom' at location 'C:\Users\user\Documents\Visual Studio 2017\Visualizers\Accord.Imaging.dll'.

Stack Trace:
 at Accord.DebuggerVisualizers.UnmanagedImageObjectSource.GetData(Object target, Stream outgoingData)
   at Microsoft.VisualStudio.DebuggerVisualizers.ClrCustomVisualizers.ClrCustomVisualizerDebuggeeHost.GetData(Object visualizedObject)

This error is driving me crazy. Is there any way to solve this problem so we don't have to recompile the visualizer with every release?

Thanks, Darren

cesarsouza commented 6 years ago

Wow, sorry about that @fdncred. I had no idea the debugger was breaking on every release.

How do you typically install the framework? Or are you always compiling it from source?

Wouldn't the problem be that, when you install a new version through NuGet, the previous version of the debugger that is currently in My Documents\ VisualStudioVersion \Visualizers doesn't get updated, and therefore expects to see types from the previous version instead of the new you have just installed?

Regards, Cesar

fdncred commented 6 years ago

@cesarsouza, Thanks for responding. I typically install the framework via NuGet but sometimes I compile as well, like when I'm making a PR or need to change your code for some other reason.

The problem is exactly as you explain it. I'm using a different version in my Visual Studio project than is in the Visualizers folder. So in order to get everything to work, I have to stop what I'm doing, locate the assemblies needed and put them in the Visualizers folder.

It's just a pain - you know - the little things drive you crazy. ;)

Maybe if there was a NuGet packing for the visualizer that puts it in the right folder. Perhaps there already is, I never looked!

On the other hand, I'm not sure why the Visualizer has to be replaced at all. It's not like anything changed in the imaging components that the debug visualizer needs. Just the version number.

Darren