aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/dotnet.ts
diff options
context:
space:
mode:
authorMatt Godbolt <matt@godbolt.org>2022-11-26 10:42:24 -0600
committerGitHub <noreply@github.com>2022-11-26 10:42:24 -0600
commite38d248aeb58b9835a1d67963b85d1eab14b21c5 (patch)
treea2a4bddd2c71860052c775ae65aa6519533d4059 /lib/compilers/dotnet.ts
parent9eac998ed6f0b82462e12dc8677929e4256ea9e3 (diff)
downloadcompiler-explorer-e38d248aeb58b9835a1d67963b85d1eab14b21c5.tar.gz
compiler-explorer-e38d248aeb58b9835a1d67963b85d1eab14b21c5.zip
Fixes for .NET 7 (#4347)gh-5085
- check return code of restore - set env vars to prevent file size blowout
Diffstat (limited to 'lib/compilers/dotnet.ts')
-rw-r--r--lib/compilers/dotnet.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/compilers/dotnet.ts b/lib/compilers/dotnet.ts
index b40ed0fd2..d712b2b76 100644
--- a/lib/compilers/dotnet.ts
+++ b/lib/compilers/dotnet.ts
@@ -125,9 +125,19 @@ class DotNetCompiler extends BaseCompiler {
</configuration>
`;
+ // See https://github.com/dotnet/runtime/issues/50391 - the .NET runtime tries to make a 2TB memfile if we have
+ // this feature enabled (which is on by default on .NET 7) This blows out our nsjail sandbox limit, so for now
+ // we disable it.
+ execOptions.env.DOTNET_EnableWriteXorExecute = '0';
+ // Disable any phone-home.
execOptions.env.DOTNET_CLI_TELEMETRY_OPTOUT = 'true';
- execOptions.env.DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 'true';
+ // Some versions of .NET complain if they can't work out what the user's directory is. We force it to the output
+ // directory here.
+ execOptions.env.DOTNET_CLI_HOME = programDir;
+ // Place nuget packages in the output directory.
execOptions.env.NUGET_PACKAGES = path.join(programDir, '.nuget');
+ // Try to be less chatty
+ execOptions.env.DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 'true';
execOptions.env.DOTNET_NOLOGO = 'true';
execOptions.customCwd = programDir;
@@ -155,7 +165,10 @@ class DotNetCompiler extends BaseCompiler {
}
const restoreOptions = ['restore', '--configfile', nugetConfigPath, '-v', 'q', '--nologo', '/clp:NoSummary'];
- await this.exec(compiler, restoreOptions, execOptions);
+ const restoreResult = await this.exec(compiler, restoreOptions, execOptions);
+ if (restoreResult.code !== 0) {
+ return this.transformToCompilationResult(restoreResult, inputFilename);
+ }
const compilerResult = await super.runCompiler(compiler, this.compilerOptions, inputFilename, execOptions);