Skip to content
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

Handle IndexOutOfRangeException thrown by Microsoft.Extensions.Logging when using invalid format string #272

Merged
merged 1 commit into from
Mar 27, 2019

Conversation

snakefoot
Copy link
Contributor

@snakefoot snakefoot commented Mar 23, 2019

Throw FormatException when IndexOutOfRangeException caused by invalid parameters

See also #271

@codecov
Copy link

codecov bot commented Mar 23, 2019

Codecov Report

Merging #272 into master will increase coverage by 0.19%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #272      +/-   ##
==========================================
+ Coverage   69.38%   69.58%   +0.19%     
==========================================
  Files           9        9              
  Lines         761      766       +5     
  Branches      135      135              
==========================================
+ Hits          528      533       +5     
  Misses        180      180              
  Partials       53       53
Impacted Files Coverage Δ
...nsions.Logging/Logging/NLogMessageParameterList.cs 73.88% <100%> (+1.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 380305c...4d5a7cb. Read the comment docs.

@304NotModified
Copy link
Member

Thanks! But I think we should report this bug at Ms, and hope those guys fix it?

@snakefoot
Copy link
Contributor Author

snakefoot commented Mar 24, 2019

Even if they decide to fix the "bug" (garbage-in means garbage out) then it will not be fixed for any known version of NetCore ("bug" not important enough to be back-ported). See also:

dotnet/extensions#550
dotnet/extensions#664
https://github.com/aspnet/Extensions/issues/668

So I think this fix should be made, as all MEL-Loggers are expected to throw FormatException (signals error in format-string) and not IndexOutOfRangeException (signals error in NLog)

@snakefoot snakefoot force-pushed the StringFormatException branch from a9aa1d3 to 5e43a90 Compare March 24, 2019 19:49
@304NotModified 304NotModified changed the title Throw FormatException when IndexOutOfRangeException caused by invalid parameters Handle IndexOutOfRangeException thrown by Microsoft.Extensions.Logging when using invalid parameters Mar 24, 2019
@304NotModified
Copy link
Member

Even if they decide to fix the "bug" (garbage-in means garbage out) then it will not be fixed for any known version of NetCore ("bug" not important enough to be back-ported). See also:

aspnet/Extensions#550
aspnet/Extensions#664
aspnet/Extensions#668

So I think this fix should be made, as all MEL-Loggers are expected to throw FormatException (signals error in format-string) and not IndexOutOfRangeException (signals error in NLog)

You convinced me, thanks for the effort :

@304NotModified 304NotModified added this to the 1.5 milestone Mar 24, 2019
@snakefoot snakefoot force-pushed the StringFormatException branch from 5e43a90 to 8842f2f Compare March 24, 2019 22:52
@snakefoot snakefoot force-pushed the StringFormatException branch from 8842f2f to 4d5a7cb Compare March 24, 2019 22:54
Copy link
Member

@304NotModified 304NotModified left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!

@304NotModified 304NotModified changed the title Handle IndexOutOfRangeException thrown by Microsoft.Extensions.Logging when using invalid parameters Handle IndexOutOfRangeException thrown by Microsoft.Extensions.Logging when using invalid format string Mar 24, 2019
@304NotModified 304NotModified merged commit 6691447 into NLog:master Mar 27, 2019
@snakefoot snakefoot deleted the StringFormatException branch April 2, 2019 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants