You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Launching the VSCode C# debugger after adding ApplicationInsights SDK to my ASP.NET Core application fails.
Environment data
dotnet --info output:
.NET Command Line Tools (2.1.104)
Product Information:
Version: 2.1.104
Commit SHA-1 hash: 48ec687460
Runtime Environment:
OS Name: Windows
OS Version: 10.0.16299
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.104\
Microsoft .NET Core Shared Framework Host
Version : 2.0.6
Build : 74b1c703813c8910df5b96f304b0f2b78cdf194d
VS Code version:
Version 1.21.1
Commit 79b44aa704ce542d8ca4a3cc44cfca566e7720f1
Date 2018-03-14T14:46:47.128Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64
C# Extension version: 1.14.0
Steps to reproduce
Open command window
Create a folder for my app, and enter that folder.
Launching browser (cmd.exe /C start http://localhost:"Development)
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.NodeServices[0]
webpack built f051b69f57976ffe99fa in 4000ms
Microsoft.AspNetCore.NodeServices:Information: webpack built f051b69f57976ffe99fa in 4000ms
The thread 1548 has exited with code 0 (0x0).
The thread 12284 has exited with code 0 (0x0).
Sometimes the "Launching browser" line reads: Launching browser (cmd.exe /C start http://localhost:"true)
and sometimes it reads: Launching browser (cmd.exe /C start http://localhost:"Development)
Note: I can launch the browser manually and navigate to http://localhost:5000, and continue debugging.
Workaround (may need local changes to correct port)
I determined that this line in launch.json is where the problem is manifesting itself:
At this point I noticed that the url is being ‘auto-generated’ to http://localhost:”true, but the console reads Launching browser (cmd.exe /C start http://localhost:5000)
… suggesting that the ‘auto-detect-url’ is failing in VSCode (or in the Omnisharp-csharp extension) for some reason.
I started Fiddler to see if I could sort anything out from this, and that didn’t show anything obvious.
I changed my launch.json section for “launchBrowser” to the following:
Now things are working. This is my current proposed workaround.
Details that might help troubleshoot
The problem seems to rest with VSCode debugging process and not Application Insights (we’ve simply exposed an issue with the ${auto-detect-url} declaration in the launch.json. From reading a few things on the github repo’s for VSCode and for Omnisharp-vscode I understand that the url is being determined by inspecting stdout somehow.
The ApplicationInsights SDK is injecting a telemetry line into the stdout stream prior to the launch of the browser, and that line contains some values related to localhost. This may be getting the stdout parsing confused. Here’s my sample stdout stream that causes the issue, note the 2nd line containing the injected Application Insights telemetry:
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.IO.Compression.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Application Insights Telemetry: {"name":"Microsoft.ApplicationInsights.Dev.e0f750b063854d9b96b94a896793d54e.RemoteDependency","time":"2018-04-11T17:20:00.6540970Z","iKey":"89506ec2-e0cd-4d66-8d52-726ac1cc7237","tags":{"ai.application.ver":"1.0.0.0","ai.cloud.roleInstance":"LAPTOP01","ai.operation.id":"efbeb370-44999dca9b749635","ai.internal.sdkVersion":"rdddsc:2.5.1-195","ai.internal.nodeName":"LAPTOP01"},"data":{"baseType":"RemoteDependencyData","baseData":{"ver":2,"name":"POST /","id":"|efbeb370-44999dca9b749635.","data":"http://localhost:58738","duration":"00:00:02.0372735","resultCode":"200","success":true,"type":"Http","target":"localhost","properties":{"AspNetCoreEnvironment":"Development","DeveloperMode":"true"}}}}
Loaded 'C:\Program Files\dotnet\store\x64\netcoreapp2.0\microsoft.extensions.localization.abstractions\2.0.2\lib\netstandard2.0\Microsoft.Extensions.Localization.Abstractions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\store\x64\netcoreapp2.0\microsoft.aspnetcore.jsonpatch\2.0.0\lib\netstandard2.0\Microsoft.AspNetCore.JsonPatch.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.Collections.Immutable.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\store\x64\netcoreapp2.0\microsoft.extensions.hosting.abstractions\2.0.2\lib\netstandard2.0\Microsoft.Extensions.Hosting.Abstractions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Hosting environment: Development
Content root path: C:\dev\vsts\mycode\TestVsCodeDotNet
Launching browser (cmd.exe /C start http://localhost:"true)
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.NodeServices[0]
webpack built f051b69f57976ffe99fa in 4213ms
Microsoft.AspNetCore.NodeServices:Information: webpack built f051b69f57976ffe99fa in 4213ms
The system cannot find the file http://localhost:true.
Update: removed formatting in stdout log
The text was updated successfully, but these errors were encountered:
This is an issue with the C# extension, so insiders will not change anything. There will be a beta of the C# extension out very soon (today or Monday) that has the fix if you want to verify. The release of 1.15 is also expected pretty soon. So if you aren't in a rush you can just wait for that.
Launching the VSCode C# debugger after adding ApplicationInsights SDK to my ASP.NET Core application fails.
Environment data
dotnet --info
output:VS Code version:
C# Extension version: 1.14.0
Steps to reproduce
Open command window
Create a folder for my app, and enter that folder.
] dotnet new react
] dotnet add nuget
] dotnet sources add -Name "nuget.org" -Source https://api.nuget.org/v3/index.json
] dotnet add .\TestVsCodeDotNet.csproj package Microsoft.ApplicationInsights.AspNetCore
Open VSCode in my new folder.
Using the tasks.json & launch.json that get auto-generated from templates in VSCode, build and launch the debugger by pressing F5.
Expected behavior
Debugging session starts, my browser is opened, and I can see & debug my application.
Actual behavior
Debugging session starts.
Window pops up:
[Window Title]
http://localhost:Development
[Content]
Windows cannot find 'http://localhost:Development'. Make sure you typed the name correctly, and then try again.
[OK]
Console reads:
Sometimes the "Launching browser" line reads:
Launching browser (cmd.exe /C start http://localhost:"true)
and sometimes it reads:
Launching browser (cmd.exe /C start http://localhost:"Development)
Note: I can launch the browser manually and navigate to http://localhost:5000, and continue debugging.
Workaround (may need local changes to correct port)
I determined that this line in launch.json is where the problem is manifesting itself:
At this point I noticed that the url is being ‘auto-generated’ to http://localhost:”true, but the console reads Launching browser (cmd.exe /C start http://localhost:5000)
… suggesting that the ‘auto-detect-url’ is failing in VSCode (or in the Omnisharp-csharp extension) for some reason.
I started Fiddler to see if I could sort anything out from this, and that didn’t show anything obvious.
I changed my launch.json section for “launchBrowser” to the following:
Now things are working. This is my current proposed workaround.
Details that might help troubleshoot
The problem seems to rest with VSCode debugging process and not Application Insights (we’ve simply exposed an issue with the ${auto-detect-url} declaration in the launch.json. From reading a few things on the github repo’s for VSCode and for Omnisharp-vscode I understand that the url is being determined by inspecting stdout somehow.
The ApplicationInsights SDK is injecting a telemetry line into the stdout stream prior to the launch of the browser, and that line contains some values related to localhost. This may be getting the stdout parsing confused. Here’s my sample stdout stream that causes the issue, note the 2nd line containing the injected Application Insights telemetry:
The text was updated successfully, but these errors were encountered: