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

Updated JetBrains Annotations with StructuredMessageTemplateAttribute #4757

Merged
merged 2 commits into from
Jan 19, 2022

Conversation

snakefoot
Copy link
Contributor

@snakefoot snakefoot commented Jan 19, 2022

Removed code-regions with ASP + MVC + Razor-attributes, since not relevant for NLog-core-project.

@snakefoot snakefoot added enhancement Improvement on existing feature refactoring labels Jan 19, 2022
@snakefoot snakefoot added this to the 5.0 (new) milestone Jan 19, 2022
@snakefoot
Copy link
Contributor Author

snakefoot commented Jan 19, 2022

Guess one also could add StringFormatMethodAttribute but it seems it conflicts with using structured-message-templates:

See also: aspnet/Logging#340 + https://youtrack.jetbrains.com/issue/RSRP-483165

Curious if using StructuredMessageTemplateAttribute, then suddenly Resharper will complain when doing this (Notice placeholders are not matching with parameter-count):

logger.Info("Say Hello{0}To my new friend{0}{1}", Environment.NewLine, "Al")

StructuredMessageTemplateAttribute: Indicates that the marked parameter is a message template where placeholders are to be replaced by the following arguments in the order in which they appear

@snakefoot
Copy link
Contributor Author

Tested with a Resharper-Trial-Account, and it looks like StructuredMessageTemplateAttribute supports both {0}{1}{0} and {hello}.

@sonarcloud
Copy link

sonarcloud bot commented Jan 19, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@snakefoot snakefoot merged commit 4609cf1 into NLog:dev Jan 19, 2022
@snakefoot
Copy link
Contributor Author

@304NotModified Think this should trigger release of NLog 5.0 RC2. To ensure the new attribute doesn't hurt too much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement on existing feature refactoring size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant