diff --git a/src/Build.UnitTests/BackEnd/TypeForwarding_Tests.cs b/src/Build.UnitTests/BackEnd/TypeForwarding_Tests.cs new file mode 100644 index 00000000000..88a83589b3d --- /dev/null +++ b/src/Build.UnitTests/BackEnd/TypeForwarding_Tests.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Microsoft.Build.Execution; +using Shouldly; +using Xunit; + +namespace Microsoft.Build.Engine.UnitTests.BackEnd +{ + public class TypeForwarding_Tests + { + [Theory] + [InlineData("Microsoft.Build.Internal.Handshake")] + [InlineData("Microsoft.Build.Internal.HandshakeComponents")] + [InlineData("Microsoft.Build.Internal.HandshakeOptions")] + [InlineData("Microsoft.Build.Internal.HandshakeStatus")] + [InlineData("Microsoft.Build.Internal.ServerNodeHandshake")] + [InlineData("Microsoft.Build.BackEnd.INodePacket")] + [InlineData("Microsoft.Build.BackEnd.NodePacketType")] + [InlineData("Microsoft.Build.BackEnd.NodePacketTypeExtensions")] + [InlineData("Microsoft.Build.Internal.CommunicationsUtilities")] + [InlineData("Microsoft.Build.Shared.XMakeAttributes")] + [InlineData("Microsoft.Build.Shared.XMakeElements")] + public void BuildAssemblyContainsExpectedTypeForwarders(string typeName) + { + GetForwardedTypeNames().ShouldContain(typeName); + } + + private static HashSet GetForwardedTypeNames() + => typeof(BuildManager).Assembly + .GetForwardedTypes() + .Select(type => type.FullName!) + .ToHashSet(StringComparer.Ordinal); + } +} diff --git a/src/Build/AssemblyInfo.cs b/src/Build/AssemblyInfo.cs index e273b398f06..7d15bd05726 100644 --- a/src/Build/AssemblyInfo.cs +++ b/src/Build/AssemblyInfo.cs @@ -41,3 +41,14 @@ [assembly: Dependency("BuildXL.Processes", LoadHint.Sometimes)] [assembly: TypeForwardedTo(typeof(Microsoft.Build.Execution.BuildRequestDataFlags))] +[assembly: TypeForwardedTo(typeof(Microsoft.Build.Internal.Handshake))] +[assembly: TypeForwardedTo(typeof(Microsoft.Build.Internal.HandshakeComponents))] +[assembly: TypeForwardedTo(typeof(Microsoft.Build.Internal.HandshakeOptions))] +[assembly: TypeForwardedTo(typeof(Microsoft.Build.Internal.HandshakeStatus))] +[assembly: TypeForwardedTo(typeof(Microsoft.Build.Internal.ServerNodeHandshake))] +[assembly: TypeForwardedTo(typeof(Microsoft.Build.BackEnd.INodePacket))] +[assembly: TypeForwardedTo(typeof(Microsoft.Build.BackEnd.NodePacketType))] +[assembly: TypeForwardedTo(typeof(Microsoft.Build.BackEnd.NodePacketTypeExtensions))] +[assembly: TypeForwardedTo(typeof(Microsoft.Build.Internal.CommunicationsUtilities))] +[assembly: TypeForwardedTo(typeof(Microsoft.Build.Shared.XMakeAttributes))] +[assembly: TypeForwardedTo(typeof(Microsoft.Build.Shared.XMakeElements))]