Add sourcelink patch to workaround MSBuild cache issue (#16187)
This commit is contained in:
parent
98313ce301
commit
6a2a8c2798
1 changed files with 31 additions and 0 deletions
|
@ -0,0 +1,31 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: tmat <tomas.matousek@microsoft.com>
|
||||
Date: Fri, 21 Apr 2023 09:02:35 -0700
|
||||
Subject: [PATCH] Workaround for msbuild cache issue
|
||||
|
||||
Backport: https://github.com/dotnet/sourcelink/pull/1008
|
||||
---
|
||||
src/Microsoft.Build.Tasks.Git/RepositoryTask.cs | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/Microsoft.Build.Tasks.Git/RepositoryTask.cs b/src/Microsoft.Build.Tasks.Git/RepositoryTask.cs
|
||||
index 9647abf..ef838b5 100644
|
||||
--- a/src/Microsoft.Build.Tasks.Git/RepositoryTask.cs
|
||||
+++ b/src/Microsoft.Build.Tasks.Git/RepositoryTask.cs
|
||||
@@ -147,7 +147,15 @@ private string GetCacheKey(string repositoryId)
|
||||
|
||||
private bool TryGetCachedRepositoryInstance(string cacheKey, bool requireCached, [NotNullWhen(true)]out GitRepository? repository)
|
||||
{
|
||||
- var entry = (StrongBox<GitRepository?>)BuildEngine4.GetRegisteredTaskObject(cacheKey, RegisteredTaskObjectLifetime.Build);
|
||||
+ StrongBox<GitRepository?>? entry;
|
||||
+ try
|
||||
+ {
|
||||
+ entry = (StrongBox<GitRepository?>?)BuildEngine4.GetRegisteredTaskObject(cacheKey, RegisteredTaskObjectLifetime.Build);
|
||||
+ }
|
||||
+ catch (InvalidCastException) // workaround for https://github.com/dotnet/msbuild/issues/8478
|
||||
+ {
|
||||
+ entry = null;
|
||||
+ }
|
||||
|
||||
if (entry != null)
|
||||
{
|
Loading…
Add table
Reference in a new issue