bugsnag / bugsnag-dotnet

.NET notifier for BugSnag. Error monitoring and error reporting for .NET.
https://docs.bugsnag.com/platforms/dotnet/
MIT License
60 stars 29 forks source link

Can't configure programatically in MVC or WebApi #93

Open ChadBurggraf opened 6 years ago

ChadBurggraf commented 6 years ago

All of the configuration sections' properties are read-only.

martin308 commented 6 years ago

@ChadBurggraf we did take a shortcut here to get this out, are you able to explain a bit more to me about how you would expect to use/configure the bugsnag client in this scenario? You can post in here or email me martin@bugsnag.com. Thanks!

ChadBurggraf commented 6 years ago

I would like to set the API key, release stage and app version at runtime. I would also like to dynamically disable/enable reporting at runtime, but I think that's possible through the middleware system.

martin308 commented 6 years ago

Would you be entirely configuring the client programmatically or would you also be using the web.config?

You can ignore reports using the middleware system. What would be the conditions that you would be using to disable/enable reporting?

ChadBurggraf commented 6 years ago

I'm okay with doing either (a combination of programatically and web.config, or just programatically).

Yes, thank you, I did see that I can use the middleware system to disable reporting.

tynorton commented 6 years ago

I just tried upgrading our BugSnag libraries to 2.0 and ran smack into this as well.

We need to ability to set global configuration for the MVC/WebAPI clients programatically.

martin308 commented 6 years ago

@ChadBurggraf @tynorton thanks for letting us know that you want to use Bugsnag like this, we have added this to our backlog of things that we really want to add. I'll keep you up to date with our progress on it

AndyMDoyle commented 6 years ago

I've upgraded and hit the same issue too.

We dynamically set the app version at runtime based on the assembly version of our site; and the release stage depending on if the site is running in development, staging, or production.

martin308 commented 6 years ago

Hi everyone, unfortunately I don't have any progress to report on this issue at the moment.

The only work around I can suggest right now is to use the core Bugsnag nuget package only and take a look at the code in the other packages as it's quite minimal to see how it hooks into the ASP.NET lifecycle. I'll update this issue when I can jump back onto implementing this

AndyMDoyle commented 6 years ago

I have been playing with some ways of making this possible, and I hope you don't mind but I've submitted an example PR (#108) with what I've come up with to make this possible.

It may be rubbish. It may be completely unsuitable. But it's what I might for the time being to get around the configuration constraints in one of our web apps.

tynorton commented 6 years ago

Any update on this? It's been nearly half a year since this issue was reported.

tynorton commented 5 years ago

@martin308 - Any update on whether this item has made it out of your backlog yet?

kfreestone commented 5 years ago

I really need to be able to set at least the appVersion programmatically as well.