Skip to content

Commit e9b99f5

Browse files
authored
Fix ambiguous reference for ExceptionHandling class (#11173)
The latest daily build of the .NET 10 SDK fails to build the msbuild repo due to the following build error: ``` /repos/dotnet/src/msbuild/src/Build/BackEnd/BuildManager/BuildManager.cs(1330,41): error CS0104: 'ExceptionHandling' is an ambiguous reference between 'Microsoft.Build.Shared.ExceptionHandling' and 'System.Runtime.ExceptionServices.ExceptionHandling' [/repos/dotnet/src/msbuild/src/Build/Microsoft.Build.csproj] /repos/dotnet/src/msbuild/src/Build/BackEnd/Components/ProjectCache/ProjectCacheService.cs(875,17): error CS0104: 'ExceptionHandling' is an ambiguous reference between 'Microsoft.Build.Shared.ExceptionHandling' and 'System.Runtime.ExceptionServices.ExceptionHandling' [/repos/dotnet/src/msbuild/src/Build/Microsoft.Build.csproj] /repos/dotnet/src/msbuild/src/Build/BackEnd/BuildManager/BuildManager.cs(1437,57): error CS0104: 'ExceptionHandling' is an ambiguous reference between 'Microsoft.Build.Shared.ExceptionHandling' and 'System.Runtime.ExceptionServices.ExceptionHandling' [/repos/dotnet/src/msbuild/src/Build/Microsoft.Build.csproj] /repos/dotnet/src/msbuild/src/Build/BackEnd/BuildManager/BuildManager.cs(1448,41): error CS0104: 'ExceptionHandling' is an ambiguous reference between 'Microsoft.Build.Shared.ExceptionHandling' and 'System.Runtime.ExceptionServices.ExceptionHandling' [/repos/dotnet/src/msbuild/src/Build/Microsoft.Build.csproj] /repos/dotnet/src/msbuild/src/Build/BackEnd/BuildManager/BuildManager.cs(1584,17): error CS0104: 'ExceptionHandling' is an ambiguous reference between 'Microsoft.Build.Shared.ExceptionHandling' and 'System.Runtime.ExceptionServices.ExceptionHandling' [/repos/dotnet/src/msbuild/src/Build/Microsoft.Build.csproj] /repos/dotnet/src/msbuild/src/Build/BackEnd/BuildManager/BuildManager.cs(1806,49): error CS0104: 'ExceptionHandling' is an ambiguous reference between 'Microsoft.Build.Shared.ExceptionHandling' and 'System.Runtime.ExceptionServices.ExceptionHandling' [/repos/dotnet/src/msbuild/src/Build/Microsoft.Build.csproj] /repos/dotnet/src/msbuild/src/Build/BackEnd/BuildManager/BuildManager.cs(1879,21): error CS0104: 'ExceptionHandling' is an ambiguous reference between 'Microsoft.Build.Shared.ExceptionHandling' and 'System.Runtime.ExceptionServices.ExceptionHandling' [/repos/dotnet/src/msbuild/src/Build/Microsoft.Build.csproj] /repos/dotnet/src/msbuild/src/Build/BackEnd/BuildManager/BuildManager.cs(1879,66): error CS0104: 'ExceptionHandling' is an ambiguous reference between 'Microsoft.Build.Shared.ExceptionHandling' and 'System.Runtime.ExceptionServices.ExceptionHandling' [/repos/dotnet/src/msbuild/src/Build/Microsoft.Build.csproj] /repos/dotnet/src/msbuild/src/Build/BackEnd/BuildManager/BuildManager.cs(2483,44): error CS0104: 'ExceptionHandling' is an ambiguous reference between 'Microsoft.Build.Shared.ExceptionHandling' and 'System.Runtime.ExceptionServices.ExceptionHandling' [/repos/dotnet/src/msbuild/src/Build/Microsoft.Build.csproj] /repos/dotnet/src/msbuild/src/Build/BackEnd/BuildManager/BuildManager.cs(2484,161): error CS0104: 'ExceptionHandling' is an ambiguous reference between 'Microsoft.Build.Shared.ExceptionHandling' and 'System.Runtime.ExceptionServices.ExceptionHandling' [/repos/dotnet/src/msbuild/src/Build/Microsoft.Build.csproj] /repos/dotnet/src/msbuild/src/Build/BackEnd/BuildManager/BuildManager.cs(2493,169): error CS0104: 'ExceptionHandling' is an ambiguous reference between 'Microsoft.Build.Shared.ExceptionHandling' and 'System.Runtime.ExceptionServices.ExceptionHandling' [/repos/dotnet/src/msbuild/src/Build/Microsoft.Build.csproj] /repos/dotnet/src/msbuild/src/Build/BackEnd/BuildManager/BuildManager.cs(2976,41): error CS0104: 'ExceptionHandling' is an ambiguous reference between 'Microsoft.Build.Shared.ExceptionHandling' and 'System.Runtime.ExceptionServices.ExceptionHandling' [/repos/dotnet/src/msbuild/src/Build/Microsoft.Build.csproj] ``` This is due to a conflict in a class name with a new public class from runtime: dotnet/runtime#109806 Fixed by explicitly defining the namespace to use. This was found as part of the work on dotnet/sdk#45435.
2 parents f329cc4 + 91581a6 commit e9b99f5

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/Build/BackEnd/BuildManager/BuildManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
using Microsoft.Build.Shared;
3838
using Microsoft.Build.Shared.Debugging;
3939
using Microsoft.NET.StringTools;
40+
using ExceptionHandling = Microsoft.Build.Shared.ExceptionHandling;
4041
using ForwardingLoggerRecord = Microsoft.Build.Logging.ForwardingLoggerRecord;
4142
using LoggerDescription = Microsoft.Build.Logging.LoggerDescription;
4243

src/Build/BackEnd/Components/ProjectCache/ProjectCacheService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using Microsoft.Build.Graph;
2323
using Microsoft.Build.Internal;
2424
using Microsoft.Build.Shared;
25+
using ExceptionHandling = Microsoft.Build.Shared.ExceptionHandling;
2526

2627
namespace Microsoft.Build.Experimental.ProjectCache
2728
{

0 commit comments

Comments
 (0)