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
| { | ||
| // 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.
shouldn't this be .cctor for a static constructor?
There was a problem hiding this comment.
Also, can you inline the TypeName, it's a nameof in a variable which is a bit pointless when it's single use.
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().Namewill 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