Re: Compiler bug with __event and derivation

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Edward Diener wrote:
I have a __gc class, let's call it ClassB, derived from ClassA, which has an __event, and eventually derived from System::ComponentModel::Component. This ClassB has no __event. I derived another class from ClassB, let's call it ClassC, which has an __event. When I try to compile ClassC's source I get:

somepath\ClassC.h(119) : error C3701: 'somePath\ClassB.h': event source has no events

Line 119 in somepath\ClassC.h is the closing brace of the ClassC definition. I am specifying no [ event_source(...) ] in any file so I assume this is being generated internally by the compiler when I specify __event.

Is this a known bug and, if it is, what is the workaround to this bug ?

The bug manifesats itself as soon as I add a single:

[System::ComponentModel::DescriptionAttribute("Some message")]

to a __property of ClassB.

Without a description attribute for any property of ClassB, the compile works without error. Not using any attribute for a __property of ClassB is not an acceptable workaround.
.




Relevant Pages

  • Re: Copying a derived type to another type that inherits from derived type
    ... I can implicitly convert to ClassA from ClassB and ClassC. ... So, just as you can't cast a ClassC to a ClassB when the variable is typed as ClassC, you also can't cast a ClassC to a ClassB just because the variable is typed as a ClassA. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Lazy proxy problem
    ... Yes, left ClassC on server. ... if ClassC is inherited from MarshalByRefObject you can pass reference to him as ClassB field or create bridge class and delegate all IList calls to ClassC implementation ... class ListBridge: MarshalByRefObject, IList ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Copying a derived type to another type that inherits from derived type
    ... I can implicitly convert to ClassA from ClassB and ClassC. ... And you should keep in mind that when you cast from ClassC to ClassA (for ...
    (microsoft.public.dotnet.languages.csharp)
  • Copying a derived type to another type that inherits from derived type
    ... ClassB which derives from ClassA ... I can implicitly convert to ClassA from ClassB and ClassC. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: C# inheritance
    ... ClassC classC = new ClassC; ... public class ClassA ... public class ClassB: ClassA ... public override string Text ...
    (microsoft.public.dotnet.languages.csharp)