Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / November 2004

Tip: Looking for answers? Try searching our database.

PEVerify Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AndrewP - 12 Nov 2004 17:00 GMT
I use PEVerify on the assemblies I'm developing. One particular assembly
fails with the following error:

[MD]: Error: Class implements interface but not method (class:0x02000032;
interface:0x02000031; method:0x060001b2).0x09000013]

Here's the situation boiled down to the essentials:

public interface IMyInterface
{
  System.Drawing.Color BackColor {get;set;}
  .
  .
  .
}

public class MyControl : System.Windows.Forms.UserControl, IMyInterface
{
  .
  .
  .
}

It turns out that although MyControl does not implement the interface
methods (get_BackColor, set_BackColor), an ancestor class does (Control). I
don't understand why PEVerify reports this as an error.

The CLR loads and executes the assembly fine so it seems to be passing
runtime verification.
yuri - 19 Nov 2004 05:05 GMT
Hi Andrew,

There is neither compilation nor runtime error because a class in the chain
of base classes of MyControl, namely System.Windows.Forms.Control, has
exactly the same BackColor property as IMyInterface has.  The interface
mapping process locates this property and assumes that it is the
implementation of IMyInterface.BackColor.  This link to C# specification
gives more information on interface mapping:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/vcl
rfcsharpspec_13_4_2.asp


PEVerify simply says that
   MyControl wants to implement IMyInterface (because it is in the list of
its interfaces)
   MyControl does not implement IMyInterface (probably by mistake)
   One of the base classes of MyControl already implements all
properties/methods of IMyInterface

You can get rid of the error by making MyControl an abstract class.  This
will tell PEVerify that MyControl does not implement IMyInterface
intentionally.

Thanks,
Yuri

>I use PEVerify on the assemblies I'm developing. One particular assembly
> fails with the following error:
[quoted text clipped - 26 lines]
> The CLR loads and executes the assembly fine so it seems to be passing
> runtime verification.
AndrewP - 19 Nov 2004 15:19 GMT
Thanks yuri.

However, it still seems a little odd to me that peverify considers this an
"error" and not something less severe, like a "warning". After all, the
interface mapping of the 'IMyInterface.BackColor' member to the base Control
class doesn't violate type safety, does it? If it doesn't (and I don't
believe it does), then peverify should be passing the assembly, not failing
it -- At least according to the stated purpose of the peverify tool.

> Hi Andrew,
>
[quoted text clipped - 51 lines]
> > The CLR loads and executes the assembly fine so it seems to be passing
> > runtime verification.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.