Skip to content

Conversation

@danmoseley
Copy link
Member

@danmoseley danmoseley commented Jul 2, 2023

  1. Moved resource string existence check (in debug) consistently outside of the condition. This detected cases where we were using an invalid resource string, but the condition was never false. Fixed these. Note, it doesn't need to be localized message or even probably the same exception type because almost by definition, these conditions have never been true, and possibly can never be true (otherwise they'd have hit the missing resource already). Also, change method to be debug-only so as to remove the #if.

  2. Moved s_throwExceptions consistently inside the condition check as cleaner.

  3. Move exception construction consistently out of the VerifyThrowXX methods so this cold path doesn't prevent them inlining.

  4. Remove string formatting inside the condition in one place where string interpolation was happening.

@AR-May AR-May requested review from JanKrivanek and rokonec July 4, 2023 13:34
Copy link
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

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

Thank you!

@danmoseley
Copy link
Member Author

This would make it hard to keep the two strings in alignment, right? Is there a plan there?

I can put them into Shared\Resources\Strings.shared.resx if you like? that is built into tasks, engine, utilities, task host, and exe. but then they are only in one file in the code.

@Forgind
Copy link
Contributor

Forgind commented Jul 7, 2023

This would make it hard to keep the two strings in alignment, right? Is there a plan there?

I can put them into Shared\Resources\Strings.shared.resx if you like? that is built into tasks, engine, utilities, task host, and exe. but then they are only in one file in the code.

Works for me! Maybe get buyoff from someone who actually works on MSBuild, though 😅

@danmoseley
Copy link
Member Author

What do you work on @Forgind ... entirely in SDK?

@Forgind
Copy link
Contributor

Forgind commented Jul 7, 2023

Yup!

@JanKrivanek
Copy link
Member

JanKrivanek commented Jul 10, 2023

This would make it hard to keep the two strings in alignment, right? Is there a plan there?

I can put them into Shared\Resources\Strings.shared.resx if you like? that is built into tasks, engine, utilities, task host, and exe. but then they are only in one file in the code.

Works for me! Maybe get buyoff from someone who actually works on MSBuild, though 😅

Sounds good.

I suppose this string would not change often (especially to extent of adding/removing fmting params) - but I definitely wouldn't complain to future-proof it by moving to single resx

Copy link
Member

@rokonec rokonec left a comment

Choose a reason for hiding this comment

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

Thanks for taking time to clean it.

@danmoseley
Copy link
Member Author

feedback hopefully addressed

@danmoseley
Copy link
Member Author

(I removed some low value comments and formatting for todays less narrow monitors..)

@danmoseley
Copy link
Member Author

is this ready to merge?

@rokonec rokonec merged commit ed619b4 into dotnet:main Jul 13, 2023
@danmoseley danmoseley deleted the verifythrow branch July 13, 2023 22:23
YuliiaKovalova pushed a commit to YuliiaKovalova/msbuild that referenced this pull request Jul 18, 2023
* cleanup errors
* remove if debug
* xlf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants