[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Hans Dingemans

11/8/2002 8:02:00 PM

Hello,

Got Visual Studio installed on two machines.
I wanna run the .NET Framework WinForms samples ButtonCtl. Tried on both a
Windows XP Home and Windows 2000 Server system and they crash with output as
below

An unhandled exception of type 'System.TypeLoadException' occurred in
Unknown Module.

Additional information: Declaration referenced in a method implementation
can not be a final method. Type: ButtonCtl. Assembly: Dispose.

When commenting out the code below the program runs fine. Any comments?

'Form overrides dispose to clean up the component list.
Public Overloads Overrides Sub Dispose()
MyBase.Dispose()
components.Dispose()
End Sub



Thanx,

Hans



2 Answers

Hans Dingemans

11/9/2002 10:15:00 AM

0

The sample runs fine when I modify the declaration into:

Public Shadows Sub Dispose()

But a breakpoint set on the first statement and run the sample shows it
never gets called, so anyone an idea what the code intents to achieve?

Thanx,
Hans



"Hans Dingemans" <Hans.Dingemans@globalknowledge.net> schreef in bericht
news:OAu9fk1hCHA.1688@tkmsftngp08...

> Hello,
>
> Got Visual Studio installed on two machines.
> I wanna run the .NET Framework WinForms samples ButtonCtl. Tried on both a
> Windows XP Home and Windows 2000 Server system and they crash with output
as
> below
>
> An unhandled exception of type 'System.TypeLoadException' occurred in
> Unknown Module.
>
> Additional information: Declaration referenced in a method implementation
> can not be a final method. Type: ButtonCtl. Assembly: Dispose.
>
> When commenting out the code below the program runs fine. Any comments?
>
> 'Form overrides dispose to clean up the component list.
> Public Overloads Overrides Sub Dispose()
> MyBase.Dispose()
> components.Dispose()
> End Sub
>
>
>
> Thanx,
>
> Hans
>
>
>


(Felix Wu [MS])

11/13/2002 11:07:00 AM

0

Hi Hans,

This is because that the improperly overridden Dispose() method was used.
Override the Dispose(Boolean) method instead of Dispose():

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

For more information, please check this:

315528.KB.EN-US INFO: Implementing Dispose Method in a Derived Class
http://support.microsoft.com/default.aspx?scid=KB;EN...

Hope this helps.

Regards,

Felix Wu
=============
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
>From: "Hans Dingemans" <Hans.Dingemans@globalknowledge.net>
>Subject: SDK Sample(s) crash
>Date: Fri, 8 Nov 2002 20:02:02 +0100
>Lines: 29
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
>Message-ID: <OAu9fk1hCHA.1688@tkmsftngp08>
>Newsgroups: microsoft.public.dotnet.framework.sdk
>NNTP-Posting-Host: 217.120.117.20
>Path: cpmsftngxa08!cpmsftngxa06!tkmsftngp01!tkmsftngp08
>Xref: cpmsftngxa08 microsoft.public.dotnet.framework.sdk:4798
>X-Tomcat-NG: microsoft.public.dotnet.framework.sdk
>
>Hello,
>
>Got Visual Studio installed on two machines.
>I wanna run the .NET Framework WinForms samples ButtonCtl. Tried on both a
>Windows XP Home and Windows 2000 Server system and they crash with output
as
>below
>
>An unhandled exception of type 'System.TypeLoadException' occurred in
>Unknown Module.
>
>Additional information: Declaration referenced in a method implementation
>can not be a final method. Type: ButtonCtl. Assembly: Dispose.
>
>When commenting out the code below the program runs fine. Any comments?
>
>'Form overrides dispose to clean up the component list.
>Public Overloads Overrides Sub Dispose()
>MyBase.Dispose()
>components.Dispose()
>End Sub
>
>
>
>Thanx,
>
>Hans
>
>
>
>