Better malformed launchsettings error#5145
Merged
mitchdenny merged 6 commits intomainfrom Aug 7, 2024
Merged
Conversation
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
2 tasks
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
JamesNK
reviewed
Aug 5, 2024
Co-authored-by: James Newton-King <james@newtonking.com>
eerhardt
reviewed
Aug 5, 2024
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
eerhardt
reviewed
Aug 6, 2024
eerhardt
approved these changes
Aug 7, 2024
Comment on lines
+22
to
+24
| var ex = Assert.Throws<DistributedApplicationException>(() => | ||
| { | ||
| var appBuilder = CreateBuilder(); |
Member
There was a problem hiding this comment.
Suggested change
| var ex = Assert.Throws<DistributedApplicationException>(() => | |
| { | |
| var appBuilder = CreateBuilder(); | |
| var appBuilder = CreateBuilder(); | |
| var ex = Assert.Throws<DistributedApplicationException>(() => | |
| { |
(nit) I like to keep the action inside the Assert.Throws as minimal as possible, so it is obvious what line is throwing the exception.
Comment on lines
+43
to
+48
| var projectDirectoryPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); | ||
| var projectFilePath = Path.Combine(projectDirectoryPath, "Project.csproj"); | ||
| var propertiesDirectoryPath = Path.Combine(projectDirectoryPath, "Properties"); | ||
| var launchSettingsFilePath = Path.Combine(propertiesDirectoryPath, "launchSettings.json"); | ||
|
|
||
| Directory.CreateDirectory(projectDirectoryPath); |
Member
There was a problem hiding this comment.
Suggested change
| var projectDirectoryPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); | |
| var projectFilePath = Path.Combine(projectDirectoryPath, "Project.csproj"); | |
| var propertiesDirectoryPath = Path.Combine(projectDirectoryPath, "Properties"); | |
| var launchSettingsFilePath = Path.Combine(propertiesDirectoryPath, "launchSettings.json"); | |
| Directory.CreateDirectory(projectDirectoryPath); | |
| var projectDirectoryPath = Directory.CreateTempSubdirectory().FullName; | |
| var projectFilePath = Path.Combine(projectDirectoryPath, "Project.csproj"); | |
| var propertiesDirectoryPath = Path.Combine(projectDirectoryPath, "Properties"); | |
| var launchSettingsFilePath = Path.Combine(propertiesDirectoryPath, "launchSettings.json"); | |
Using CreateTempSubdirectory is easier.
Comment on lines
+43
to
+48
| var projectDirectoryPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); | ||
| var projectFilePath = Path.Combine(projectDirectoryPath, "Project.csproj"); | ||
| var propertiesDirectoryPath = Path.Combine(projectDirectoryPath, "Properties"); | ||
| var launchSettingsFilePath = Path.Combine(propertiesDirectoryPath, "launchSettings.json"); | ||
|
|
||
| Directory.CreateDirectory(projectDirectoryPath); |
Member
There was a problem hiding this comment.
Should we be deleting this directory when the test is done so we don't clutter up the temp directory?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4307
Microsoft Reviewers: Open in CodeFlow