Mixed C# and C++ solution

i have a .net 6 app which takes dependency on 2 libraries. 1st library is written in C#, and the second library is a Managed C++/CLR library. I created an .saproj that embeds both the C# and the C++/CLR libraries into my main app DLL.
When i run the app it crashes at runtime saying it can't load the C++/CLR library.

Is there a way around this? Or would you be able to provide a fix for this in a future release?
I attached my visual studio solution which also includes the .saproj file that is in the "Obfuscated" subfolder.

Thanks,
Dmitry
Tagged:

Answers

  • Hello dgrinblat,

    I attempted to build your solution from scratch to see the obfuscation behaviour but the CSharpLib dependency appears to be missing?
    The directory is present, but there's no resource inside that could be embedded.
    Kind regards
    Peter Laws | Redgate Software
    Have you visited our Help Center?
  • dgrinblatdgrinblat Posts: 4 New member
    edited April 17, 2023 10:00PM
    Hello Peter,
    I don't understand how it could not be there. I just downloaded the above attachment, unzipped it and DEFINITELY CSharpLib is there and solution builds. Can you please look again. Just in case i attached CSharpLib.zip separately

  • Hi @dgrinblat

    Had a look at the project you provided and see that CSharpLib was there and not built. 
    I could build it to the required DLL and include it in the project.

    However I then hit an issue with ManagedCPPLib dependency.
    I tried to built it but am missing some packages in my VS env.

    For the sake of replicating this, are you able to conduct a build of the project and provide the DLLs directly so we ensure they match what you are using.
    I know at a minimum it will be CSharpLib & ManagedCPPLib.
    Unsure if there are others, but looking at the project I suspect not.

    You can provide the files via this link 
    https://files.red-gate.com/requests/aYqQg76QiPhNIPKEOifXYH
    This link will be active for 14 days.
    Jon Kirkwood | Technical Support Engineer | Redgate Software
  • dgrinblatdgrinblat Posts: 4 New member
    edited April 24, 2023 1:34PM
    Hi @Jon_Kirkwood I've uploaded the attached zip file to the link you provided above. This is a build of my sample project which has all the DLLs. Please try to obfuscate this build and you should easily be able to reproduce the run-time crash involving the managed C++ dll. Thanks.
  • dgrinblatdgrinblat Posts: 4 New member
    Any update on this?
Sign In or Register to comment.