Hi,
We just moved from VS2003 and VS2005. Our software goes well except the following exception:
Unable to cast object of type 'ProjectConfiguratiion' to type 'ProjectConfiguration'.
It is the pure C# code, not ASP page.
I have read an email thread related to this topic started Dec.13, 2005 in msdn forum. But it seemed to me that no final solution was reached.
Through the debugger, I knew there is only DLL running in the memory.
Is this a bug of MS VS2005, anybody has a clue
Thanks in advance.
Dan

"Uable to cast object type" exception in VS2005
eyeseesharp
It is more likely that you have a compiled version of the ProjectConfiguration being referenced by a project in your solution as opposed to the project version of ProjectConfiguration. In other words, it is referencing an older version of the same class. Make sure the project you are compiling that contains the above code is referencing the same version of the Project Configuration class (usually by using a Project reference as opposed to a compiled reference).
ColouredFunk
It really looks like you have two types with the name "ProjectConfiguration", one that the code you posted above references, and another being returned by Broker.Instance.GetInstance().
Some things to check:
Did everything get recompiled, or could some things have been compiled with different versions
If you're strong-naming the assemblies, make sure that the ones refrenced by Broker and that code have the same full strong name.
Try comparing the types in your else clause there by outputting the fullname, and see if there's any difference.
Marcus Garcia MVP
Sorry, it is typo. The code passed compiling.
The following is the code, I took out my company name from the class name.
object pc = Broker.Instance.GetInstance(typeof(ProjectConfiguration)); //Broker is a class developed in my company ProjectConfiguration pcx = null; if (pc is ProjectConfiguration){pcx = (
ProjectConfiguration)pc;} else{
string x = pc.GetType().ToString();System.Windows.Forms.
MessageBox.Show(x); // the code actually goes here, and shows "ProjectConfiguration"}
Gaurav_tech
Is there any chance that this is a typo The first type you mention seems to have an extra 'i' in the name.
If that is not the case, could you paste some code of exactly where this is happening