rollbar / Rollbar.NET

Rollbar for .NET
https://docs.rollbar.com/docs/dotnet
MIT License
65 stars 44 forks source link

RollbarConfigurationLoader searches in wrong directory #636

Open AntMaster7 opened 1 year ago

AntMaster7 commented 1 year ago

I am using the latest version of Rollbar.NET in an ASP .NET MVC application that is hosted on IIS and uses .NET Framework 4.8. However, the RollbarConfigurationLoader (its static constructor) uses RuntimeEnvironmentUtility.GetSdkRuntimeLocationPath() to determine the location where the DLLs are to dynamically load the configuration loader module (e.g. Rollbar.App.Config).

However, in the IIS world the actual DLLs are located in a bin subdirectory and not in the work directory (where the web.config is). Maybe when searching for the configuration loader modules, both the sdk runtime location path and its bin subfolder should be checked. Or one could check the location of the Rollbar.DLL and use that as a base path to probe for the additional modules.

You can reproduce the issue when you create a new ASP.NET Web Application (.NET Framework) project and choose MVC.

In order to workaround this issue, I have to copy the DLL out of the bin folder into the working directory. Thats kinda ugly though.

jacob-ewald commented 1 year ago

Ran into this same issue in a project today. Appending "bin" to the path here gets it to work, but that's just while stepping through in Visual Studio and manually changing the value. Copying the dll from "bin" to the parent folder did not work for me. Either one of your proposed solutions seem viable.