Open andrew-woosnam opened 2 years ago
Could also try these arguments to that msbuild
command:
/p:DebugSymbols=true
/p:DebugType=full
/p:ExcludeGeneratedDebugSymbol=false
msbuild command is working (more or less; the process is passing with exit code 0 but I don't think it's putting the "publish" folder in the right spot & idk if it's properly including PDBs or not...), but pushing https://github.com/SteeltoeOSS/Samples/tree/2.x/Configuration/src/AspDotNet4/Simple for remote debugging is still failing:
2022-04-04T16:41:04.57-0400 [APP/PROC/WEB/0] ERR '.\Simple' is not recognized as an internal or external command,
^ This is despite correcting the start command to use --server.urls
instead of urls
ASP.NET 4 apps don't include a webserver and aren't directly runnable (that's why the command isn't recognized), so they'll need to use the HWC buildpack, but shouldn't need the command specified. That Simple
sample isn't actually completely set for Cloud Foundry. Try either SimpleCloudFoundry or this management sample
Ah ok, yeah that makes sense -- I don't see an executable for Simple
in the publish directory created by msbuild like I'm used to seeing for .net core apps published via dotnet publish
.
Trying again with the https://github.com/SteeltoeOSS/Samples/tree/2.x/Management/src/AspDotNet4/CloudFoundryWeb (<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
):
hwc_buildpack
(remote debug command uses the presence of "System.Web" in the csproj file as the indicator for whether or not to use the hwc buildpack for the push)hwc.exe
"vsdbg.exe
on the app running in TASW, but all the breakpoints (which are hit during local debugging) report that symbols have not been loaded :(
<- (E) {"seq":3,"type":"event","event":"output","body":{"category":"console","output":"-------------------------------------------------------------------\nYou may only use the Microsoft .NET Core Debugger (vsdbg) with\nVisual Studio Code, Visual Studio or Visual Studio for Mac software\nto help you develop and test your applications.\n-------------------------------------------------------------------\n","severity":"ok"}}
-------------------------------------------------------------------
You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
<- (R) {"seq":5,"type":"response","request_seq":2,"success":true,"command":"attach"}
-> (C) {"type":"response","request_seq":2,"success":true,"command":"handshake","body":{"signature":"316I/qB6wuYpXvPrcZYtwYsBudll0rPErpLTQxzLeQ3Opg="},"seq":3}
<- (E) {"seq":8,"type":"event","event":"initialized","body":{}}
-> (C) {"type":"request","command":"setDebuggerProperty","arguments":{"AllowOutOfProcessSymbols":1},"seq":4}
<- (R) {"seq":11,"type":"response","request_seq":4,"success":true,"command":"setDebuggerProperty","body":{}}
-> (C) {"type":"request","command":"setDebuggerProperty","arguments":{"DisableJITOptimization":0},"seq":5}
<- (R) {"seq":14,"type":"response","request_seq":5,"success":true,"command":"setDebuggerProperty","body":{}}
-> (C) {"type":"request","command":"setDebuggerProperty","arguments":{"EnableFastEvaluate":1},"seq":6}
<- (R) {"seq":17,"type":"response","request_seq":6,"success":true,"command":"setDebuggerProperty","body":{}}
-> (C) {"type":"request","command":"setDebuggerProperty","arguments":{"InterpreterOptions":1},"seq":7}
<- (R) {"seq":20,"type":"response","request_seq":7,"success":true,"command":"setDebuggerProperty","body":{}}
-> (C) {"type":"request","command":"setDebuggerProperty","arguments":{"JustMyCodeStepping":1},"seq":8}
<- (R) {"seq":23,"type":"response","request_seq":8,"success":true,"command":"setDebuggerProperty","body":{}}
-> (C) {"type":"request","command":"setDebuggerProperty","arguments":{"Native.LoadExports":0},"seq":9}
<- (R) {"seq":26,"type":"response","request_seq":9,"success":true,"command":"setDebuggerProperty","body":{}}
-> (C) {"type":"request","command":"setDebuggerProperty","arguments":{"StopOnExceptionCrossingManagedBoundary":0},"seq":10}
<- (R) {"seq":29,"type":"response","request_seq":10,"success":true,"command":"setDebuggerProperty","body":{}}
-> (C) {"type":"request","command":"setDebuggerProperty","arguments":{"WarnIfNoUserCodeOnLaunch":1},"seq":11}
<- (R) {"seq":32,"type":"response","request_seq":11,"success":true,"command":"setDebuggerProperty","body":{}}
-> (C) {"type":"request","command":"setDebuggerProperty","arguments":{"EnableStepFiltering":true},"seq":12}
<- (R) {"seq":35,"type":"response","request_seq":12,"success":true,"command":"setDebuggerProperty","body":{}}
-> (C) {"type":"request","command":"setSymbolOptions","arguments":{"symbolOptions":{"cachePath":"","moduleFilter":{"mode":"loadAllButExcluded","excludedModules":[""]}}},"seq":13}
<- (R) {"seq":38,"type":"response","request_seq":13,"success":true,"command":"setSymbolOptions"}
-> (C) {"type":"request","command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"seq":14}
<- (R) {"seq":41,"type":"response","request_seq":14,"success":true,"command":"setFunctionBreakpoints","body":{"breakpoints":[]}}
-> (C) {"type":"request","command":"setBreakpoints","arguments":{"source":{"path":"c:\\Users\\awoosnam\\source\\repos\\Samples\\Management\\src\\AspDotNet4\\CloudFoundryWeb\\Controllers\\HomeController.cs","sources":[],"checksums":[{"algorithm":"MD5","checksum":"2e4c33acc1511c74b6c5acab51dcd187"},{"algorithm":"MD5","checksum":"52916d057480a3c3f00d802677288e6e"},{"algorithm":"SHA1","checksum":"595b96f35603583a2b84a4849f8cad4f1e063162"},{"algorithm":"SHA1","checksum":"20e4cb6110a378b61119ef59e004c6feb75d6e9f"},{"algorithm":"SHA256","checksum":"6ebcbeb7c95517570c8c0d827a30837bb5ad8b3fdef609a357f85af1ab56e111"},{"algorithm":"SHA256","checksum":"07e38326169f503c5d67a6a9773c5b06c52e0b8d1a2adcfb31d4db6d378f66f5"}]},"breakpoints":[{"line":19,"column":9,"vsLanguageId":"{3f5162f8-07c6-11d3-9053-00c04fa302a1}"},{"line":13,"column":9,"vsLanguageId":"{3f5162f8-07c6-11d3-9053-00c04fa302a1}"}],"lines":[19,13]},"seq":15}
<- (R) {"seq":44,"type":"response","request_seq":15,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":1,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts."},{"id":2,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts."}]}}
-> (C) {"type":"request","command":"setBreakpoints","arguments":{"source":{"path":"c:\\Users\\awoosnam\\source\\repos\\Samples\\Management\\src\\AspDotNet4\\CloudFoundryWeb\\Controllers\\ValuesController.cs","sources":[],"checksums":[{"algorithm":"MD5","checksum":"13540b76f1488ff28adaa4b2498ab041"},{"algorithm":"MD5","checksum":"76e12f5a6b436aacc56f6d2374aec1d2"},{"algorithm":"SHA1","checksum":"96cf41953815e100286629e7ffb66d5db404fade"},{"algorithm":"SHA1","checksum":"bde4c003b40b7fe68893ccbd92438e0f59885324"},{"algorithm":"SHA256","checksum":"99aab705e69cd79399d3c0b80793d02f439b5b9534f036ebade719994e888ba6"},{"algorithm":"SHA256","checksum":"68d6faa9225e56dc0b8689b0084724555fed29634adb3ddd0f47b4058d92726d"}]},"breakpoints":[{"line":14,"column":9,"vsLanguageId":"{3f5162f8-07c6-11d3-9053-00c04fa302a1}"},{"line":20,"column":9,"vsLanguageId":"{3f5162f8-07c6-11d3-9053-00c04fa302a1}"},{"line":26,"column":9,"vsLanguageId":"{3f5162f8-07c6-11d3-9053-00c04fa302a1}"},{"line":31,"column":9,"vsLanguageId":"{3f5162f8-07c6-11d3-9053-00c04fa302a1}"},{"line":36,"column":9,"vsLanguageId":"{3f5162f8-07c6-11d3-9053-00c04fa302a1}"}],"lines":[14,20,26,31,36]},"seq":16}
<- (R) {"seq":47,"type":"response","request_seq":16,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":3,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts."},{"id":4,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts."},{"id":5,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts."},{"id":6,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts."},{"id":7,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts."}]}}
-> (C) {"type":"request","command":"setExceptionBreakpoints","arguments":{"filters":[],"exceptionOptions":[{"breakMode":"userUnhandled","path":[{"names":["CLR"]}]},{"breakMode":"unhandled","path":[{"names":["CLR"]},{"names":["System.AppDomainUnloadedException","System.Threading.ThreadAbortException"]}]},{"breakMode":"always","path":[{"names":["CLR"]},{"names":["System.Windows.Markup.XamlParseException","System.Reflection.MissingMetadataException","System.Reflection.MissingRuntimeArtifactException","System.NullReferenceException","Microsoft.UI.Xaml.Markup.XamlParseException"]}]},{"breakMode":"unhandled","path":[{"names":["MDA"]}]},{"breakMode":"always","path":[{"names":["MDA"]},{"names":["CallbackOnCollectedDelegate","ContextSwitchDeadlock","DateTimeInvalidLocalFormat","DisconnectedContext","FatalExecutionEngineError","InvalidFunctionPointerInDelegate","InvalidMemberDeclaration","InvalidVariant","LoaderLock","NonComVisibleBaseClass","PInvokeStackImbalance","RaceOnRCWCleanup","Reentrancy"]}]}]},"seq":17}
<- (R) {"seq":50,"type":"response","request_seq":17,"success":true,"command":"setExceptionBreakpoints"}
-> (C) {"type":"request","command":"configurationDone","arguments":{},"seq":18}
<- (E) {"seq":53,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/vsdbg/ProcessCreate","data":{"VS.Diagnostics.Debugger.vsdbg.OSFamily":"Windows","VS.Diagnostics.Debugger.vsdbg.Version":"17.0.10712.2 commit:70a83505117741ba30f92c713a4bb0d0395c3197","VS.Diagnostics.Debugger.vsdbg.WindowsVersion":"10.0.17763"}}}
<- (E) {"seq":55,"type":"event","event":"telemetryDetails","body":{"telemetryEventName":"vs/diagnostics/debugger/process/context","telemetryProperties":{"VS.Diagnostics.Debugger.AD7Process.Architecture":"AMD64"}}}
<- (E) {"seq":57,"type":"event","event":"process","body":{"name":"C:\\Users\\vcap\\app\\.cloudfoundry\\hwc.exe","systemProcessId":8056,"startMethod":"attach","pointerSize":64}}
<- (E) {"seq":59,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/vsdbg/Attach","data":{"VS.Diagnostics.Debugger.vsdbg.OSFamily":"Windows","VS.Diagnostics.Debugger.vsdbg.Version":"17.0.10712.2 commit:70a83505117741ba30f92c713a4bb0d0395c3197","VS.Diagnostics.Debugger.vsdbg.VisualizerFileUsed":false,"VS.Diagnostics.Debugger.vsdbg.WindowsVersion":"10.0.17763","VS.Diagnostics.Debugger.vsdbg.TargetType":"Live","VS.Diagnostics.Debugger.vsdbg.AdapterId":"coreclr","VS.Diagnostics.Debugger.vsdbg.SourceFileMappings":0,"VS.Diagnostics.Debugger.vsdbg.Attach.Duration":360}}}
<- (R) {"seq":61,"type":"response","request_seq":18,"success":true,"command":"configurationDone"}
<- (E) {"seq":63,"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":1,"verified":false,"message":"No symbols have been loaded for this document."}}}
<- (E) {"seq":65,"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":2,"verified":false,"message":"No symbols have been loaded for this document."}}}
<- (E) {"seq":67,"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":3,"verified":false,"message":"No symbols have been loaded for this document."}}}
<- (E) {"seq":69,"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":4,"verified":false,"message":"No symbols have been loaded for this document."}}}
<- (E) {"seq":71,"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":5,"verified":false,"message":"No symbols have been loaded for this document."}}}
<- (E) {"seq":73,"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":6,"verified":false,"message":"No symbols have been loaded for this document."}}}
<- (E) {"seq":75,"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":7,"verified":false,"message":"No symbols have been loaded for this document."}}}
Noticed that the MSBuild publish does produce PDB files in the publish/bin
folder:
^ That's with this command:
"C:\Users\awoosnam\source\repos\Samples\Management\src\AspDotNet4\CloudFoundryWeb\CloudFoundryWeb.csproj" /p:DeployOnBuild=true /p:PublishUrl="C:\Users\awoosnam\source\repos\Samples\Management\src\AspDotNet4\CloudFoundryWeb\publish" /p:WebPublishMethod=FileSystem /p:DeployDefaultTarget=WebPublish /p:DebugSymbols=true
Adding 2 additional flags (/p:DebugType=full
and /p:ExcludeGeneratedDebugSymbol=false
) doesn't help the remote debugging process stop at breakpoints, nor does it do anything noticeable to the PDB files in publish/bin
Things to try next:
msvsmon.exe
(from the local VS installation; mentioned in these docs) in place of vsdbg
-- maybe that'll work better?I was just able to successfully bind to a local hwc.exe
process following the steps explained here, so that leads me to believe HWC itself isn't the issue.
Notably, I bound to the running process via the "Attach to Process" window in my local VS, which is a different flow than the one this vsix uses to attach the remote debugger:
Tried copying msvsmon.exe
from C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Remote Debugger\x64
to publish\
folder for this app before deploying it to longbeach. Confirmed that msvsmon.exe
was present on the VM before attempting to launch debugger with this config:
{
"version": "0.2.0",
"adapter": "c:\\users\\awoosnam\\appdata\\local\\microsoft\\visualstudio\\17.0_a4444530exp\\extensions\\vmware tanzu .net experience\\tanzu toolkit for visual studio 2022\\1.0.0\\Resources\\cf7.exe",
"adapterArgs": "ssh CloudFoundryWeb -c \u0022c:\\Users\\vcap\\app\\msvsmon.exe --interpreter=vscode\u0022",
"languageMappings": {
"C#": {
"languageId": "3F5162F8-07C6-11D3-9053-00C04FA302A1",
"extensions": [
"*"
]
}
},
"exceptionCategoryMappings": {
"CLR": "449EC4CC-30D2-4032-9256-EE18EB41B62B",
"MDA": "6ECE07A9-0EDE-45C4-8296-818D8FC401D4"
},
"configurations": [
{
"name": ".NET Core Launch",
"type": "coreclr",
"processName": "hwc.exe",
"request": "attach",
"justMyCode": false,
"cwd": "/home/vcap/app",
"logging": {
"engineLogging": true
}
}
]
}
Result:
Same result when attempted without the extra "--interpreter" arg:
{
"version": "0.2.0",
"adapter": "c:\\users\\awoosnam\\appdata\\local\\microsoft\\visualstudio\\17.0_a4444530exp\\extensions\\vmware tanzu .net experience\\tanzu toolkit for visual studio 2022\\1.0.0\\Resources\\cf7.exe",
"adapterArgs": "ssh CloudFoundryWeb -c \"c:\\Users\\vcap\\app\\msvsmon.exe\"",
"languageMappings": {
"C#": {
"languageId": "3F5162F8-07C6-11D3-9053-00C04FA302A1",
"extensions": [
"*"
]
}
},
"exceptionCategoryMappings": {
"CLR": "449EC4CC-30D2-4032-9256-EE18EB41B62B",
"MDA": "6ECE07A9-0EDE-45C4-8296-818D8FC401D4"
},
"configurations": [
{
"name": ".NET Core Launch",
"type": "coreclr",
"processName": "hwc.exe",
"request": "attach",
"justMyCode": false,
"cwd": "/home/vcap/app/vsdbg",
"logging": {
"engineLogging": true
}
}
]
}
Result (Debug Adapter Host Log after same modal as above):
1> DebugAdapterHost version: 17.0.60104.1 commit:29d87ee38ccdbf780a0ea7b0c5d48fe162e35437
1> Starting 'c:\users\awoosnam\appdata\local\microsoft\visualstudio\17.0_a4444530exp\extensions\vmware tanzu .net experience\tanzu toolkit for visual studio 2022\1.0.0\Resources\cf7.exe' with arguments 'ssh CloudFoundryWeb -c "c:\Users\vcap\app\msvsmon.exe"'
1> [DebugAdapter] --> C (initialize-1): {"type":"request","command":"initialize","arguments":{"pathFormat":"path","clientID":"visualstudio","clientName":"Visual Studio","adapterID":"coreclr","locale":"en-US","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsRunInTerminalRequest":true,"supportsMemoryReferences":true,"supportsProgressReporting":true,"SupportsMessageBox":true,"supportsHandshakeRequest":true,"supportsVsAdditionalBreakpointBinds":true,"supportsHitCountsChange":true,"supportsVsCustomMessages":true,"supportsVariableEnumerators":true},"seq":1}
1> WARNING: Request 'initialize-1' has not received a response within 1000 ms!
1> ERROR: Debug adapter error output: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
1> Debug adapter process exited.
1> ERROR: Debug Adapter did not respond to initial requests.
1> ERROR: Unexpected error
AggregateException: One or more errors occurred.
Aggregate exception:
DebugAdapterLaunchException: Failed to launch debug adapter. Additional information may be available in the output window.
Failure Location: UserCanceled
Inner Exception:
OperationCanceledException: The operation was canceled.
Inner Exception:
DebugAdapterLaunchException: Failed to launch debug adapter. Additional information may be available in the output window.
Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Engine.Implementation.DebuggedProcess.<StartDebugAdapter>b__114_3(Exception ex)
Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.<>c__DisplayClass11_0`1.<Catch>b__0(TException ex)
Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.<>c__DisplayClass10_0`1.<Catch>b__0(AggregateException ex)
Failure Location: UserCanceled
Inner Exception:
OperationCanceledException: The operation was canceled.
1> ERROR: One or more errors occurred.
Failed to launch debug adapter. Additional information may be available in the output window.
The operation was canceled.
I see the same line of output as included in those logs above when trying to execute msvsmon.exe
while ssh'd into the app via cf cli:
The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
Including the entire contents of C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Remote Debugger\x64
(msvsmon.exe
+ all other dlls, config files, etc) got the process to start on the VM from within Visual Studio (verified via tasklist
through cf cli ssh), but breakpoints are still not being hit
Debug Adapter Host Log:
1> DebugAdapterHost version: 17.0.60104.1 commit:29d87ee38ccdbf780a0ea7b0c5d48fe162e35437
1> Starting 'c:\users\awoosnam\appdata\local\microsoft\visualstudio\17.0_a4444530exp\extensions\vmware tanzu .net experience\tanzu toolkit for visual studio 2022\1.0.0\Resources\cf7.exe' with arguments 'ssh CloudFoundryWeb -c "c:\Users\vcap\app\remotedebugger\msvsmon.exe"'
1> [DebugAdapter] --> C (initialize-1): {"type":"request","command":"initialize","arguments":{"pathFormat":"path","clientID":"visualstudio","clientName":"Visual Studio","adapterID":"coreclr","locale":"en-US","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsRunInTerminalRequest":true,"supportsMemoryReferences":true,"supportsProgressReporting":true,"SupportsMessageBox":true,"supportsHandshakeRequest":true,"supportsVsAdditionalBreakpointBinds":true,"supportsHitCountsChange":true,"supportsVsCustomMessages":true,"supportsVariableEnumerators":true},"seq":1}
1> WARNING: Request 'initialize-1' has not received a response within 1000 ms!
Just learned that only "Portable PDBs" are supported for remote debugging (at least with the method I'm using) -- wondering if this isn't working for this older .net472 app because the PDBs that get generated when MSBuild publishes the app aren't "portable"?
UPDATE: ^ That may only be true for debugging apps running on a linux/OSX remote? This blurb says:
Windows PDBs can only be written or read on Windows. All Windows tooling supports them, except for Visual Studio Code (as Visual Studio Code strives for consistent behavior across all platforms), and scenarios where Visual Studio is debugging to a remote Linux/OSX computer (as the PDBs must be read on the remote computer).
Also of note: even when remote debugging apps running on windows, portable PDBs may not work if the app is old enough (i.e. targets anything earlier than (or equal to??) 4.7.2)
Portable PDBs can be read on any operating system, but there are a number of places where they aren't supported yet. Here are a few –
- Older versions of the Visual Studio debugger (versions before VS 2015 Update 2).
- Applications targeting .NET Framework 4.7.1 or earlier1: printing stack traces with mappings back to line numbers (such as in an ASP.NET error page). The name of methods is unaffected, only the source file names and line numbers are unsupported.
- C# Code analysis (aka FxCop), note that this doesn't apply to Roslyn Analyzer.
- Some symbol servers (ex: SymbolSource.org does not, nuget.org does)
- Running post-compilation build step that consumes or modifies the PDB using older versions of tools such as CCI, CodeContracts.
- Using .NET decompilers such as ILDASM or .NET Reflector and expecting to see source line mappings or local parameter names.
- MS DIA-based tools such as WinDBG.
Over time we plan to shrink this list of non-supported scenarios so that portable PDB can become the default choice for most usage needs.
- When running on .NET Framework 4.7.2 with an app that targets earlier .NET Framework versions we anticipate having an opt-in configuration switch as an additional mechanism to enable support for older applications↩
This section implies that the /p:DebugType=full
flag for MSBuild specifies that PDBs should be generated in the "old" windows-only style (as opposed to the "new" portable style)
Could these symbols not be loading because the HWC buildpack isn't starting the app in debug mode?? (no evidence for this; just a thought)
Same results after retargeting .net4.8 -- debugger attaches but break points are not hit (for both vsdbg & msvsmon)
One person on stack overflow mentioned that there's something important about the path to PDB files?
This article mentions that vsdbg
"supports CoreCLR debugging on Linux and macOS"
Dave found that when locally debugging an ASP.NET app running in a windows container, this was the start command Docker used:
docker run -dt -v "C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Remote Debugger:c:\remote_debugger:ro" -v "C:\workspace\WebApplication12\WebApplication12:c:\inetpub\wwwroot" -e "DEV_ENVIRONMENT=1" -e "VBCSCOMPILER_TTL=604800" -e "COMPLUS_ForceENC=1" -P --name WebApplication12 --entrypoint cmd webapplication12:dev /c "start /B C:\ServiceMonitor.exe w3svc & C:\remote_debugger\x64\msvsmon.exe /noauth /anyuser /silent /nostatus /noclrwarn /nosecuritywarn /nofirewallwarn /nowowwarn /fallbackloadremotemanagedpdbs /timeout:2147483646"
Of note:
msvsmon.exe
(volume mounted from the local VS installation)
msvsmon.exe
for my local VS 2022 installation into the publish
folder generated by MSBuild before the app gets cf push
'dmsvsmon.exe
is invoked with a bunch of args: msvsmon.exe /noauth /anyuser /silent /nostatus /noclrwarn /nosecuritywarn /nofirewallwarn /nowowwarn /fallbackloadremotemanagedpdbs /timeout:2147483646
DEV_ENVIRONMENT=1
VBCSCOMPILER_TTL=604800
COMPLUS_ForceENC=1
cf ssh
-- result is the same: adapter connects VS to debugger but breakpoints not hitLatest logs from debug adapter host:
1> DebugAdapterHost version: 17.0.60104.1 commit:29d87ee38ccdbf780a0ea7b0c5d48fe162e35437
1> Starting 'c:\users\awoosnam\appdata\local\microsoft\visualstudio\17.0_a4444530exp\extensions\vmware tanzu .net experience\tanzu toolkit for visual studio 2022\1.0.0\Resources\cf7.exe' with arguments 'ssh CloudFoundryWeb -c "c:\Users\vcap\app\remotedebugger\msvsmon.exe /noauth /anyuser /silent /nostatus /noclrwarn /nosecuritywarn /nofirewallwarn /nowowwarn /fallbackloadremotemanagedpdbs /timeout:2147483646"'
1> [DebugAdapter] --> C (initialize-1): {"type":"request","command":"initialize","arguments":{"pathFormat":"path","clientID":"visualstudio","clientName":"Visual Studio","adapterID":"coreclr","locale":"en-US","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsRunInTerminalRequest":true,"supportsMemoryReferences":true,"supportsProgressReporting":true,"SupportsMessageBox":true,"supportsHandshakeRequest":true,"supportsVsAdditionalBreakpointBinds":true,"supportsHitCountsChange":true,"supportsVsCustomMessages":true,"supportsVariableEnumerators":true},"seq":1}
1> WARNING: Request 'initialize-1' has not received a response within 1000 ms!
Noticed that every time I begin debugging via DebugAdapterHost.Launch
using msvsmon.exe
, 2 processes are always created (not sure if that's usual, but vsdbg
only spun up 1 process)
msvsmon
security note:
Leaving msvsmon.exe (the remote debugger monitor) unattended in ‘no authentication’ mode is not safe. As with any debugger, msvsmon.exe can start a process upon a request from the network.
Confirmed that this app is running on an x64 chip & I'm bundling the x64 version of msvsmon.exe
Here are some docs that describe how to remotely debug ASP.NET on a remote IIS server -- at first glance, this process seems way too involved to be easily replicated on our timeline for this extension
Currently, remote debugging only works with "newer" .NET apps (e.g. .NET Core, .NET 5, etc.). This is because
dotnet publish
doesn't work the same for those full-framework apps. MSBuild might be a good alternative for these apps: