-
-
Notifications
You must be signed in to change notification settings - Fork 207
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom tags missing in some contexts #221
Comments
My guess is that this is Does it happen also with .NET Framework 4.7.2? Is it possible to initialize the SDK during |
@bruno-garcia, thank you for your response. I use the Sentry package in a .NET Framework 4.7.2 service and a WPF app. I think I tried all possible combinations where to initialize it, but there was always a context where my custom tags were missing. What I eventually did is quit using Topshelf and handle service start/stop manually. I initialize Sentry in the Main method of the service, just as I did in the example in my original post. But I call the But is that approach correct? It seems to work... |
But it's not all. I noticed that the WPF app I mentioned also had similar problems on shutdown. Logs generated in the I haven't investigated that issue further, but I suspect that calling |
@bruno-garcia, could you please help? Let's concentrate on the WPF app now only. I noticed that some Sentry events still miss the custom tags and user ID that I set. Here's my code:
Here's the Serilog config from app.config:
It's a multithreaded environment. The events missing the custom tags come from managed code and a different thread than the one Sentry is initialized in (if it matters). Am I doing something incorrectly or is it a bug? |
@mariusz-schimke-iteo if you could provide us with a reproducible app, it would be great. |
@bruno-garcia, sure, I'll prepare one and will let you know when ready. Thanks! |
@bruno-garcia, sorry it took me so long, but I had no time. Here's a very simple WPF application with Sentry and Serilog integrations: SentrySerilogWpfTest. Just set your valid DSN in the code (App.xaml.cs) and start the app, then close it. You should then get two events in Sentry: the startup event will contain the user.id and a custom tag as expected. The exit event will contain none of them. |
@mariusz-schimke-iteo I was able to reproduce. I found this on SO:
I moved the code from |
@bruno-garcia, sorry again for such a delay. It does not seem to solve the issue. I moved the code to the App class constructor. The OnStartup method then fails to provide user ID and tags, same case for other application contexts (such as logs generated by other threads). |
IIRC I moved all the code to the constructor. Including setting the user to the scope. |
Confirmed, this is what I did too. |
It's what is used to implicitly propagate the scope with async code |
Any progress on this? I'm facing similar issues with Xilium/CefGlue where native code is involved in between. Would be nice to have support for such cases :-) |
I had the same problem on a WPF app. Regardless where the initialization was happening (Startup or constructor) because of the use of |
We need to have a global shared hub/scope stack. Which we'll get to it this year :) Tracking issue is: #628 |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I'm trying to use the Sentry package in a Topshelf Windows service with Serilog handling logging. The Topshelf package lets you install and start/stop your command line app as a service by simply running the executable with arguments, e.g.
MyConsoleApp.exe install start
orMyConsoleApp.exe stop
.When you run it without arguments, it starts as a command line app.
When I start the app as a service (with the
start
command line argument), events generated by it have no custom tags and user ID in Sentry (please see scope configuration in the code below). When I start the app without any args, the custom tags are available in Sentry.What I investigated so far, when starting the app with the
start
param, the started instance starts the same executable as a Windows service and exits right away. Events logged by the initially started instance are OK in Sentry, but those logged by the service miss custom tags.I don't know how to explain and fix it. Would you have any suggestions in this context? I would be really grateful, even though I will probably just quit Topshelf in the meantime because I have already wasted too much time without success.
Here's my .NET Framework console app code:
The text was updated successfully, but these errors were encountered: