Remove unused patches

These patch files are never applied. Remove them from repo.
This commit is contained in:
Omair Majid 2022-07-26 15:17:18 -04:00
parent 3fe21304d3
commit d73e0787eb
18 changed files with 0 additions and 897 deletions

View File

@ -1,36 +0,0 @@
Index: a/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj
===================================================================
--- a/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj
+++ b/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj
@@ -5,6 +5,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
Index: a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj
===================================================================
--- a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj
+++ b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj
@@ -9,6 +9,7 @@
<ToolCommandName>dotnet-swaggergen</ToolCommandName>
<SignAssembly>false</SignAssembly>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
Index: a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj
===================================================================
--- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj
+++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj
@@ -11,6 +11,7 @@
<VersionPrefix>2.5.1</VersionPrefix>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<RollForward>Major</RollForward>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>

View File

@ -1,27 +0,0 @@
From 7a752928ed3588246c4b296feb6cf4946f1b29b7 Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Thu, 9 Sep 2021 12:11:39 -0400
Subject: [PATCH] [ArPow] Use --work-tree with git apply
This makes things work better in a source-tarball build, where there may
be a .git directory but it's for a different repo than command-line-api.
---
eng/SourceBuild.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props
index 6cc85018..5e223747 100644
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -15,7 +15,7 @@
</ItemGroup>
<Exec
- Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
+ Command="git --work-tree=&quot;$(RepoRoot)&quot; apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(RepoRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>
--
2.31.1

View File

@ -1,21 +0,0 @@
--- a/tests/benchmarks/MicroPerf/MicroPerf.fsproj
+++ b/tests/benchmarks/MicroPerf/MicroPerf.fsproj
@@ -9,6 +9,7 @@
<OtherFlags>$(OtherFlags) --nowarn:57</OtherFlags>
<OtherFlags>$(OtherFlags) --langversion:preview</OtherFlags>
<OtherFlags>$(OtherFlags) --define:PREVIEW</OtherFlags>
+ <UseAppHost>false</UseAppHost>
<!-- By default this project will compile with the proto compiler -->
<!-- Uncommenting this will build with a previous installed compiler -->
<!--
--- a/tests/benchmarks/TaskPerf/TaskPerf.fsproj
+++ b/tests/benchmarks/TaskPerf/TaskPerf.fsproj
@@ -4,6 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
+ <UseAppHost>false</UseAppHost>
<!-- Turn off "This function is for use by compiled F# code and should not be used directly" -->
<OtherFlags>$(OtherFlags) --nowarn:1204</OtherFlags>
<!-- Turn off "Experimental" -->

View File

@ -1,11 +0,0 @@
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -15,7 +15,7 @@
</ItemGroup>
<Exec
- Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
+ Command="git --work-tree=&quot;$(RepoRoot)&quot; apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(RepoRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>

View File

@ -1,23 +0,0 @@
From 892222071f73062f969f4f6ed1df8f759b9327b7 Mon Sep 17 00:00:00 2001
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Wed, 3 Nov 2021 15:12:59 +0100
Subject: [PATCH] GetRuntimeInformation.targets: determine
PortableProductMonikerRid based on HostOSName and Architecture.
---
src/redist/targets/GetRuntimeInformation.targets | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/redist/targets/GetRuntimeInformation.targets b/src/redist/targets/GetRuntimeInformation.targets
index 5133c3a3841..01f704c7d8e 100644
--- a/src/redist/targets/GetRuntimeInformation.targets
+++ b/src/redist/targets/GetRuntimeInformation.targets
@@ -28,6 +28,8 @@
'$(Rid)' == 'linux-musl-x64' ">$(Rid)</ProductMonikerRid>
<ProductMonikerRid Condition=" '$(ProductMonikerRid)' == '' ">$(OSName)-$(Architecture)</ProductMonikerRid>
+ <PortableProductMonikerRid Condition=" '$(PortableProductMonikerRid)' == '' ">$(HostOSName)-$(Architecture)</PortableProductMonikerRid>
+
<ArtifactNameSdk>dotnet-sdk-internal$(PgoTerm)</ArtifactNameSdk>
<ArtifactNameCombinedHostHostFxrFrameworkSdk>dotnet-sdk$(PgoTerm)</ArtifactNameCombinedHostHostFxrFrameworkSdk>

