Skip to content

Add SolutionArgumentException with error types#74

Merged
richardstanton merged 6 commits intomicrosoft:mainfrom
edvilme:edvilme-error-codes
Nov 18, 2024
Merged

Add SolutionArgumentException with error types#74
richardstanton merged 6 commits intomicrosoft:mainfrom
edvilme:edvilme-error-codes

Conversation

@edvilme
Copy link
Copy Markdown
Contributor

@edvilme edvilme commented Nov 14, 2024

Currently it is difficult for users of this library to compare and classify ArgumentExceptions, especially since the messages are formatted, localized strings.
This creates a new class SolutionArgumentException that additionally has a Type property that corresponds to a member of enum SolutionArgumentExceptionType.

@edvilme
Copy link
Copy Markdown
Contributor Author

edvilme commented Nov 14, 2024

@microsoft-github-policy-service agree company="Microsoft"

Comment thread src/Microsoft.VisualStudio.SolutionPersistence/Model/SolutionArgumentException.cs Outdated
Comment thread src/Microsoft.VisualStudio.SolutionPersistence/Model/SolutionArgumentException.cs Outdated
Copy link
Copy Markdown
Contributor

@kasperk81 kasperk81 left a comment

Choose a reason for hiding this comment

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

after this is merged and published need to update source build dotnet/source-build-externals#392 then publish to dotnet9 and 10 feeds, update msbuild and then sdk. (that's one of many reasons i was suggesting to make your life and the sdk implementation simpler and handle this error cases less pedantically)

Comment thread src/Microsoft.VisualStudio.SolutionPersistence/Model/SolutionArgumentException.cs Outdated
Comment thread src/Microsoft.VisualStudio.SolutionPersistence/Model/SolutionArgumentException.cs Outdated
…rgumentException.cs

Co-authored-by: kasperk81 <83082615+kasperk81@users.noreply.github.com>
Comment thread src/Microsoft.VisualStudio.SolutionPersistence/Model/SolutionArgumentException.cs Outdated
Comment thread src/Microsoft.VisualStudio.SolutionPersistence/Model/SolutionArgumentException.cs Outdated
Comment thread src/Microsoft.VisualStudio.SolutionPersistence/Model/SolutionArgumentException.cs Outdated
Comment thread src/Microsoft.VisualStudio.SolutionPersistence/Model/SolutionArgumentException.cs Outdated

public class SolutionArgumentException : ArgumentException
{
public readonly SolutionErrorType Type;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
public readonly SolutionErrorType Type;
public SolutionErrorType Type { get; init; }

by convention, this should be a readonly property

@richardstanton richardstanton merged commit 445a2f3 into microsoft:main Nov 18, 2024
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