-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Support TraceSource to be initialized from the app.config file #73087
Conversation
Tagging subscribers to this area: @tommcdon Issue DetailsWIP
|
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
1ce6320
to
7885a77
Compare
…dDiagConfigSteve
b186226
to
ba39523
Compare
ba39523
to
ba57e1f
Compare
cc @RussKie @JeremyKuhne since you're involved from Winforms side. @noahfalk was also involved from diagnostics side. |
Thank you. |
src/libraries/System.Configuration.ConfigurationManager/src/Resources/Strings.resx
Show resolved
Hide resolved
src/libraries/System.Diagnostics.TraceSource/src/System/Diagnostics/Trace.cs
Show resolved
Hide resolved
Good point - I'll add that to the description. Customers will be required to call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. I think our WinForms users are really going to appreciate it!
...ource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs
Outdated
Show resolved
Hide resolved
...s/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
...s/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
...figuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj
Outdated
Show resolved
Hide resolved
...stem.Diagnostics.TraceSource.Config.Tests/System.Diagnostics.TraceSource.Config.Tests.csproj
Outdated
Show resolved
Hide resolved
...ource/tests/System.Diagnostics.TraceSource.Tests/System.Diagnostics.TraceSource.Tests.csproj
Outdated
Show resolved
Hide resolved
...braries/System.Diagnostics.TraceSource/src/System/Diagnostics/InitializingSwitchEventArgs.cs
Outdated
Show resolved
Hide resolved
9d815cf
to
71f73e5
Compare
71f73e5
to
a5ac25d
Compare
This reverts commit a5ac25d.
CI is green with exception of |
internal void OnInitializing() | ||
{ | ||
Initializing?.Invoke(null, new InitializingSwitchEventArgs(this)); | ||
TraceUtils.VerifyAttributes(Attributes, GetSupportedAttributes(), this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This call causes Winforms test to fail - dotnet/winforms#7578
Do we need to do anything to help folks that are trying to port discover how to make this work? Is it sufficient to hope they find the original issue and navigate here? Should we put an example in the RC1 release post? |
I believe @KlausLoeffelmann was able to devise a fix, so I think we're good now. |
@RussKie what I'm asking is how a customer porting to .NET Core whose code fails at runtime with something similar to
... will learn that they need to use .NET 7+ and add a call to @KlausLoeffelmann is not a typical customer. |
Breaking change doc: dotnet/docs#32147 |
@steveharter just to confirm - the fix is only in .NET 7 and it's not available in the earlier versions, right? |
Fixes #23937 (original issue)
Fixes #72967 (API)
Much of the code was ported from .NET Framework and refactored to support the three new events to allow the config system to update
TraceSource
and friends from the config file(s). Original port per @ericstj in the first commit.To enable this functionality,
TraceConfiguration.Register()
must be called. This is a new API that is not present in .NET Framework.There is potentially more tests around error handling that could be added:
Switch
,TraceSource
andTraceListener
.initializeData
.