I have two C# classes (Interop & Assembly)which is shown below
I have a unmanged c++ client and c++ client creates an instance of CGetSimpleFunct ionTest through COM. it calls GetSimpleFuncti onClass()to get the CTest object. Then it calls SimpleFunction( ) on CTest object.
Problem is when GetSimpleFuncti onClass() is called, GCHandle.Alloc is throwing an exception "Object contains non-primitive or non-blittable data." . I don't have any data members in CTest class just one function SimpleFunction( ).
I searched entire net to solve the above problem, but i could not get any solution.
Please Please can anyone helpme to solve this problem
Code:
public class CTest
{
public CTest()
{
}
public void SimpleFunction()
{
}
}
public class CGetSimpleFunctionTest
{
public CGetSimpleFunctionTest()
{
}
public IntPtr GetSimpleFunctionClass()
{
CTest test = new CTest();
IntPtr pTest = new IntPtr();
GCHandle gch = GCHandle.Alloc(test, GCHandleType.Pinned);
}
}
Problem is when GetSimpleFuncti onClass() is called, GCHandle.Alloc is throwing an exception "Object contains non-primitive or non-blittable data." . I don't have any data members in CTest class just one function SimpleFunction( ).
I searched entire net to solve the above problem, but i could not get any solution.
Please Please can anyone helpme to solve this problem
Comment