I’m trying to get sentry working in our C# solution that has multiple Program.cs files.
When I initialise Sentry (with using
) in the main method of the first Program.cs, it works fine. When I try the other main methods, however, the errors don’t get reported. IsEnabled
returns true
, not sure what else to check.
Ideas?
Are all of those Program.cs
different console applications? Is this .NET Framework or Core? What version?
Is any of those Main
methods async
?
Could you please share a repro? Maybe a GitHub repository which shows what’s going on?
Okay, bear with me a bit as I’m not a C# dev (been recently assigned to this project).
In the Properties section of each project they are all built as Windows Applications (as opposed to Console).
None of the Main
s are async, what happens is the first one starts the second one as a process, and the second one does the same thing with the third.
I’ll try to create a small repo that demonstrates it.
They start the other with Process.Start()
?
In any regard it sounds like you need to add Sentry.Init
to each Main
method, in each Program.cs
.
Also, if those are Desktop apps, please make sure to check the docs.
For WPF and WinForms which require some extra step.
The repro will help though