D
DrZogg
It can't be... say it isn't so...
Yes.. there is a fly in the ointment
This bug requires 3 projects... yes this is a real world production
issue not some tinker toy thing.
Start with a C# interface assembly we will call Interfaces
namespace Interfaces
{
public interface ICqBase
{
void baseIt(); // does something
};
public interface ICqPolygonObject : ICqBase
{
void polygonObject(); // does something to polygons
};
public interface ICqStairObject : ICqPolygonObject
{
void stairObject(); // does something to stairs
};
}
Then assume you have a managed C++ assembly we will call TestLibrary
the oldClrSyntax switch is being used
its namespace looks as follows:
namespace TestLibrary
{
//
// This class is needed to reproduce the error.. I dont know why
//
public __gc class CqBase : public ICqBase
{
public: virtual void baseIt(void) { return; }
};
public __gc class CqPolygonObject : public CqBase, public
ICqPolygonObject
{
public: virtual void polygonObject() { return; }
};
}
So far this is very real world.. and everything works just fine.
Now lets assume we have another manged C++ assembly we will call
DerivedLibaray
the oldClrSyntax switch is being used also.
namespace DerivedLibaray
{
//
// All the problems are here with calling baseIt
//
public __gc class CqStairObject : public CqPolygonObject , public
ICqStairObject
{
public: virtual void stairObject() { this->baseIt(); return;
}
};
}
Notice we inherit from bother an inherited interface and a class with
inherited interfaces as well.
This shouldn't be a problem because Managed C++ inherits interfaces
virtually.
However the VS2005 compiler generates the folowing error
3>h:\data\code\testlibrary\derivedlibrary\DerivedLibrary.h(43) : error
C2385: ambiguous access of 'baseIt'
3> could be the 'baseIt' in base 'TestLibrary::CqPolygonObject'
3> or could be the 'baseIt' in base 'Interfaces::ICqStairObject'
Hmm thats odd... how is this ambigous.. you can't call baseIt in
ICqStairObject it's an interface?
Many change seem to make the problem go away.
Changing the interfaces to C++ fixes the issue.. except my interfaces
project has as over 200 interfaces.
removing the CqBase class fixes the issue but I really need this class
in my code because it has more than the baseIt method.
Moving the CqStair class to the TestLibrary from DerivedLibrary also
fixes things.
However, I have 76 projects for a reason. There are multiple products
and product version generated from the code and its just not feasible
to consolidate. Trust me on this one.
Converting the code to C++/CLI fixes the problem. I would use this
technique, if I didn't have 50 C++ projects with over 500,000 lines of
managed code using clrOldSyntax.
Anyone have any ideas for some other workaround.
This has been submitted to the VC team as a bug.
Thanks for the help
Christopher
Yes.. there is a fly in the ointment
This bug requires 3 projects... yes this is a real world production
issue not some tinker toy thing.
Start with a C# interface assembly we will call Interfaces
namespace Interfaces
{
public interface ICqBase
{
void baseIt(); // does something
};
public interface ICqPolygonObject : ICqBase
{
void polygonObject(); // does something to polygons
};
public interface ICqStairObject : ICqPolygonObject
{
void stairObject(); // does something to stairs
};
}
Then assume you have a managed C++ assembly we will call TestLibrary
the oldClrSyntax switch is being used
its namespace looks as follows:
namespace TestLibrary
{
//
// This class is needed to reproduce the error.. I dont know why
//
public __gc class CqBase : public ICqBase
{
public: virtual void baseIt(void) { return; }
};
public __gc class CqPolygonObject : public CqBase, public
ICqPolygonObject
{
public: virtual void polygonObject() { return; }
};
}
So far this is very real world.. and everything works just fine.
Now lets assume we have another manged C++ assembly we will call
DerivedLibaray
the oldClrSyntax switch is being used also.
namespace DerivedLibaray
{
//
// All the problems are here with calling baseIt
//
public __gc class CqStairObject : public CqPolygonObject , public
ICqStairObject
{
public: virtual void stairObject() { this->baseIt(); return;
}
};
}
Notice we inherit from bother an inherited interface and a class with
inherited interfaces as well.
This shouldn't be a problem because Managed C++ inherits interfaces
virtually.
However the VS2005 compiler generates the folowing error
3>h:\data\code\testlibrary\derivedlibrary\DerivedLibrary.h(43) : error
C2385: ambiguous access of 'baseIt'
3> could be the 'baseIt' in base 'TestLibrary::CqPolygonObject'
3> or could be the 'baseIt' in base 'Interfaces::ICqStairObject'
Hmm thats odd... how is this ambigous.. you can't call baseIt in
ICqStairObject it's an interface?
Many change seem to make the problem go away.
Changing the interfaces to C++ fixes the issue.. except my interfaces
project has as over 200 interfaces.
removing the CqBase class fixes the issue but I really need this class
in my code because it has more than the baseIt method.
Moving the CqStair class to the TestLibrary from DerivedLibrary also
fixes things.
However, I have 76 projects for a reason. There are multiple products
and product version generated from the code and its just not feasible
to consolidate. Trust me on this one.
Converting the code to C++/CLI fixes the problem. I would use this
technique, if I didn't have 50 C++ projects with over 500,000 lines of
managed code using clrOldSyntax.
Anyone have any ideas for some other workaround.
This has been submitted to the VC team as a bug.
Thanks for the help
Christopher