-
Notifications
You must be signed in to change notification settings - Fork 292
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
Replace calls to Method.GetCurrentMethod().Name
with nameof()
#1943
Replace calls to Method.GetCurrentMethod().Name
with nameof()
#1943
Conversation
That reduce places which marked as trimmer unfriendly. Even if `Method.CurrentMethod().Name` will work after trimming, but tooling cannot decide that in generic cases, see: dotnet/runtime#53242 At this point I would like to replace formatting primitives with `$""` if possible, since that allow Rolsyn manually build constant string. Also enabled Trim Analyzer on the build, so all trim warnings can be gradually removed after proper annotations, or other work done. /cc @Wraith2
@@ -30,7 +30,7 @@ static LocalAppContextSwitches() | |||
catch (Exception e) | |||
{ | |||
// Don't throw an exception for an invalid config file | |||
SqlClientEventSource.Log.TryTraceEvent("<sc.{0}.{1}|INFO>: {2}", TypeName, MethodBase.GetCurrentMethod().Name, e); | |||
SqlClientEventSource.Log.TryTraceEvent("<sc.{0}.{1}|INFO>: {2}", TypeName, "..ctor", e); |
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.
shouldn't this be .cctor
for a static constructor?
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.
Also, can you inline the TypeName, it's a nameof in a variable which is a bit pointless when it's single use.
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs
Outdated
Show resolved
Hide resolved
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1943 +/- ##
==========================================
- Coverage 71.53% 69.69% -1.84%
==========================================
Files 306 306
Lines 61841 61563 -278
==========================================
- Hits 44235 42909 -1326
- Misses 17606 18654 +1048
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 42 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
…lAppContextSwitches.cs
The changes looks good to me. Thanks @kant2002 for your contributions |
That reduce places which marked as trimmer unfriendly. Even if
Method.CurrentMethod().Name
will work after trimming, but tooling cannot decide that in generic cases, see: dotnet/runtime#53242 At this point I would like to replace formatting primitives with$""
if possible, since that allow Rolsyn build constant string for us at compile time.Also enabled Trim Analyzer on the build, so all trim warnings can be gradually removed after proper annotations, or other work done.
/cc @Wraith2