Skip to content

Prevent OverflowException in Expander.cs from crashing MSBuild - #2898

Merged
AndyGerlicher merged 3 commits into
dotnet:vs15.6from
KirillOsenkov:dev/kirillo/fix2882
Jan 24, 2018
Merged

AndyGerlicher merged 3 commits into
dotnet:vs15.6from
KirillOsenkov:dev/kirillo/fix2882

Conversation

@KirillOsenkov

Copy link
Copy Markdown
Member

Convert.ChangeType can throw OverflowException.

Catch that and return null otherwise it crashes MSBuild.
See #2882.

This fixes the actual crash, but not the systemic issues uncovered by the crash. This is just to stop the bleeding. Proper fixes will follow.

This is an easy safe fix that I'd like to get into 15.6.

@rainersigwald
rainersigwald changed the base branch from master to vs15.6 January 23, 2018 23:50
@rainersigwald

Copy link
Copy Markdown
Member

Can you rebase on the vs15.6 branch so it's easier to merge either way?

Catch that and return null otherwise it crashes MSBuild.
See dotnet#2882.
@KirillOsenkov

Copy link
Copy Markdown
Member Author

@AndyGerlicher @rainersigwald all green - can this go in?

@KirillOsenkov

Copy link
Copy Markdown
Member Author

Added another commit that adds some more well-known functions to the fast path.

This is needed so that Roslyn.sln evaluates cleanly without first-chance exceptions. Roslyn has added usage of these functions in this commit:
dotnet/roslyn@56ec3cf

@KirillOsenkov

Copy link
Copy Markdown
Member Author

Added another commit to account for this usage introduced by @rainersigwald just yesterday ;)
f388fc5

@AndyGerlicher

Copy link
Copy Markdown
Contributor

This will go in tonight before I start the insertion build. It just has to stay green long enough to merge :)

@KirillOsenkov

KirillOsenkov commented Jan 24, 2018 •

Copy link
Copy Markdown
Member Author

Cool. This seems to be the last one. Roslyn now evaluates without throwing.

@AndyGerlicher
AndyGerlicher merged commit b74cf57 into dotnet:vs15.6 Jan 24, 2018
@KirillOsenkov
KirillOsenkov deleted the dev/kirillo/fix2882 branch January 24, 2018 02:48
@KirillOsenkov

Copy link
Copy Markdown
Member Author

Yay! Thanks! I'm so happy this went in!

string trimChars;
if (TryGetArg(args, out trimChars) && trimChars.Length > 0)
{
returnVal = text.TrimStart(trimChars.ToCharArray());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 I meant to check for this since I just added a use for this overload in common targets.

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.

3 participants