Domanda

I am getting the error below when I run an ASP.NET app. X is a typedDataTableRow defined in reference.cs (proxy for a web service in another project which is not part of the solution). There's only a single Y.dll file in the ASPTemp folder. I restarted Visual studio, cleaned the solution, deleted the ASPTemp folder, deleted all the compiled dll's under the solution, restarted IIS. In the debugger there's a single Y.dll instance in the modules window. I can't determine why I am getting this exception. The two path's in the exception are exactly the same! Somehow the runtime thinks there are two instances of Y.dll. (Y is the name of my project/assembly). I am trying to use Fuslogvw.exe but it's not showing minimal info and nothing useful. Will post another question about it. I am using Visual Studio 2010 in Windows 7 64bit.

One note I am mentioning is that I have two very similar typed datasets. One was created from the other plus new datatables. I use the Merge method to copy the data from one to the other. I did a global rename of the dataset class name in the second ..designer.cs file and I am sure the two datasets are unique. first's class name doesn't exist int the second. I mention this in case the two datasets might be the cause of this but I don't see how.

Any ideas how to troubleshoot this?

Exception Type: System.InvalidCastException
Message: [A]X cannot be cast to [B]X. Type A originates from 'Y, Version=123.10.0.32434,
 Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 
'c:\temp\ASPTemp\xx\bf09df88\62e1519a\assembly\dl3\bdf55bf9\f02959af_c88cce01\Y.dll'. 
Type B originates from 'Y,  Version=123.10.0.32434, Culture=neutral, PublicKeyToken=null' 
in the context 'Default' at location 'c:\temp\ASPTemp\xx\bf09df88\62e1519a\assembly\dl3\bdf55bf9\f02959af_c88cce01\Y.dll'
È stato utile?

Soluzione

I deleted the second dataset and all code that references it as a test and the problem went away. I still do not have an explanation for this behavior when the two datasets are contained in two different classes and there are no compile errors.

Altri suggerimenti

This is really too vague to solve with the information given. It sounds like you copy/pasted something and didn't manage to properly rename everything.

You have to be very careful when modifying generated code. When changes are made in the UI or designer they often update more than just the designer.cs file. Further, there could also be config files that need to be updated to reflect the changes.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top