-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
ASPNET.Core default Environment settings are cleaned, if used. #554
ASPNET.Core default Environment settings are cleaned, if used. #554
Conversation
@bruno-garcia Drats - the test failed, yet it works on my machine. Is there any way I can see what the failure is? (BTW, I can't run any NET461 or NC21 tests on my machine. I only have NetCore3+ installed) Not sure if the failing test occurs there/then? |
Co-authored-by: Brian Surowiec <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #554 +/- ##
==========================================
- Coverage 85.33% 85.23% -0.10%
==========================================
Files 128 138 +10
Lines 3170 3332 +162
Branches 730 752 +22
==========================================
+ Hits 2705 2840 +135
- Misses 268 294 +26
- Partials 197 198 +1
Continue to review full report at Codecov.
|
test/Sentry.AspNetCore.Tests/SentryAspNetCoreOptionsSetupTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Brian Surowiec <[email protected]>
@bruno-garcia as a side note to this PR, i don't understand how my PR dropped that files code coverage by 8% 😢 I'd love to know how/why so I can make sure I'm covering the code I just created. (note: I did click on the file in the codecoverage report above and not sure how to make it out :/ ) |
That's mainly because NS20 doesn't have nullable type annotations on BCL. NS20 is still required for older versions of the framework, I'm guessing.
That was probably outdated, shows +0.04% now. |
// need to respect (especially the case-sensitivity). | ||
// REF: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments | ||
#if NETSTANDARD2_0 | ||
if (_hostingEnvironment.EnvironmentName.Equals("Production")) |
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.
Should we consider case sensitivity here? Or maybe use StringComparison.OrdinalIgnoreCase
?
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.
re: exact casing:
I did case sensitivity to reduce cycles. Why set the value if it's already the exact same?
EDIT: Also not sure if there's an extra allocation if setting the string value, if the previous string value is already the same.
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.
great stuff!
Co-authored-by: Bruno Garcia <[email protected]>
40ad2f5
to
f426efd
Compare
sadness 😢 AppVeyor is dying cause of some transient error :(
|
rerunning the build. |
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.
Good stuff!
Thanks again @PureKrome ! |
My pleasure 👍🏻 |
Resolves #551
NOTES:
The ASPNET.Core project actually targets both NETCOREAPP30 and NS20 (I'm not sure why .....).
As such, I've ended up NOT doing a single "if environment == "Production" string check (for both NS20 and NCA30) because NETCOREAPP30+ now includes this string as a constant. Yay 🎉
So I ended up using
#if NETSTANDARD2_0
etc, preprocessor directives. It makes the code a bit more messy, so i'm totally happy to strip that out and just have the a simple string check for both, instead of a string check and a const string check.Finally, not sure if the test I added was into the correct file, etc. So happy to get told otherwise.