-
Notifications
You must be signed in to change notification settings - Fork 543
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
Better malformed launchsettings error #5145
Better malformed launchsettings error #5145
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Co-authored-by: James Newton-King <james@newtonking.com>
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
var ex = Assert.Throws<DistributedApplicationException>(() => | ||
{ | ||
var appBuilder = CreateBuilder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be deleting this directory when the test is done so we don't clutter up the temp directory?
Fixes #4307
Microsoft Reviewers: Open in CodeFlow