I'm currently working with hosting dotnet from a native (c++) application to build a plugin system.
Therefore I setup a c++ project which loads the dotnet runtime and executes a managed assembly.
Works just fine but now I'm wondering if I can get Rider to attach to this process for me to be able to debug the managed assembly?
~~Although I haven't tried in this case I guess I did similiar things in Visual Studio in the past.~~ (I tried in the meantime)
In Rider I cannot attach to a process unless the project is an executable. As this is a class library I tried to setup a Run configuration of ".NET executable" type, set "Exe path" to the path where my managed dll is located and tried "Attach to process" again.
This time I could select this option but I only get .NET processes thus the native host application isn't listed there.
Is this somehow possible?
I'm using CLion for the native part and Rider for the managed part currently.
I created a GitHub project containing a minimal sample application that should provide a native host with a managed assembly to load. You can find it here https://github.com/TorbenJ/Dotnet-5-Native-Hosting
I also tried the solution in Visual Studio. In order to debug the managed assembly that gets loaded by the native host all I had to do is go to the native project's properties -> Debugging Tab -> Debugger Type -> Mixed (.NET Core).
After that I was able to set a breakpoint in the managed assembly that was triggered when I started the native application. Downside is that I cannot debug the native application anymore in mixed mode but I can live with that.