I have a test application write in c#, which calls a function in c++/cli.
c++/cli function then calls a fnction in a c++ code.
I have three project:
c# project which calls c++/cli code.
c++/cli project which wraps c++ code.
All then build ad debug.
In c# I have a code such as this:
var myFile=MyFileWrapper.MyFileWrapper.ReadMyFile(@"C:\tmp\MyFile.bin");
in c++/cli I have code like this:
MyFileWrapper^ MyFileWrapper::ReadMyFile(System::String ^fileName)
{
auto nativeMyFile=MyFile::ReadMyFile((char *) System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(fileName).ToPointer());
MyFileWrapper^ MyFileWrapper=gcnew MyFileWrapper();
int x=nativeMyFile->Width;
// do some work
return MyFileWrapper;
}
and in c++ I have this code:
MyFile* MyFile::ReadMyFile(char * FileName)
{
auto myFile=new MyFile();
myFile->Width=100;
myFile->Height=200;
return myFile;
}
When I try to debug the system, I can step into c++/cli from C# code, but I can not step into c++ code from C++/CLI code.
When I try to watch nativeMyFile in c++/cli, I can see its address, but not its type or data (for example nativeMyFile->Width in watch window generate error.
when checking value of X, it is 100, which shows the correct value is passed.
Why can not I step into C++ code from c++/cli code?
Why I can not watch objects which defined in c++ code?