View File

@ -1,46 +0,0 @@
--- a/src/Build/Definition/ProjectCollection.cs
+++ b/src/Build/Definition/ProjectCollection.cs
@@ -1754,7 +1754,11 @@ namespace Microsoft.Build.Evaluation
#if FEATURE_WIN32_REGISTRY
ToolsetRegistryReader registryReader = null,
#endif
+#if FEATURE_SYSTEM_CONFIGURATION
ToolsetConfigurationReader configReader = null
+#else
+ object configReader = null
+#endif
)
{
_toolsets = new Dictionary<string, Toolset>(StringComparer.OrdinalIgnoreCase);
--- a/src/Build/Definition/ToolsetReader.cs
+++ b/src/Build/Definition/ToolsetReader.cs
@@ -101,7 +101,11 @@ namespace Microsoft.Build.Evaluation
#if FEATURE_WIN32_REGISTRY
ToolsetRegistryReader registryReader,
#endif
+#if FEATURE_SYSTEM_CONFIGURATION
ToolsetConfigurationReader configurationReader,
+#else
+ object _configurationReader,
+#endif
PropertyDictionary<ProjectPropertyInstance> environmentProperties,
PropertyDictionary<ProjectPropertyInstance> globalProperties,
ToolsetDefinitionLocations locations
@@ -120,6 +124,7 @@ namespace Microsoft.Build.Evaluation
if ((locations & ToolsetDefinitionLocations.ConfigurationFile) == ToolsetDefinitionLocations.ConfigurationFile)
{
+#if FEATURE_SYSTEM_CONFIGURATION
if (configurationReader == null)
{
configurationReader = new ToolsetConfigurationReader(environmentProperties, globalProperties);
@@ -129,6 +134,9 @@ namespace Microsoft.Build.Evaluation
defaultToolsVersionFromConfiguration = configurationReader.ReadToolsets(toolsets, globalProperties,
initialProperties, true /* accumulate properties */, out overrideTasksPathFromConfiguration,
out defaultOverrideToolsVersionFromConfiguration);
+#else
+ throw new InvalidOperationException("ToolsetDefinitionLocations.ConfigurationFile not supported");
+#endif
}
string defaultToolsVersionFromRegistry = null;

View File

@ -1,12 +0,0 @@
--- a/src/Shared/ExceptionHandling.cs
+++ b/src/Shared/ExceptionHandling.cs
@@ -153,7 +153,9 @@ namespace Microsoft.Build.Shared
internal static bool IsXmlException(Exception e)
{
return e is XmlException
+#if FEATURE_SECURITY_PERMISSIONS
|| e is XmlSyntaxException
+#endif
|| e is XmlSchemaException
|| e is UriFormatException; // XmlTextReader for example uses this under the covers
}

View File

@ -1,453 +0,0 @@
Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs
===================================================================
--- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs
+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs
@@ -31,5 +31,24 @@ namespace Roslyn.Utilities
}
}
}
+ /// <summary>
+ /// Are we running on .NET 5 or later using the Mono runtime?
+ /// Will also return true when running on Mono itself; if necessary
+ /// we can use IsRunningOnMono to distinguish.
+ /// </summary>
+ public static bool IsUsingMonoRuntime
+ {
+ get
+ {
+ try
+ {
+ return !(Type.GetType("Mono.RuntimeStructs", throwOnError: false) is null);
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
}
}
Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs
===================================================================
--- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs
+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs
@@ -79,7 +79,7 @@ namespace Microsoft.CodeAnalysis.Compile
// to connect. When it fails it should fall back to in-proc
// compilation.
bool holdsMutex;
- using (var serverMutex = new Mutex(initiallyOwned: true,
+ using (var serverMutex = BuildServerConnection.OpenOrCreateMutex(
name: BuildServerConnection.GetServerMutexName(_pipeName),
createdNew: out holdsMutex))
{
Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs
===================================================================
--- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs
+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs
@@ -103,7 +103,7 @@ class Hello
var mutexName = BuildServerConnection.GetServerMutexName(pipeName);
bool holdsMutex;
- using (var mutex = new Mutex(initiallyOwned: true,
+ using (var mutex = BuildServerConnection.OpenOrCreateMutex(
name: mutexName,
createdNew: out holdsMutex))
{
@@ -119,7 +119,7 @@ class Hello
}
finally
{
- mutex.ReleaseMutex();
+ mutex.Dispose();
}
}
}
Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs
===================================================================
--- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs
+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs
@@ -304,7 +304,7 @@ End Module")
var newTempDir = _tempDirectory.CreateDirectory(new string('a', 100 - _tempDirectory.Path.Length));
await ApplyEnvironmentVariables(
new[] { new KeyValuePair<string, string>("TMPDIR", newTempDir.Path) },
- async () =>
+ async () => await Task.Run(async () =>
{
using var serverData = await ServerUtil.CreateServer(_logger);
var result = RunCommandLineCompiler(
@@ -317,7 +317,7 @@ End Module")
var listener = await serverData.Complete();
Assert.Equal(CompletionData.RequestCompleted, listener.CompletionDataList.Single());
- });
+ }));
}
[Fact]
Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs
===================================================================
--- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs
+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs
@@ -101,7 +101,7 @@ namespace Microsoft.CodeAnalysis.Compile
var thread = new Thread(() =>
{
- using (var mutex = new Mutex(initiallyOwned: true, name: mutexName, createdNew: out created))
+ using (var mutex = BuildServerConnection.OpenOrCreateMutex(name: mutexName, createdNew: out created))
using (var stream = NamedPipeUtil.CreateServer(pipeName))
{
readyMre.Set();
@@ -112,7 +112,7 @@ namespace Microsoft.CodeAnalysis.Compile
stream.Close();
doneMre.WaitOne();
- mutex.ReleaseMutex();
+ mutex.Dispose();
}
});
@@ -153,7 +153,7 @@ namespace Microsoft.CodeAnalysis.Compile
{
using (var stream = NamedPipeUtil.CreateServer(pipeName))
{
- var mutex = new Mutex(initiallyOwned: true, name: mutexName, createdNew: out created);
+ var mutex = BuildServerConnection.OpenOrCreateMutex(name: mutexName, createdNew: out created);
readyMre.Set();
stream.WaitForConnection();
@@ -161,7 +161,6 @@ namespace Microsoft.CodeAnalysis.Compile
// Client is waiting for a response. Close the mutex now. Then close the connection
// so the client gets an error.
- mutex.ReleaseMutex();
mutex.Dispose();
stream.Close();
Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Shared/BuildServerConnection.cs
===================================================================
--- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Shared/BuildServerConnection.cs
+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Shared/BuildServerConnection.cs
@@ -543,19 +543,10 @@ namespace Microsoft.CodeAnalysis.Command
{
try
{
- if (PlatformInformation.IsRunningOnMono)
+ if (PlatformInformation.IsUsingMonoRuntime)
{
- IServerMutex? mutex = null;
- bool createdNew = false;
- try
- {
- mutex = new ServerFileMutexPair(mutexName, false, out createdNew);
- return !createdNew;
- }
- finally
- {
- mutex?.Dispose();
- }
+ using var mutex = new ServerFileMutex(mutexName);
+ return !mutex.CouldLock();
}
else
{
@@ -572,9 +563,11 @@ namespace Microsoft.CodeAnalysis.Command
internal static IServerMutex OpenOrCreateMutex(string name, out bool createdNew)
{
- if (PlatformInformation.IsRunningOnMono)
+ if (PlatformInformation.IsUsingMonoRuntime)
{
- return new ServerFileMutexPair(name, initiallyOwned: true, out createdNew);
+ var mutex = new ServerFileMutex(name);
+ createdNew = mutex.TryLock(0);
+ return mutex;
}
else
{
@@ -648,19 +641,22 @@ namespace Microsoft.CodeAnalysis.Command
}
/// <summary>
- /// An interprocess mutex abstraction based on OS advisory locking (FileStream.Lock/Unlock).
+ /// An interprocess mutex abstraction based on file sharing permission (FileShare.None).
/// If multiple processes running as the same user create FileMutex instances with the same name,
/// those instances will all point to the same file somewhere in a selected temporary directory.
- /// The TryLock method can be used to attempt to acquire the mutex, with Unlock or Dispose used to release.
+ /// The TryLock method can be used to attempt to acquire the mutex, with Dispose used to release.
+ /// The CouldLock method can be used to check whether an attempt to acquire the mutex would have
+ /// succeeded at the current time, without actually acquiring it.
/// Unlike Win32 named mutexes, there is no mechanism for detecting an abandoned mutex. The file
/// will simply revert to being unlocked but remain where it is.
/// </summary>
- internal sealed class FileMutex : IDisposable
+ internal sealed class ServerFileMutex : IServerMutex
{
- public readonly FileStream Stream;
+ public FileStream? Stream;
public readonly string FilePath;
+ public readonly string GuardPath;
- public bool IsLocked { get; private set; }
+ public bool IsDisposed { get; private set; }
internal static string GetMutexDirectory()
{
@@ -670,61 +666,176 @@ namespace Microsoft.CodeAnalysis.Command
return result;
}
- public FileMutex(string name)
+ public ServerFileMutex(string name)
{
- FilePath = Path.Combine(GetMutexDirectory(), name);
- Stream = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
+ var mutexDirectory = GetMutexDirectory();
+ FilePath = Path.Combine(mutexDirectory, name);
+ GuardPath = Path.Combine(mutexDirectory, ".guard");
}
- public bool TryLock(int timeoutMs)
+ /// <summary>
+ /// Acquire the guard by opening the guard file with FileShare.None. The guard must only ever
+ /// be held for very brief amounts of time, so we can simply spin until it is acquired. The
+ /// guard must be released by disposing the FileStream returned from this routine. Note the
+ /// guard file is never deleted; this is a leak, but only of a single file.
+ /// </summary>
+ internal FileStream LockGuard()
{
- if (IsLocked)
- throw new InvalidOperationException("Lock already held");
-
- var sw = Stopwatch.StartNew();
- do
+ // We should be able to acquire the guard quickly. Limit the number of retries anyway
+ // by some arbitrary bound to avoid getting hung up in a possibly infinite loop.
+ for (var i = 0; i < 100; i++)
{
try
{
- Stream.Lock(0, 0);
- IsLocked = true;
- return true;
+ return new FileStream(GuardPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
}
catch (IOException)
{
- // Lock currently held by someone else.
+ // Guard currently held by someone else.
// We want to sleep for a short period of time to ensure that other processes
// have an opportunity to finish their work and relinquish the lock.
// Spinning here (via Yield) would work but risks creating a priority
// inversion if the lock is held by a lower-priority process.
Thread.Sleep(1);
}
+ }
+ // Handle unexpected failure to acquire guard as error.
+ throw new InvalidOperationException("Unable to acquire guard");
+ }
+
+ /// <summary>
+ /// Attempt to acquire the lock by opening the lock file with FileShare.None. Sets "Stream"
+ /// and returns true if successful, returns false if the lock is already held by another
+ /// thread or process. Guard must be held when calling this routine.
+ /// </summary>
+ internal bool TryLockFile()
+ {
+ Debug.Assert(Stream is null);
+ FileStream? stream = null;
+ try
+ {
+ stream = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
+ // On some targets, the file locking used to implement FileShare.None may not be
+ // atomic with opening/creating the file. This creates a race window when another
+ // thread holds the lock and is just about to unlock: we may be able to open the
+ // file here, then the other thread unlocks and deletes the file, and then we
+ // acquire the lock on our file handle - but the actual file is already deleted.
+ // To close this race, we verify that the file does in fact still exist now that
+ // we have successfull acquired the locked FileStream. (Note that this check is
+ // safe because we cannot race with an other attempt to create the file since we
+ // hold the guard, and after the FileStream constructor returned we can no race
+ // with file deletion because we hold the lock.)
+ if (!File.Exists(FilePath))
+ {
+ // To simplify the logic, we treat this case as "unable to acquire the lock"
+ // because it we caught another process while it owned the lock and was just
+ // giving it up. If the caller retries, we'll likely acquire the lock then.
+ stream.Dispose();
+ return false;
+ }
+ }
+ catch (Exception)
+ {
+ stream?.Dispose();
+ return false;
+ }
+ Stream = stream;
+ return true;
+ }
+
+ /// <summary>
+ /// Release the lock by deleting the lock file and disposing "Stream".
+ /// </summary>
+ internal void UnlockFile()
+ {
+ Debug.Assert(Stream is not null);
+ try
+ {
+ // Delete the lock file while the stream is not yet disposed
+ // and we therefore still hold the FileShare.None exclusion.
+ // There may still be a race with another thread attempting a
+ // TryLockFile in parallel, but that is safely handled there.
+ File.Delete(FilePath);
+ }
+ finally
+ {
+ Stream.Dispose();
+ Stream = null;
+ }
+ }
+
+ public bool TryLock(int timeoutMs)
+ {
+ if (IsDisposed)
+ throw new ObjectDisposedException("Mutex");
+ if (Stream is not null)
+ throw new InvalidOperationException("Lock already held");
+
+ var sw = Stopwatch.StartNew();
+ do
+ {
+ try
+ {
+ // Attempt to acquire lock while holding guard.
+ using var guard = LockGuard();
+ if (TryLockFile())
+ return true;
+ }
catch (Exception)
{
- // Something else went wrong.
return false;
}
+
+ // See comment in LockGuard.
+ Thread.Sleep(1);
} while (sw.ElapsedMilliseconds < timeoutMs);
return false;
}
- public void Unlock()
+ public bool CouldLock()
{
- if (!IsLocked)
- return;
- Stream.Unlock(0, 0);
- IsLocked = false;
+ if (IsDisposed)
+ return false;
+ if (Stream is not null)
+ return false;
+
+ try
+ {
+ // Attempt to acquire lock while holding guard, and if successful
+ // immediately unlock again while still holding guard. This ensures
+ // no other thread will spuriously observe the lock as held due to
+ // the lock attempt here.
+ using var guard = LockGuard();
+ if (TryLockFile())
+ {
+ UnlockFile();
+ return true;
+ }
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+
+ return false;
}
public void Dispose()
{
- var wasLocked = IsLocked;
- if (wasLocked)
- Unlock();
- Stream.Dispose();
- // We do not delete the lock file here because there is no reliable way to perform a
- // 'delete if no one has the file open' operation atomically on *nix. This is a leak.
+ if (IsDisposed)
+ return;
+ IsDisposed = true;
+ if (Stream is not null)
+ {
+ try
+ {
+ UnlockFile();
+ }
+ catch (Exception)
+ {
+ }
+ }
}
}
@@ -792,56 +903,4 @@ namespace Microsoft.CodeAnalysis.Command
}
}
}
-
- /// <summary>
- /// Approximates a named mutex with 'locked', 'unlocked' and 'abandoned' states.
- /// There is no reliable way to detect whether a mutex has been abandoned on some target platforms,
- /// so we use the AliveMutex to manually track whether the creator of a mutex is still running,
- /// while the HeldMutex represents the actual lock state of the mutex.
- /// </summary>
- internal sealed class ServerFileMutexPair : IServerMutex
- {
- public readonly FileMutex AliveMutex;
- public readonly FileMutex HeldMutex;
-
- public bool IsDisposed { get; private set; }
-
- public ServerFileMutexPair(string mutexName, bool initiallyOwned, out bool createdNew)
- {
- AliveMutex = new FileMutex(mutexName + "-alive");
- HeldMutex = new FileMutex(mutexName + "-held");
- createdNew = AliveMutex.TryLock(0);
- if (initiallyOwned && createdNew)
- {
- if (!TryLock(0))
- throw new Exception("Failed to lock mutex after creating it");
- }
- }
-
- public bool TryLock(int timeoutMs)
- {
- if (IsDisposed)
- throw new ObjectDisposedException("Mutex");
- return HeldMutex.TryLock(timeoutMs);
- }
-
- public void Dispose()
- {
- if (IsDisposed)
- return;
- IsDisposed = true;
-
- try
- {
- HeldMutex.Unlock();
- AliveMutex.Unlock();
- }
- finally
- {
- AliveMutex.Dispose();
- HeldMutex.Dispose();
- }
- }
- }
-
}

View File

@ -1,10 +0,0 @@
--- a/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj
+++ b/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj
@@ -4,6 +4,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<NonShipping>true</NonShipping>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis" Version="$(MicrosoftCodeAnalysisVersion)" />

View File

@ -1,10 +0,0 @@
--- a/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj
+++ b/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj
@@ -5,6 +5,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<!-- The purpose of this project is to include all dependecies of Microsoft.CodeAnalysis.Remote.ServiceHub targeting .Net Core -->
+ <UseAppHost>false</UseAppHost>
<IsShipping>false</IsShipping>
</PropertyGroup>
<ItemGroup>

View File

@ -1,29 +0,0 @@
diff --git a/src/mono/mono.proj b/src/mono/mono.proj
index fb98ffc1896..d6a0c9a8ec2 100644
--- a/src/mono/mono.proj
+++ b/src/mono/mono.proj
@@ -519,17 +519,17 @@
<!-- if all else fails in finding a valid objcopy, fall back to no-prefix from $PATH (used for x64 on CentOS) -->
<_Objcopy Condition="'$(_ObjcopyFound)' != '0'">objcopy</_Objcopy>
</PropertyGroup>
- <ItemGroup>
+ <ItemGroup Condition="'$(KeepNativeSymbols)' != 'true'">
<FilesToStrip Include="$(_MonoRuntimeFilePath)" />
<FilesToStrip Include="$([System.IO.Directory]::GetParent($(_MonoRuntimeFilePath)))\libmono-component-*$(SharedLibExt)" />
<FilesToStrip Include="$([System.IO.Directory]::GetParent($(_MonoRuntimeFilePath)))\Mono*framework\**\Mono*" Exclude="$([System.IO.Directory]::GetParent($(_MonoRuntimeFilePath)))\Mono*framework\**\*.dwarf" />
</ItemGroup>
- <Message Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ($([MSBuild]::IsOSPlatform('OSX')) or $([MSBuild]::IsOSPlatform('Linux')))" Text="Stripping debug symbols from %(FilesToStrip.Identity)" Importance="High"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true')" Command="dsymutil --flat --minimize %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true')" Command="strip -no_code_signature_warning -S %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --only-keep-debug %(FilesToStrip.Identity) %(FilesToStrip.Identity).dbg" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --strip-unneeded %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --add-gnu-debuglink=%(FilesToStrip.Identity).dbg %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Message Condition="'@(FilesToStrip)' != '' and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ($([MSBuild]::IsOSPlatform('OSX')) or $([MSBuild]::IsOSPlatform('Linux')))" Text="Stripping debug symbols from %(FilesToStrip.Identity)" Importance="High"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true')" Command="dsymutil --flat --minimize %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true')" Command="strip -no_code_signature_warning -S %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --only-keep-debug %(FilesToStrip.Identity) %(FilesToStrip.Identity).dbg" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --strip-unneeded %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --add-gnu-debuglink=%(FilesToStrip.Identity).dbg %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
</Target>
<!-- Build AOT cross compiler (if available) -->

View File

@ -1,18 +0,0 @@
diff --git a/eng/native/init-compiler.sh b/eng/native/init-compiler.sh
index 567d18da474..927b3071e92 100755
--- a/eng/native/init-compiler.sh
+++ b/eng/native/init-compiler.sh
@@ -108,11 +108,8 @@
fi
if [[ "$compiler" == "clang" ]]; then
- if command -v "lld$desired_version" > /dev/null; then
- # Only lld version >= 9 can be considered stable
- if [[ "$majorVersion" -ge 9 ]]; then
- LDFLAGS="-fuse-ld=lld"
- fi
+ if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then
+ LDFLAGS="-fuse-ld=lld"
fi
fi

View File

@ -1,84 +0,0 @@
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json
index bf6dfc3c1a1..1de4979b8ee 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json
@@ -3029,6 +3029,38 @@
"any",
"base"
],
+ "fedora.37": [
+ "fedora.37",
+ "fedora",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "fedora.37-arm64": [
+ "fedora.37-arm64",
+ "fedora.37",
+ "fedora-arm64",
+ "fedora",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "fedora.37-x64": [
+ "fedora.37-x64",
+ "fedora.37",
+ "fedora-x64",
+ "fedora",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
"freebsd": [
"freebsd",
"unix",
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
index 2e6ec616b74..70a1582ba64 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
@@ -1146,6 +1146,23 @@
"fedora-x64"
]
},
+ "fedora.37": {
+ "#import": [
+ "fedora"
+ ]
+ },
+ "fedora.37-arm64": {
+ "#import": [
+ "fedora.37",
+ "fedora-arm64"
+ ]
+ },
+ "fedora.37-x64": {
+ "#import": [
+ "fedora.37",
+ "fedora-x64"
+ ]
+ },
"freebsd": {
"#import": [
"unix"
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props
index 1945bb9af0e..75c6d28a30f 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props
@@ -71,7 +71,7 @@
<RuntimeGroup Include="fedora">
<Parent>linux</Parent>
<Architectures>x64;arm64</Architectures>
- <Versions>23;24;25;26;27;28;29;30;31;32;33;34;35;36</Versions>
+ <Versions>23;24;25;26;27;28;29;30;31;32;33;34;35;36;37</Versions>
<TreatVersionsAsCompatible>false</TreatVersionsAsCompatible>
</RuntimeGroup>

View File

@ -1,33 +0,0 @@
diff --git a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj
index 724b704f864..3dabdc81dae 100644
--- a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj
+++ b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj
@@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
- <ProjectReference Include="$(RepoTasksDir)ILStripTask\ILStrip.csproj" />
+ <ProjectReference Include="$(RepoTasksDir)ILStripTask\ILStrip.csproj" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<ProjectReference Include="$(RepoTasksDir)RuntimeConfigParser\RuntimeConfigParser.csproj" />
<ProjectReference Include="$(RepoTasksDir)JsonToItemsTaskFactory\JsonToItemsTaskFactory.csproj" />
</ItemGroup>
@@ -15,7 +15,7 @@
<PackageFile Include="Sdk\Sdk.props" TargetPath="Sdk" />
<PackageFile Include="Sdk\Sdk.targets" TargetPath="Sdk" />
<PackageFile Include="build\$(MSBuildProjectName).props" TargetPath="build" />
- <PackageFile Include="Sdk\ILStripTask.props" TargetPath="Sdk" />
+ <PackageFile Include="Sdk\ILStripTask.props" TargetPath="Sdk" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<PackageFile Include="Sdk\RuntimeConfigParserTask.props" TargetPath="Sdk" />
<PackageFile Include="Sdk\RuntimeComponentManifest.props" TargetPath="Sdk" />
<PackageFile Include="Sdk\RuntimeComponentManifest.targets" TargetPath="Sdk" />
diff --git a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props
index 8a7ede79242..cfd515eeca9 100644
--- a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props
+++ b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props
@@ -1,5 +1,5 @@
<Project>
- <Import Project="$(MSBuildThisFileDirectory)\ILStripTask.props" />
+ <Import Project="$(MSBuildThisFileDirectory)\ILStripTask.props" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<Import Project="$(MSBuildThisFileDirectory)\RuntimeConfigParserTask.props" />
<Import Project="$(MSBuildThisFileDirectory)\RuntimeComponentManifest.props" />
</Project>

View File

@ -1,22 +0,0 @@
From 499fcf6e3b0e4b01a9c340a06f00cfc3e1fcc5d2 Mon Sep 17 00:00:00 2001
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Tue, 5 Oct 2021 09:04:14 +0200
Subject: [PATCH] Use the portable rid for --use-current-runtime.
---
.../targets/Microsoft.NET.RuntimeIdentifierInference.targets | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
index 17308aa9160..e764b2d9845 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
@@ -62,7 +62,7 @@ Copyright (c) .NET Foundation. All rights reserved.
</PropertyGroup>
<PropertyGroup Condition="'$(UseCurrentRuntimeIdentifier)' == 'true'">
- <RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
+ <RuntimeIdentifier>$(NETCoreSdkPortableRuntimeIdentifier)</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition="'$(PlatformTarget)' == ''">

View File

@ -1,18 +0,0 @@
diff --git a/src/Cli/dotnet/Program.cs b/src/Cli/dotnet/Program.cs
index de1ebb9e6..6bbf479de 100644
--- a/src/Cli/dotnet/Program.cs
+++ b/src/Cli/dotnet/Program.cs
@@ -28,6 +28,13 @@ public class Program
public static int Main(string[] args)
{
+ // opt out of telemetry by default if the env var is unset
+ string telemetryValue = Environment.GetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT");
+ if (String.IsNullOrEmpty(telemetryValue))
+ {
+ Environment.SetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1");
+ }
+
DebugHelper.HandleDebugSwitch(ref args);
// Capture the current timestamp to calculate the host overhead.

View File

@ -1,33 +0,0 @@
From b2c4b2427d8c1a2410c4210789caccf1ec87e64a Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Thu, 9 Sep 2021 13:21:51 -0400
Subject: [PATCH] [ArPow] Use --work-tree with git apply
This makes things work better in a source-tarball build, where there may
be a .git directory somewhere in our parent directories but it's for a
different repo than vstest. In a situation like that a plain `git apply`
will (silently!) ignore patches because they wont apply to the unrelated
repository. That will (eventually) make the source-build fail.
`--work-tree` makes git directly use the directory that we care about.
See https://github.com/dotnet/source-build/issues/2445 for more details.
---
eng/SourceBuild.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props
index b365645c..68f82592 100644
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -24,7 +24,7 @@
</ItemGroup>
<Exec
- Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
+ Command="git --work-tree=&quot;$(InnerSourceBuildRepoRoot)&quot; apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(InnerSourceBuildRepoRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>
--
2.31.1

View File

@ -1,11 +0,0 @@
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -15,7 +15,7 @@
</ItemGroup>
<Exec
- Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
+ Command="git --work-tree=&quot;$(RepoRoot)&quot; apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(RepoRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>