Skip to content

Commit f2c1486

Browse files
Copilotrkttu
andcommitted
Add netcoredbg replacement script and update workflow
Co-authored-by: rkttu <[email protected]>
1 parent b7b93be commit f2c1486

File tree

5 files changed

+164
-4
lines changed

5 files changed

+164
-4
lines changed

.github/workflows/build-and-release.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ jobs:
102102
jq '.publisher = "dotnetdev-kr-custom"' package.json > package.tmp.json
103103
mv package.tmp.json package.json
104104
105+
- name: Replace vsdbg with netcoredbg
106+
run: |
107+
node replace-debugger.js upstream/package.json
108+
105109
- name: Modify README.md
106110
run: |
107111
cd upstream
@@ -111,11 +115,13 @@ jobs:
111115
> This is a custom build of the official Microsoft C# extension for Visual Studio Code.
112116
>
113117
> - **Original Source**: [dotnet/vscode-csharp](https://github.com/dotnet/vscode-csharp)
114-
> - **Build Repository**: [rkttu/vscode-csharp-autobuild](https://github.com/rkttu/vscode-csharp-autobuild)
118+
> - **Build Repository**: [rkttu/vscode-csharp-autobuild](https://github.com/rktru/vscode-csharp-autobuild)
115119
> - **Publisher**: dotnetdev-kr-custom
116120
> - **Version**: ${{ needs.check-changes.outputs.latest_tag }}
121+
> - **Debugger**: [Samsung/netcoredbg](https://github.com/Samsung/netcoredbg) (instead of vsdbg)
117122
>
118123
> This build is automatically generated and published to OpenVSX for use in VS Code forks that don't have access to the Microsoft marketplace.
124+
> The debugger has been replaced with Samsung's netcoredbg to ensure compatibility with all VS Code forks.
119125
>
120126
> ---
121127
EOF

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Upstream repository directory (used only in GitHub Actions)
22
upstream/
3+
temp-upstream/
34

45
# Node.js dependencies
56
node_modules/

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,24 @@ Unlike the C# Dev Kit, this project provides automatic builds that do not fall u
2121
- 🆓 Free from Microsoft commercial licensing restrictions
2222
- 🚀 Regular releases available through GitHub
2323
- ⏰ Automated monitoring every 6 hours for new upstream releases
24+
- 🔧 Uses [Samsung/netcoredbg](https://github.com/Samsung/netcoredbg) instead of vsdbg for VS Code fork compatibility
2425

2526
## How It Works
2627

2728
This project automatically monitors the upstream [dotnet/vscode-csharp](https://github.com/dotnet/vscode-csharp) repository for new tags every 6 hours. When a new tag is detected, the automated build process is triggered, which:
2829

2930
1. 🔍 **Scans for new tags** - Checks the upstream repository tag list every 6 hours
3031
2. 🏗️ **Triggers automatic build** - Initiates build process when new tags are found
31-
3. 📦 **Generates VSIX packages** - Creates both main and platform-specific packages
32-
4. 🚀 **Publishes releases** - Makes the built packages available through GitHub releases
32+
3. 🔄 **Replaces debugger** - Substitutes vsdbg with Samsung/netcoredbg for better compatibility
33+
4. 📦 **Generates VSIX packages** - Creates both main and platform-specific packages
34+
5. 🚀 **Publishes releases** - Makes the built packages available through GitHub releases
3335

3436
This ensures that new versions of the C# extension are available shortly after they are released upstream, typically within 6 hours of the original release.
3537

38+
## Debugger Configuration
39+
40+
This build uses [Samsung/netcoredbg](https://github.com/Samsung/netcoredbg) instead of Microsoft's vsdbg. This change ensures compatibility with VS Code forks (like VSCodium, Code - OSS, etc.) that don't have access to Microsoft's proprietary debugger. NetCoreDbg is a fully open-source .NET debugger that supports the same debugging features and protocols.
41+
3642
## Installation
3743

3844
To install the extension, follow these steps in order:
@@ -77,4 +83,5 @@ This project is primarily automated. If you encounter issues with the builds, pl
7783
## Related Projects
7884

7985
- [dotnet/vscode-csharp](https://github.com/dotnet/vscode-csharp) - Original upstream repository
86+
- [Samsung/netcoredbg](https://github.com/Samsung/netcoredbg) - Open-source .NET debugger used in this build
8087
- [Microsoft C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit) - Official Microsoft C# extension (commercial license)

replace-debugger.js

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* This script replaces vsdbg debugger dependencies with Samsung/netcoredbg
5+
* in the package.json of the upstream vscode-csharp extension.
6+
*
7+
* This is necessary because vsdbg cannot be used with VS Code forks
8+
* that don't have access to the Microsoft marketplace.
9+
*/
10+
11+
const fs = require('fs');
12+
const path = require('path');
13+
14+
const NETCOREDBG_VERSION = '3.1.2-1054';
15+
const NETCOREDBG_BASE_URL = `https://github.com/Samsung/netcoredbg/releases/download/${NETCOREDBG_VERSION}`;
16+
17+
// Mapping from upstream platforms/architectures to netcoredbg download files
18+
const platformMapping = {
19+
// Windows x64 (used for both x86_64 and arm64 on Windows as netcoredbg doesn't have separate ARM64 build for Windows)
20+
'win32-x86_64': {
21+
url: `${NETCOREDBG_BASE_URL}/netcoredbg-win64.zip`,
22+
testPath: './.debugger/x86_64/netcoredbg.exe',
23+
binaries: ['./netcoredbg.exe']
24+
},
25+
// Windows ARM64 - use the same x64 build
26+
'win32-arm64': {
27+
url: `${NETCOREDBG_BASE_URL}/netcoredbg-win64.zip`,
28+
testPath: './.debugger/arm64/netcoredbg.exe',
29+
binaries: ['./netcoredbg.exe']
30+
},
31+
// macOS x64
32+
'darwin-x86_64': {
33+
url: `${NETCOREDBG_BASE_URL}/netcoredbg-osx-amd64.tar.gz`,
34+
testPath: './.debugger/x86_64/netcoredbg',
35+
binaries: ['./netcoredbg']
36+
},
37+
// macOS ARM64 - use the same x64 build (Rosetta 2)
38+
'darwin-arm64': {
39+
url: `${NETCOREDBG_BASE_URL}/netcoredbg-osx-amd64.tar.gz`,
40+
testPath: './.debugger/arm64/netcoredbg',
41+
binaries: ['./netcoredbg']
42+
},
43+
// Linux x64
44+
'linux-x86_64': {
45+
url: `${NETCOREDBG_BASE_URL}/netcoredbg-linux-amd64.tar.gz`,
46+
testPath: './.debugger/netcoredbg',
47+
binaries: ['./netcoredbg']
48+
},
49+
// Linux ARM64
50+
'linux-arm64': {
51+
url: `${NETCOREDBG_BASE_URL}/netcoredbg-linux-arm64.tar.gz`,
52+
testPath: './.debugger/netcoredbg',
53+
binaries: ['./netcoredbg']
54+
},
55+
// Linux musl x64 - use standard linux build
56+
'linux-musl-x86_64': {
57+
url: `${NETCOREDBG_BASE_URL}/netcoredbg-linux-amd64.tar.gz`,
58+
testPath: './.debugger/netcoredbg',
59+
binaries: ['./netcoredbg']
60+
},
61+
// Linux musl ARM64 - use standard linux ARM64 build
62+
'linux-musl-arm64': {
63+
url: `${NETCOREDBG_BASE_URL}/netcoredbg-linux-arm64.tar.gz`,
64+
testPath: './.debugger/netcoredbg',
65+
binaries: ['./netcoredbg']
66+
},
67+
// Linux ARM - use ARM64 build (most compatible option)
68+
'linux-arm': {
69+
url: `${NETCOREDBG_BASE_URL}/netcoredbg-linux-arm64.tar.gz`,
70+
testPath: './.debugger/netcoredbg',
71+
binaries: ['./netcoredbg']
72+
}
73+
};
74+
75+
function replaceDebugger(packageJsonPath) {
76+
console.log('Reading package.json...');
77+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
78+
79+
if (!packageJson.runtimeDependencies) {
80+
console.error('Error: runtimeDependencies not found in package.json');
81+
process.exit(1);
82+
}
83+
84+
console.log('Replacing vsdbg debugger dependencies with netcoredbg...');
85+
86+
// Find and replace debugger dependencies
87+
packageJson.runtimeDependencies = packageJson.runtimeDependencies.map(dep => {
88+
if (dep.id !== 'Debugger') {
89+
return dep;
90+
}
91+
92+
// Build platform key
93+
const platform = dep.platforms[0];
94+
const arch = dep.architectures[0];
95+
const platformKey = `${platform}-${arch}`;
96+
97+
console.log(` Processing: ${platform}/${arch}`);
98+
99+
if (!platformMapping[platformKey]) {
100+
console.warn(` Warning: No mapping found for ${platformKey}, keeping original`);
101+
return dep;
102+
}
103+
104+
const mapping = platformMapping[platformKey];
105+
106+
// Create new dependency with netcoredbg
107+
const newDep = {
108+
id: 'Debugger',
109+
description: dep.description.replace('vsdbg', 'netcoredbg').replace('.NET Core Debugger', 'Samsung NetCoreDbg Debugger'),
110+
url: mapping.url,
111+
installPath: dep.installPath,
112+
platforms: dep.platforms,
113+
architectures: dep.architectures,
114+
installTestPath: mapping.testPath
115+
};
116+
117+
// Add binaries array for non-Windows platforms
118+
if (mapping.binaries && mapping.binaries.length > 0) {
119+
newDep.binaries = mapping.binaries;
120+
}
121+
122+
console.log(` Replaced with: ${mapping.url}`);
123+
124+
// Note: We're removing the integrity field as the hashes will be different
125+
// The extension should still work without integrity checks
126+
127+
return newDep;
128+
});
129+
130+
console.log('Writing updated package.json...');
131+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
132+
console.log('✓ Successfully replaced debugger dependencies with netcoredbg');
133+
}
134+
135+
// Main execution
136+
if (require.main === module) {
137+
const packageJsonPath = process.argv[2] || path.join(__dirname, 'upstream', 'package.json');
138+
139+
if (!fs.existsSync(packageJsonPath)) {
140+
console.error(`Error: package.json not found at ${packageJsonPath}`);
141+
process.exit(1);
142+
}
143+
144+
replaceDebugger(packageJsonPath);
145+
}
146+
147+
module.exports = { replaceDebugger };

temp-upstream

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)