Internal Compiler Error while deriving C# class from a MC++ class implementing a C# interface 
Author Message
 Internal Compiler Error while deriving C# class from a MC++ class implementing a C# interface

I consistently get an Internal Compiler Error in the following situation.

1. I have a C# class library which defines an interface (IMediaControl)
2. Then I use a MC++ class library in which I implement a class that
implements this interface (CMediaControl)
3. And finally I try to derive from CMediaControl in another assembly (C#)

The error is:
Internal Compiler Error: stage 'BIND' symbol 'Derived.CMediaControl.Value'
...
Internal Compiler Error (0xc0000005 at address 5315F6EE): likely culprit is
'BIND'.

An internal error has occurred in the compiler. To work around this problem,
try simplifying or changing the program near the locations listed below.
Locations at the top of the list are closer to the point at which the
internal error occurred.

I have no clue what might be causing this problem.  I tried to search the
web but haven't found much.  Attached are the three offending files.  I also
pasted the source below to make sure it's available.

Any help would be greatly appreciated.

Thanks, Andy.

-------------------------------------------------
using System;

namespace Core {

  public interface IMediaControl {

    int Value { get; set; }

  }

Quote:
}

---------------------------------------------------
#pragma once

using namespace System;

namespace Derived {

  public __gc class CMediaControl
    : public Core::IMediaControl
  {

  public:

    __property int IMediaControl::get_Value() {
      return 0;
    }

    __property void IMediaControl::set_Value(int value) {
    }

  };

Quote:
}

--------------------------------------------------------------------------
using System;

namespace MoreDerived {
 /// <summary>
 /// Summary description for Class1.
 /// </summary>
 public class SuperMediaControl : Derived.CMediaControl {

    public SuperMediaControl() {
  }

    public int ObtainValue() {
      return this.Value;
    }

  }

Quote:
}

begin 666 Interfaces.cs



`
end

begin 666 Derived.h








`
end

begin 666 SuperMediaControl.cs







`
end



Sat, 22 Oct 2005 06:49:54 GMT  
 Internal Compiler Error while deriving C# class from a MC++ class implementing a C# interface
Andrew,

I wasn't able to reproduce this with the VS.NET 2003 compilers. The C#
compiler correctly generates the error

error CS0122: 'Derived.CMediaControl.Value' is inaccessible due to its
protection level

The solution is either to change

return this.Value;

to

return ((Core.IMediaControl)this).Value;

or don't implement the Value methods explicitly in the C++ code

__property int get_Value() {
  return 0;

Quote:
}

__property void set_Value(int value) {

Quote:
}

Mattias

===

http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.



Sat, 22 Oct 2005 07:31:14 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Derived Interface implemented in derived class not found

2. Internal compiler error when class has too many __event members

3. C1001 INTERNAL COMPILER ERROR VC6 friend class namespace

4. internal compiler error with embeded classes

5. Class in class OR class derived from class?

6. New Class derived from Class which derived from CWindowImpl

7. Activating the class wizard on a derived-derived Cwnd class

8. How to Create CCtrlView derived class based on CTreeCtrl derived class

9. How to Create CCtrlView derived class based on CTreeCtrl derived class

10. Class Wizard won't let me derive a class from my class

11. Calling explicitly implemented interface method from derived class

12. Can't implement virtual function in derived class :-(

 

 
Powered by phpBB® Forum Software