1
Vote

InvalidCastException

description

Hello,

I've installed the 4.5.20 version and when using a basic test application I found the following exception:

************** Exception Text **************
Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.RemoteObjectSourceException: Unable to cast object of type 'System.Threading.Tasks.Dataflow.ActionBlock1[System.Int32]' to type 'System.Threading.Tasks.Dataflow.IDataflowBlock'. ---> System.InvalidCastException: Unable to cast object of type 'System.Threading.Tasks.Dataflow.ActionBlock1[System.Int32]' to type 'System.Threading.Tasks.Dataflow.IDataflowBlock'.
at TPLDataFlowDebuggerVisualizer.DataFlowVisualizerObjectSource.GetData(Object target, Stream outgoingData)
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.VisualizerObjectSourceHolder.GetData(Object target, Stream s)
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.DebugeeHost.GetInitialData(VisualizerObjectSourceHolder sourceHolder, Object input)
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.PrivateCallback.MaybeDeserializeAndThrowException(Byte[] data)
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.PrivateCallback.WriteDataToStreamAndThrowOnException(Byte[] data, Stream dataStream)
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.PrivateCallback.WriteDataToStreamAndThrowOnException(Byte[] data)
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.PrivateCallback.Microsoft.VisualStudio.DebuggerVisualizers.IVisualizerObjectProvider.GetData()
at TPLDataFlowDebuggerVisualizer.DataFlowDebuggerSide.Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ManagedShim.DelegatedHost.CreateViewer(IntPtr hwnd, HostServicesHelper hsh, SafeProxyWrapper proxy)

The application used is the following and I got the exception trying to visualize the actionBlock object through the "TPL Dataflow Debugger Visualizer".
static void Main(string[] args)
    {

        ActionBlock<int> actionBlock = new ActionBlock<int>((i) => Console.WriteLine(i));

        for (int i = 0; i < 10; i++)
        {
            actionBlock.SendAsync(i);
        }

        actionBlock.Complete();
        actionBlock.Completion.Wait();

        Console.WriteLine("Press ENTER to exit");
        Console.ReadLine();
    }
I'm using VS2013 on Windows 7 64 bit.

comments

pauldambra wrote Feb 3, 2015 at 7:49 AM

I'm having this exact issue.

Using Visual Studio Pro 2013 (12.0.31101.00 Update 4) with R#9.

And TPL Dataflow from Nuget version="4.5.24". Application targets .Net 4.5