all groups > dotnet windows forms designtime > august 2004 >
You're in the

dotnet windows forms designtime

group:

error when trying to add inherited form


error when trying to add inherited form chris yoker via .NET 247
8/6/2004 1:45:22 AM
dotnet windows forms designtime: Hiya,

I get an error when I try to add a particular type of "inherited form" to my app.
I try to add it thru the following steps:

1) right click the selected project
2) >Add
3) >inherited form

<error>
An exception System.ExecutionEngineException has occurred in the
default domain
<\error>

The debugger chokes in the following lines of a Utility.vb class:

<code>
For Each attr As System.Attribute In type.GetCustomAttributes(True)

If attr.GetType.FullName = attributeName Then
Return attr
End If
Next
<\code>

Even when I commment this code out, it still throws an error at this line.

I can confirm that:

1) the inherited form that is ALREADY in the solution works
without hassle.
2) there are .resx files involved, (if this is relevant)
3) I have of course been playing around with the code :-)

Does windows initialise some code in an inherited form, even though I am only adding it to a solution in "design time" mode, ie I'm not actually RUNNING the app?

All pointers appreciated, I can clarify any ambiguity in my post :-)

yogi
--------------------------------
From: chris yoker

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

Re: error when trying to add inherited form Andy Becker
8/6/2004 9:53:08 AM
[quoted text, click to view]
only adding it to a solution in "design time" mode, ie I'm not actually
RUNNING the app?
[quoted text, click to view]

Yes... In fact, the form's Load event gets fired, among other things -
ParentChanged, etc. I would venture a guess that the code from Utility.vb
does not need to be called for design-time.

You can check the DesignMode property to determine whether to run stuff or
not. Note that it will not work from a constructor (it is always false). I
guess it's not known until after the object is created and sited to a
designer from that this can be known.

Best Regards,

Andy

AddThis Social Bookmark Button