0

I have created a debugger visualizer for a custom class which resides in a c# .net4.5 assembly. When calling GetObject on the IVisualizerObjectProvider, unable to find assembly exception is thrown from the System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly() function.

All my classes that are being referenced by CustomClass and the parent class has the [Serializable] attribute. The assembly along with the MoreLinq dependency is placed right alongside the Debugger Visualizer assembly in MyDocuments\Visual Studios 2013\Visualizers folder.

Can anyone give me any pointers?

Thanks,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.VisualStudio.DebuggerVisualizers;


[assembly: System.Diagnostics.DebuggerVisualizer(
typeof(CustomClassVisualiser), typeof(VisualizerObjectSource),
Target = typeof(AnotherAssemblyNamespace.CustomClass), Description = "Custom    class Visualiser")]
namespace Test
{
    using System.Windows;

    using Microsoft.VisualStudio.DebuggerVisualizers;

public class CustomClassVisualiser : DialogDebuggerVisualizer
{
    protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
    {
        MessageBox.Show("In");

        var objectToVisualise = objectProvider.GetObject();// Failing here!! Unable to find assembly System.Runtime.Serialization.SerializationException

        var type = objectToVisualise.GetType(); 

            MessageBox.Show(type.FullName);

            MessageBox.Show("");

            //window.ShowDialog();
        }
    }
}
user2822838
  • 337
  • 1
  • 3
  • 13

1 Answers1

0

Reading your question it looks like you are serializing from an application and deserializing from another. Aren't you? If this is the case, this is the cause of your problem: serialization puts an exe dependent signature in the binary file and deserialization checks for this signature. You can overcome the problem in two ways:

  1. Having the serialize/deserialize code in a DLL called by the two applications
  2. Using XML serialization instead of binary serialization (this is not always possible, it depends on the data you want to serialize)

You can find more details about this situation in this article.