Invalid launchSettings.json shows gold bar
This issue has a corresponding ticket on Developer Community. Please vote and comment there to make sure your voice is heard.
Hey if launchsettings.json is malformed (like this) then things crash
lau{
"profiles": {
"DasBlog.Tests": {
"commandName": "Project",
"environmentVariables": {
"Hosting:Environment": "Development"
}
}
}
}
here's the stack
=====================
3/9/2022 4:54:46 PM
LimitedFunctionality
System.AggregateException: One or more errors occurred. ---> System.Exception: Errors in 'C:\github\dasblog-core\source\DasBlog.Tests\UnitTests\Properties\launchSettings.json' need to be corrected before applying changes.
at Microsoft.VisualStudio.ProjectSystem.Debug.LaunchSettingsProvider. <GetSnapshotThrowIfErrorsAsync>d__101.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.ProjectSystem.Debug.LaunchSettingsProvider.<>c__DisplayClass95_0. <<AddOrUpdateProfileAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask. <JoinAsync>d__76.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.Tasks.SequentialTaskExecutor.<>c__DisplayClass8_0. <<ExecuteTask>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.Tasks.SequentialTaskExecutor.<>c__DisplayClass8_0. <<ExecuteTask>g__JoinTaskAsync|1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.WslDebugging.Package.ProjectInitializerHandler. <CreateNonPersistedWslLaunchProfileAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.WslDebugging.Package.ProjectInitializerHandler.<>c__DisplayClass13_0. <<UpdateSubscriptionAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Shell.VsTaskLibraryHelper.<>c__DisplayClass32_0. <<StartOnIdle>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask. <JoinAsync>d__76.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.WslDebugging.Package.ProjectInitializerHandler. <UpdateSubscriptionAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.ProjectSystem.DataReceivingBlockSlim`1. <ProcessInputQueueAsync>d__5.MoveNext()
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.Exception: Errors in 'C:\github\dasblog-core\source\DasBlog.Tests\UnitTests\Properties\launchSettings.json' need to be corrected before applying changes.
at Microsoft.VisualStudio.ProjectSystem.Debug.LaunchSettingsProvider. <GetSnapshotThrowIfErrorsAsync>d__101.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.ProjectSystem.Debug.LaunchSettingsProvider.<>c__DisplayClass95_0. <<AddOrUpdateProfileAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask. <JoinAsync>d__76.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.Tasks.SequentialTaskExecutor.<>c__DisplayClass8_0. <<ExecuteTask>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.Tasks.SequentialTaskExecutor.<>c__DisplayClass8_0. <<ExecuteTask>g__JoinTaskAsync|1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.WslDebugging.Package.ProjectInitializerHandler. <CreateNonPersistedWslLaunchProfileAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.WslDebugging.Package.ProjectInitializerHandler.<>c__DisplayClass13_0. <<UpdateSubscriptionAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Shell.VsTaskLibraryHelper.<>c__DisplayClass32_0. <<StartOnIdle>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask. <JoinAsync>d__76.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.WslDebugging.Package.ProjectInitializerHandler. <UpdateSubscriptionAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.ProjectSystem.DataReceivingBlockSlim`1. <ProcessInputQueueAsync>d__5.MoveNext()<---
===================
3/9/2022 4:55:00 PM
LimitedFunctionality
System.AggregateException: One or more errors occurred. ---> System.Exception: Errors in 'C:\github\dasblog-core\source\DasBlog.Tests\UnitTests\Properties\launchSettings.json' need to be corrected before applying changes.
at Microsoft.VisualStudio.ProjectSystem.Debug.LaunchSettingsProvider. <GetSnapshotThrowIfErrorsAsync>d__101.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.ProjectSystem.Debug.LaunchSettingsProvider.<>c__DisplayClass95_0. <<AddOrUpdateProfileAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask. <JoinAsync>d__76.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.Tasks.SequentialTaskExecutor.<>c__DisplayClass8_0. <<ExecuteTask>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.Tasks.SequentialTaskExecutor.<>c__DisplayClass8_0. <<ExecuteTask>g__JoinTaskAsync|1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.WslDebugging.Package.ProjectInitializerHandler. <CreateNonPersistedWslLaunchProfileAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.WslDebugging.Package.ProjectInitializerHandler.<>c__DisplayClass13_0. <<UpdateSubscriptionAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Shell.VsTaskLibraryHelper.<>c__DisplayClass32_0. <<StartOnIdle>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask. <JoinAsync>d__76.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.WslDebugging.Package.ProjectInitializerHandler. <UpdateSubscriptionAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.ProjectSystem.DataReceivingBlockSlim`1. <ProcessInputQueueAsync>d__5.MoveNext()
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.Exception: Errors in 'C:\github\dasblog-core\source\DasBlog.Tests\UnitTests\Properties\launchSettings.json' need to be corrected before applying changes.
at Microsoft.VisualStudio.ProjectSystem.Debug.LaunchSettingsProvider. <GetSnapshotThrowIfErrorsAsync>d__101.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.ProjectSystem.Debug.LaunchSettingsProvider.<>c__DisplayClass95_0. <<AddOrUpdateProfileAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask. <JoinAsync>d__76.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.Tasks.SequentialTaskExecutor.<>c__DisplayClass8_0. <<ExecuteTask>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.Tasks.SequentialTaskExecutor.<>c__DisplayClass8_0. <<ExecuteTask>g__JoinTaskAsync|1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.WslDebugging.Package.ProjectInitializerHandler. <CreateNonPersistedWslLaunchProfileAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.WslDebugging.Package.ProjectInitializerHandler.<>c__DisplayClass13_0. <<UpdateSubscriptionAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Shell.VsTaskLibraryHelper.<>c__DisplayClass32_0. <<StartOnIdle>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask. <JoinAsync>d__76.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.WslDebugging.Package.ProjectInitializerHandler. <UpdateSubscriptionAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.ProjectSystem.DataReceivingBlockSlim`1. <ProcessInputQueueAsync>d__5.MoveNext()<---
===================
Original Comments
Feedback Bot on 3/10/2022, 02:06 AM:
(private comment, text removed)
Peng Ge [MSFT] on 3/13/2022, 08:46 PM:
(private comment, text removed)
scott on 3/13/2022, 09:02 PM:
(private comment, text removed)
Peng Ge [MSFT] on 3/14/2022, 00:45 AM:
(private comment, text removed)
scott on 3/14/2022, 02:05 PM:
(private comment, text removed)
Peng Ge [MSFT] on 3/17/2022, 01:41 AM:
(private comment, text removed)
[email protected] on 4/16/2022, 02:20 PM:
(private comment, text removed)
Feedback Bot on 7/4/2022, 00:47 AM:
(private comment, text removed)
Daniel Liuzzi on 8/10/2022, 05:07 AM:
(private comment, text removed)
Valentin André on 8/15/2022, 04:21 AM:
(private comment, text removed)
Original Solutions
Valentin André solved on 8/16/2022, 02:32 AM, 0 votes:
I downgraded Visual Studio to 17.2.7 (LTSC) and that fixed the issue for me.
I did try to repair the 17.3 install first, but that did nothing.
@tmeschter's analysis -
Results of testing this out: If the file is malformed when the project loads (more specifically, the first time we try to load launch profiles from launchSettings.json) you'll get the exception reported by the user, and you will have no functional launch profiles until the issue is corrected. Everything else about the project system continues to function as normal, though of course you won't be able to launch/debug. If the file is edited to be malformed after the first time it is read, we basically ignore it and keep using the last "good" snapshot of the launch profiles we have in memory. The user gets no notification at all that the file is bad. So we don't get a crash, but there is definitely room for improvement here. A simple improvement might be to pop up our own info bar in the first case, with a more targeted message.