Article ID: 811599 - Last Review: January 18, 2006 - Revision: 1.1 BUG: You may receive a "CS0500" compilation error when you compile code that is generated in the Method Wizard in Visual C# .NETOn This PageSYMPTOMSWhen you use the Visual C# .NET Method Wizard to add an abstract method that returns a value, you may receive the following
compilation error: error CS0500: '<your fully
qualified method name>' cannot declare a body because it is marked
abstract CAUSEThe Visual C# .NET Method Wizard generates code for the
method body for abstract methods that return a value. If a method is marked as abstract, the Visual C# .NET Method Wizard sets the MustImplement property to true. Therefore, when the wizard generates code, if the abstract method returns a value, the wizard generates a method body. If
the abstract method has a void return type, the wizard does not generate a
method body. RESOLUTIONTo resolve this problem, delete the generated method body
code from the abstract method. For example, if you use the Visual C# .NET Method Wizard
to generate an abstract method that returns an "int", the wizard generates the following:
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed at the beginning of this article.
MORE INFORMATIONSteps to Reproduce the Behavior
| Article Translations
|
Back to the top
