-
Notifications
You must be signed in to change notification settings - Fork 675
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
VS Code fails to generate launch.json when there are ignorable errors in project.json #577
Comments
The basic problem here is that Microsoft.ProjectModel is not resilient to the error, which means that OmniSharp can't process it. The proper generation of the launch.json requires querying OmniSharp to determine where the executable will be produced. So, a simple syntax error can make the whole thing fall apart. I'll take a closer look to see if there's anything we can do. It seems like dotnet build gets around this somehow. |
@DustinCampbell makes sense. If this is hard to fix, maybe we can just warn the user that there are syntax errors? |
+1 I am seeing launch.json generation fail against the default project.json created by the .NET Core Visual Studio tools. The project.json appears to be valid. Repro:
Expected: launch.json and tasks.json are created. Here is the project.json: {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
} The exception is being thrown from |
Looks like it is a known issue, I'll be sending out a PR shortly. |
Correct me if I am wrong, but I think we accidentally had this issue track two different things -- the BOM issue that Rajkumar just fixed, and the original issue that CTI found, and I opened the bug for -- that we don't provide any good feedback if there are json syntax errors. Reopening to keep tracking the original issue. |
You're totally right. Sorry about that. |
Note: I've started looking at #556, and have found that the example project also ends up failing calls to JSON.parse() due to trailing commas. |
Project.json support is deprecated. I don't think we need to fix this. |
you don't? Because it happens all the time. And for beginners that don't know everything you know, it's really hard and frustrating to try and solve this issue, sets you back for a long time while you try to figure out on your own what is happening. |
Steps to reproduce
Expected behavior
Since apparently the CLI ignores the trailing ',' in the project.json file, the C# extension should ignore it to and generate launch.json and tasks.json. Or if that is really hard to do, maybe an error indicating the problem.
Actual behavior
Only tasks.json is generated
The text was updated successfully, but these errors were encountered: