|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Debugging UserControlHello,
A UserControl that I'm developing is causing an InvalidCastException to be thrown when the form, with the userControl on it, is shown. The trouble is that I don't seem to be able to debug the exception. A dialogbox is shown with the following information when I open the form in design mode: The following exception occured: InvalidCastException: Specified cast not valid. I've put a breakpoint in the UserControl_Load event and it never hits the breakpoint when I open the form. Can someone help me in finding out how to track this problem down? Thanks in advance Steve Okay, I've figured out that I can start a second instance of VS 2003 and
attach to the process of the first devenv.exe and tell the second one to break on the type of exception that I'm getting. So, it appears that when I try to deserialize the PropertyBag (a class that I created to serialize the properties of the user control) that it throws the specified cast not valid exception. Now, if I serialized with that same class (a PropertyBag object), why wouldn't I be able to deserialize that same file into an object of that type? Any help out there??? Steve Show quoteHide quote "Steve Long" <Steve_Noneya@NoSpam.com> wrote in message news:%23QA5qM3AHHA.3540@TK2MSFTNGP03.phx.gbl... > Hello, > A UserControl that I'm developing is causing an InvalidCastException to be > thrown when the form, with the userControl on it, is shown. The trouble is > that I don't seem to be able to debug the exception. A dialogbox is shown > with the following information when I open the form in design mode: > The following exception occured: > InvalidCastException: Specified cast not valid. > > I've put a breakpoint in the UserControl_Load event and it never hits the > breakpoint when I open the form. Can someone help me in finding out how to > track this problem down? > > Thanks in advance > Steve > Steve,
You should be able to set a breakpoint, even if it was in the initialize or the loadevent from the control Are you sure your IDE is not set to release mode? Cor Show quoteHide quote "Steve Long" <Steve_Noneya@NoSpam.com> schreef in bericht news:%23QA5qM3AHHA.3540@TK2MSFTNGP03.phx.gbl... > Hello, > A UserControl that I'm developing is causing an InvalidCastException to be > thrown when the form, with the userControl on it, is shown. The trouble is > that I don't seem to be able to debug the exception. A dialogbox is shown > with the following information when I open the form in design mode: > The following exception occured: > InvalidCastException: Specified cast not valid. > > I've put a breakpoint in the UserControl_Load event and it never hits the > breakpoint when I open the form. Can someone help me in finding out how to > track this problem down? > > Thanks in advance > Steve > Hi Cor.
I am able to set a break point in the other instance of VS. However, when I try to deserialize the same object that I serialized, I get the Invalid Cast Exception. It doesn't make any sense. I'm doing this same type of serializing/deserializing in other apps and it works fine. Steve Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%23NMYIt7AHHA.5060@TK2MSFTNGP02.phx.gbl... > Steve, > > You should be able to set a breakpoint, even if it was in the initialize > or the loadevent from the control > > Are you sure your IDE is not set to release mode? > > Cor > > "Steve Long" <Steve_Noneya@NoSpam.com> schreef in bericht > news:%23QA5qM3AHHA.3540@TK2MSFTNGP03.phx.gbl... >> Hello, >> A UserControl that I'm developing is causing an InvalidCastException to >> be thrown when the form, with the userControl on it, is shown. The >> trouble is that I don't seem to be able to debug the exception. A >> dialogbox is shown with the following information when I open the form in >> design mode: >> The following exception occured: >> InvalidCastException: Specified cast not valid. >> >> I've put a breakpoint in the UserControl_Load event and it never hits the >> breakpoint when I open the form. Can someone help me in finding out how >> to track this problem down? >> >> Thanks in advance >> Steve >> > >
Learning OOP conceptual question
What do you call nested If...Then search loops? SortedList - bug or undocumented behavior ? Idle time File Aging Program Iterating through a Hastable of objects Problem Adding and Using Resource Files convert idl to c# or tlb code collapsing in vb.net 2005 Find a control on a form of a specific name |
|||||||||||||||||||||||