milund
2007-02-07 08:56:15 UTC
I have a "funny" after upgrading to .NET2.0.
The following code is placed inside an unsafe method in assembly "A"
System.Object myIUnknownObject =
Marshal.GetObjectForIUnknown((System.IntPtr)m_someClass.MyProperty);
SomeClass is declared public in assembly "B".
MyProperty get is declared public and written in managed C++ (old
syntax) like this.
__property IUnknown* get_MyProperty()
{
return (IUnknown*)m_pStuff->GetStuff();
}
This works fine when assembly "B" is compiled under VS2003 and .NET1.1
When assembly "B" is compiled under VS2005 and .NET2.0 I get this
error (when compiling assembly "A"): "error CS0122:
'B.SomeClass.MyProperty' is inaccessible due to its protection level"
In both cases assembly "A" is compiled with VS2005 and .NET2.0
What has changed from .NET1.1 to .NET2.0 and how do I correct this?
(Note that I actually can get it to work using reflection, but that is
not the point - I would like to understand what is wrong here).
thanks,
Michael
The following code is placed inside an unsafe method in assembly "A"
System.Object myIUnknownObject =
Marshal.GetObjectForIUnknown((System.IntPtr)m_someClass.MyProperty);
SomeClass is declared public in assembly "B".
MyProperty get is declared public and written in managed C++ (old
syntax) like this.
__property IUnknown* get_MyProperty()
{
return (IUnknown*)m_pStuff->GetStuff();
}
This works fine when assembly "B" is compiled under VS2003 and .NET1.1
When assembly "B" is compiled under VS2005 and .NET2.0 I get this
error (when compiling assembly "A"): "error CS0122:
'B.SomeClass.MyProperty' is inaccessible due to its protection level"
In both cases assembly "A" is compiled with VS2005 and .NET2.0
What has changed from .NET1.1 to .NET2.0 and how do I correct this?
(Note that I actually can get it to work using reflection, but that is
not the point - I would like to understand what is wrong here).
thanks,
Michael