There is a c# Application that compiles C# code stored in DB and creates a DLL in memory using roslyn compiler that the DLL is loaded in memory and an instance of the type is created from the following code
Activator.CreateInstance(type); // Just creates an instance of the type so that any public method or property can be accessed
The reason for having the code in DB is abit complex to explain here for the scope of the question but it is important to note there is no physical file where C# code is present.
Also please note the DLL is created at runtime by the application in release mode or debug mode depending if #ifdebug is true or not.
Now what we want is if the application is running in debug mode we should be able to debug the DLL created in runtime. Can experts over here help me to give pointers how to achieve it. Since access to code is there from DB we can in runtime create a temporary file in some temporary location if the application is running in debug mode but how do we let Visual studio know we want to link the specific DLL to this temporary C# file for the purpose of debugging. Please note the DLL is in memory in some concurrent bag and we arent creating PDB file too
Any pointers will be helpful We are using Visual studio 2022


