GitHub Issue: _copyMsixPackageLocal fails on Windows 11 25H2 — exit code 9, process dies < 1s
Repository: tradesdontlie/tradingview-mcp v1.0.0
Environment
OS: Windows 11 25H2 (Build 10.0.26200)
Node.js: v24.16.0
TradingView Desktop: 3.3.0.7992 (MSIX / Windows Store)
Package full name: TradingView.Desktop_3.3.0.7992_x64__n534cwy3pjxzj
What happens
Both code paths in launch() fail:
Path 1 — direct WindowsApps launch (spawn from C:\Program Files\WindowsApps...\TradingView.exe):
Process exits immediately with exit code 9 within < 1 second. _spawnFailedEarly catches this within the 1500ms grace window.
Note: cmd.exe start "" (ShellExecute) DOES launch TV successfully from the same path, but --remote-debugging-port=9222 is silently stripped by the MSIX activation broker — CDP never binds. This is a separate known issue.
Path 2 — local copy fallback (_copyMsixPackageLocal → %LOCALAPPDATA%\tradingview-mcp...\TradingView.exe):
Copy completes with all 116/116 files present. But spawning the local copy also exits with exit code 9 within < 1 second:
// Exact reproduction of _spawnDetached:
const {spawn} = require('child_process');
const c = spawn(localExe, ['--remote-debugging-port=9222'], {detached:true, stdio:'ignore'});
c.on('exit', (code) => console.log('EXIT code=' + code)); // → EXIT code=9
Root cause hypothesis
Exit code 9 on Windows 11 25H2 appears to be TradingView's Electron main process calling GetCurrentPackageId() (or similar MSIX identity API) at startup. When the call fails — either because the exe was invoked via direct CreateProcess (bypassing the MSIX activation broker) or because it's running outside WindowsApps\ with no registered package identity — TV exits immediately with code 9.
This is a regression in newer Windows 11 builds where Electron apps explicitly validate package identity even when run from a local copy. The local copy approach relies on the assumption that running outside WindowsApps\ skips the identity check — that is no longer true on 25H2.
Key distinction: cmd.exe start "" uses ShellExecuteEx which routes MSIX apps through the activation broker (TV runs, no crash) — but Node.js spawn / PowerShell Start-Process use CreateProcess directly, bypassing the broker (TV exits code 9).
Suggested fix / investigation
In _spawnDetached, try passing shell: true for the WindowsApps path — this routes through cmd.exe start, which uses ShellExecute and activates the MSIX broker. It still won't pass --remote-debugging-port, but it narrows the problem.
For the local copy path: Windows has an undocumented SetCurrentPackagePath() API (or MSIX_DEBUGGER_LAUNCHING env var) that can fake package identity — worth investigating whether this lets the local copy start.
Alternatively, document that MSIX TV Desktop on Windows 11 22H2+ may not work and suggest the Chrome browser workaround (chrome.exe --remote-debugging-port=9222 --user-data-dir= https://tradingview.com/chart/).
Diagnostic commands to reproduce
1. Confirm MSIX install
Get-AppxPackage -Name "TradingView.Desktop" | Select-Object Version, PackageFullName
2. Confirm local copy exists with all files
$d = "$env:LOCALAPPDATA\tradingview-mcp\TradingView.Desktop_3.3.0.7992_x64__n534cwy3pjxzj"
(Get-ChildItem $d -Recurse -File).Count # → 116
3. Reproduce the exit code 9
node -e "
const {spawn}=require('child_process');
const c=spawn('$d\TradingView.exe',['--remote-debugging-port=9222'],{detached:true,stdio:'ignore'});
c.on('exit',code=>console.log('EXIT code='+code));
"
Output: EXIT code=9
GitHub Issue: _copyMsixPackageLocal fails on Windows 11 25H2 — exit code 9, process dies < 1s
Repository: tradesdontlie/tradingview-mcp v1.0.0
Environment
OS: Windows 11 25H2 (Build 10.0.26200)
Node.js: v24.16.0
TradingView Desktop: 3.3.0.7992 (MSIX / Windows Store)
Package full name: TradingView.Desktop_3.3.0.7992_x64__n534cwy3pjxzj
What happens
Both code paths in launch() fail:
Path 1 — direct WindowsApps launch (spawn from C:\Program Files\WindowsApps...\TradingView.exe):
Process exits immediately with exit code 9 within < 1 second. _spawnFailedEarly catches this within the 1500ms grace window.
Note: cmd.exe start "" (ShellExecute) DOES launch TV successfully from the same path, but --remote-debugging-port=9222 is silently stripped by the MSIX activation broker — CDP never binds. This is a separate known issue.
Path 2 — local copy fallback (_copyMsixPackageLocal → %LOCALAPPDATA%\tradingview-mcp...\TradingView.exe):
Copy completes with all 116/116 files present. But spawning the local copy also exits with exit code 9 within < 1 second:
// Exact reproduction of _spawnDetached:
const {spawn} = require('child_process');
const c = spawn(localExe, ['--remote-debugging-port=9222'], {detached:true, stdio:'ignore'});
c.on('exit', (code) => console.log('EXIT code=' + code)); // → EXIT code=9
Root cause hypothesis
Exit code 9 on Windows 11 25H2 appears to be TradingView's Electron main process calling GetCurrentPackageId() (or similar MSIX identity API) at startup. When the call fails — either because the exe was invoked via direct CreateProcess (bypassing the MSIX activation broker) or because it's running outside WindowsApps\ with no registered package identity — TV exits immediately with code 9.
This is a regression in newer Windows 11 builds where Electron apps explicitly validate package identity even when run from a local copy. The local copy approach relies on the assumption that running outside WindowsApps\ skips the identity check — that is no longer true on 25H2.
Key distinction: cmd.exe start "" uses ShellExecuteEx which routes MSIX apps through the activation broker (TV runs, no crash) — but Node.js spawn / PowerShell Start-Process use CreateProcess directly, bypassing the broker (TV exits code 9).
Suggested fix / investigation
In _spawnDetached, try passing shell: true for the WindowsApps path — this routes through cmd.exe start, which uses ShellExecute and activates the MSIX broker. It still won't pass --remote-debugging-port, but it narrows the problem.
For the local copy path: Windows has an undocumented SetCurrentPackagePath() API (or MSIX_DEBUGGER_LAUNCHING env var) that can fake package identity — worth investigating whether this lets the local copy start.
Alternatively, document that MSIX TV Desktop on Windows 11 22H2+ may not work and suggest the Chrome browser workaround (chrome.exe --remote-debugging-port=9222 --user-data-dir= https://tradingview.com/chart/).
Diagnostic commands to reproduce
1. Confirm MSIX install
Get-AppxPackage -Name "TradingView.Desktop" | Select-Object Version, PackageFullName
2. Confirm local copy exists with all files
$d = "$env:LOCALAPPDATA\tradingview-mcp\TradingView.Desktop_3.3.0.7992_x64__n534cwy3pjxzj"
(Get-ChildItem $d -Recurse -File).Count # → 116
3. Reproduce the exit code 9
node -e "
const {spawn}=require('child_process');
const c=spawn('$d\TradingView.exe',['--remote-debugging-port=9222'],{detached:true,stdio:'ignore'});
c.on('exit',code=>console.log('EXIT code='+code));
"
Output: EXIT code=9