Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e46fc23
Remove calls to `GetTypeInfo()`.
teo-tsirpanis Jul 12, 2025
833f2e1
Remove `Assembly` polyfills and the `FEATURE_ASSEMBLY_LOCATION` direc…
teo-tsirpanis Jul 12, 2025
54d4d89
Remove `FEATURE_CULTUREINFO_GETCULTURES` as always available.
teo-tsirpanis Jul 12, 2025
76029ff
Fix compile errors.
teo-tsirpanis Jul 26, 2025
bb84e0a
Do not create additional ALC to load a well-known assembly.
teo-tsirpanis Jul 27, 2025
efc1a6c
Merge branch 'main' into rm-compat-code
teo-tsirpanis Mar 17, 2026
ee936b4
Merge branch 'main' into rm-compat-code
teo-tsirpanis May 12, 2026
6eeb05e
Address Copilot feedback.
teo-tsirpanis May 12, 2026
6ff4aa9
Use `CurrentMSBuildExePath`.
teo-tsirpanis May 12, 2026
398ad04
Remove `FEATURE_ENVIRONMENT_SYSTEMDIRECTORY` as always available.
teo-tsirpanis May 12, 2026
4d29b14
Remove `FEATURE_LEGACY_GETCURRENTDIRECTORY`; we now target .NET Frame…
teo-tsirpanis May 12, 2026
8df482b
Remove `FEATURE_LEGACY_GETFULLPATH`; we now target .NET Framework 4.7.2.
teo-tsirpanis May 12, 2026
fa73c76
Remove `FEATURE_PIPE_SECURITY` as always available.
teo-tsirpanis May 12, 2026
b8d6fcf
Remove `FEATURE_HTTP_LISTENER` as always available.
teo-tsirpanis May 12, 2026
b0393b4
Merge `FEATURE_HTTP_LISTENER` with `FEATURE_THREAD_ABORT`.
teo-tsirpanis May 12, 2026
9004928
Revert "Remove `FEATURE_LEGACY_GETFULLPATH`; we now target .NET Frame…
teo-tsirpanis May 13, 2026
be12ddf
Revert "Remove `FEATURE_ENVIRONMENT_SYSTEMDIRECTORY` as always availa…
teo-tsirpanis May 13, 2026
9cf6f64
Fix unused using.
teo-tsirpanis May 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,7 @@ private void AssertProjectFileAfterReload(

if (initialProjectFromMemory && reloadProjectFromMemory)
{
Assert.Equal(NativeMethodsShared.GetCurrentDirectory(), rootElement.DirectoryPath);
Assert.Equal(Environment.CurrentDirectory, rootElement.DirectoryPath);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ public void ProjectChangedEvent()
[Fact]
public void ProjectCollectionVersionIsCorrect()
{
Version expectedVersion = new Version(this.GetType().GetTypeInfo().Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version);
Version expectedVersion = new Version(this.GetType().Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version);

ProjectCollection.Version.Major.ShouldBe(expectedVersion.Major);
ProjectCollection.Version.Minor.ShouldBe(expectedVersion.Minor);
Expand Down
10 changes: 2 additions & 8 deletions src/Build.UnitTests/BackEnd/AssemblyTaskFactory_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public void CreatableByTaskFactoryMismatchedIdentity()
public void VerifyGetTaskParameters()
{
TaskPropertyInfo[] propertyInfos = _taskFactory.GetTaskParameters();
LoadedType comparisonType = new LoadedType(typeof(TaskToTestFactories), _loadInfo, typeof(TaskToTestFactories).GetTypeInfo().Assembly, typeof(ITaskItem));
LoadedType comparisonType = new LoadedType(typeof(TaskToTestFactories), _loadInfo, typeof(TaskToTestFactories).Assembly, typeof(ITaskItem));
PropertyInfo[] comparisonInfo = comparisonType.Type.GetProperties(BindingFlags.Instance | BindingFlags.Public);
Assert.Equal(comparisonInfo.Length, propertyInfos.Length);

Expand Down Expand Up @@ -784,13 +784,7 @@ public void VerifySameFactoryCanGenerateDifferentTaskInstances()
private void SetupTaskFactory(TaskHostParameters factoryParameters, bool explicitlyLaunchTaskHost = false, bool isTaskHostFactory = false)
{
_taskFactory = new AssemblyTaskFactory();
#if FEATURE_ASSEMBLY_LOCATION
_loadInfo = AssemblyLoadInfo.Create(null, Assembly.GetAssembly(typeof(TaskToTestFactories)).Location);
#else
_loadInfo = explicitlyLaunchTaskHost || isTaskHostFactory
? AssemblyLoadInfo.Create(assemblyName: null, typeof(TaskToTestFactories).GetTypeInfo().Assembly.Location)
: AssemblyLoadInfo.Create(typeof(TaskToTestFactories).GetTypeInfo().Assembly.FullName, assemblyFile: null);
#endif
_loadInfo = AssemblyLoadInfo.Create(null, typeof(TaskToTestFactories).Assembly.Location);
if (explicitlyLaunchTaskHost)
{
factoryParameters = factoryParameters.WithTaskHostFactoryExplicitlyRequested(true);
Expand Down
63 changes: 12 additions & 51 deletions src/Build.UnitTests/BackEnd/LoggingService_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,7 @@ public void RegisterDistributedLoggerServiceShutdown()
{
_initializedService.ShutdownComponent();
string className = "Microsoft.Build.Logging.ConfigurableForwardingLogger";
#if FEATURE_ASSEMBLY_LOCATION
LoggerDescription description = CreateLoggerDescription(className, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true);
#else
LoggerDescription description = CreateLoggerDescription(className, typeof(ProjectCollection).GetTypeInfo().Assembly.FullName, true);
#endif
LoggerDescription description = CreateLoggerDescription(className, typeof(ProjectCollection).Assembly.FullName, true);
_initializedService.RegisterDistributedLogger(null, description);
});
}
Expand All @@ -347,13 +343,8 @@ public void RegisterGoodDistributedAndCentralLogger()
{
string configurableClassName = "Microsoft.Build.Logging.ConfigurableForwardingLogger";
string distributedClassName = "Microsoft.Build.Logging.DistributedFileLogger";
#if FEATURE_ASSEMBLY_LOCATION
LoggerDescription configurableDescription = CreateLoggerDescription(configurableClassName, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true);
LoggerDescription distributedDescription = CreateLoggerDescription(distributedClassName, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true);
#else
LoggerDescription configurableDescription = CreateLoggerDescription(configurableClassName, typeof(ProjectCollection).GetTypeInfo().Assembly.FullName, true);
LoggerDescription distributedDescription = CreateLoggerDescription(distributedClassName, typeof(ProjectCollection).GetTypeInfo().Assembly.FullName, true);
#endif
LoggerDescription configurableDescription = CreateLoggerDescription(configurableClassName, typeof(ProjectCollection).Assembly.FullName, true);
LoggerDescription distributedDescription = CreateLoggerDescription(distributedClassName, typeof(ProjectCollection).Assembly.FullName, true);

DistributedFileLogger fileLogger = new DistributedFileLogger();
RegularILogger regularILogger = new RegularILogger();
Expand Down Expand Up @@ -384,13 +375,8 @@ public void RegisterGoodDistributedAndCentralLoggerTestBuildStartedFinished()
string configurableClassNameA = "Microsoft.Build.Logging.ConfigurableForwardingLogger";
string configurableClassNameB = "Microsoft.Build.Logging.ConfigurableForwardingLogger";

#if FEATURE_ASSEMBLY_LOCATION
LoggerDescription configurableDescriptionA = CreateLoggerDescription(configurableClassNameA, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true);
LoggerDescription configurableDescriptionB = CreateLoggerDescription(configurableClassNameB, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true);
#else
LoggerDescription configurableDescriptionA = CreateLoggerDescription(configurableClassNameA, typeof(ProjectCollection).GetTypeInfo().Assembly.FullName, true);
LoggerDescription configurableDescriptionB = CreateLoggerDescription(configurableClassNameB, typeof(ProjectCollection).GetTypeInfo().Assembly.FullName, true);
#endif
LoggerDescription configurableDescriptionA = CreateLoggerDescription(configurableClassNameA, typeof(ProjectCollection).Assembly.FullName, true);
LoggerDescription configurableDescriptionB = CreateLoggerDescription(configurableClassNameB, typeof(ProjectCollection).Assembly.FullName, true);

RegularILogger regularILoggerA = new RegularILogger();
RegularILogger regularILoggerB = new RegularILogger();
Expand Down Expand Up @@ -430,11 +416,7 @@ public void RegisterGoodDistributedAndCentralLoggerTestBuildStartedFinished()
public void RegisterDuplicateCentralLogger()
{
string className = "Microsoft.Build.Logging.ConfigurableForwardingLogger";
#if FEATURE_ASSEMBLY_LOCATION
LoggerDescription description = CreateLoggerDescription(className, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true);
#else
LoggerDescription description = CreateLoggerDescription(className, typeof(ProjectCollection).GetTypeInfo().Assembly.FullName, true);
#endif
LoggerDescription description = CreateLoggerDescription(className, typeof(ProjectCollection).Assembly.FullName, true);

RegularILogger regularILogger = new RegularILogger();
Assert.True(_initializedService.RegisterDistributedLogger(regularILogger, description));
Expand All @@ -458,11 +440,7 @@ public void RegisterDuplicateCentralLogger()
public void RegisterDuplicateForwardingLoggerLogger()
{
string className = "Microsoft.Build.Logging.ConfigurableForwardingLogger";
#if FEATURE_ASSEMBLY_LOCATION
LoggerDescription description = CreateLoggerDescription(className, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true);
#else
LoggerDescription description = CreateLoggerDescription(className, typeof(ProjectCollection).GetTypeInfo().Assembly.FullName, true);
#endif
LoggerDescription description = CreateLoggerDescription(className, typeof(ProjectCollection).Assembly.FullName, true);

RegularILogger regularILogger = new RegularILogger();
Assert.True(_initializedService.RegisterDistributedLogger(regularILogger, description));
Expand Down Expand Up @@ -523,11 +501,7 @@ public void NullForwardingLoggerSink()
Assert.Throws<InternalErrorException>(() =>
{
string className = "Microsoft.Build.Logging.ConfigurableForwardingLogger";
#if FEATURE_ASSEMBLY_LOCATION
LoggerDescription description = CreateLoggerDescription(className, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true);
#else
LoggerDescription description = CreateLoggerDescription(className, typeof(ProjectCollection).GetTypeInfo().Assembly.FullName, true);
#endif
LoggerDescription description = CreateLoggerDescription(className, typeof(ProjectCollection).Assembly.FullName, true);
_initializedService.ShutdownComponent();
List<LoggerDescription> tempList = new List<LoggerDescription>();
tempList.Add(description);
Expand All @@ -545,13 +519,8 @@ public void RegisterGoodDiscriptions()
EventSourceSink sink = new EventSourceSink();
EventSourceSink sink2 = new EventSourceSink();
List<LoggerDescription> loggerDescriptions = new List<LoggerDescription>();
#if FEATURE_ASSEMBLY_LOCATION
loggerDescriptions.Add(CreateLoggerDescription(configurableClassName, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true));
loggerDescriptions.Add(CreateLoggerDescription(distributedClassName, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true));
#else
loggerDescriptions.Add(CreateLoggerDescription(configurableClassName, typeof(ProjectCollection).GetTypeInfo().Assembly.FullName, true));
loggerDescriptions.Add(CreateLoggerDescription(distributedClassName, typeof(ProjectCollection).GetTypeInfo().Assembly.FullName, true));
#endif
loggerDescriptions.Add(CreateLoggerDescription(configurableClassName, typeof(ProjectCollection).Assembly.FullName, true));
loggerDescriptions.Add(CreateLoggerDescription(distributedClassName, typeof(ProjectCollection).Assembly.FullName, true));

// Register some descriptions with a sink
_initializedService.InitializeNodeLoggers(loggerDescriptions, sink, 1);
Expand Down Expand Up @@ -608,11 +577,7 @@ public void RegisterGoodDiscriptions()
public void RegisterDuplicateDistributedCentralLogger()
{
string className = "Microsoft.Build.Logging.ConfigurableForwardingLogger";
#if FEATURE_ASSEMBLY_LOCATION
LoggerDescription description = CreateLoggerDescription(className, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true);
#else
LoggerDescription description = CreateLoggerDescription(className, typeof(ProjectCollection).GetTypeInfo().Assembly.FullName, true);
#endif
LoggerDescription description = CreateLoggerDescription(className, typeof(ProjectCollection).Assembly.FullName, true);

RegularILogger regularILogger = new RegularILogger();
Assert.True(_initializedService.RegisterDistributedLogger(regularILogger, description));
Expand Down Expand Up @@ -1220,11 +1185,7 @@ private void VerifyShutdownExceptions(ILogger logger, string className, Type exp
InitializeLoggingService();
if (className != null)
{
#if FEATURE_ASSEMBLY_LOCATION
Assembly thisAssembly = Assembly.GetAssembly(typeof(LoggingService_Tests));
#else
Assembly thisAssembly = typeof(LoggingService_Tests).GetTypeInfo().Assembly;
#endif
Assembly thisAssembly = typeof(LoggingService_Tests).Assembly;
string loggerAssemblyName = thisAssembly.FullName;
LoggerDescription centralLoggerDescrption = CreateLoggerDescription(className, loggerAssemblyName, true);
_initializedService.RegisterDistributedLogger(null, centralLoggerDescrption);
Expand Down
4 changes: 2 additions & 2 deletions src/Build.UnitTests/BackEnd/SdkResolverLoader_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void VerifyThrowsWhenResolverFailsToLoad()
{
SdkResolverLoader sdkResolverLoader = new MockSdkResolverLoader
{
LoadResolverAssemblyFunc = (resolverPath) => typeof(SdkResolverLoader_Tests).GetTypeInfo().Assembly,
LoadResolverAssemblyFunc = (resolverPath) => typeof(SdkResolverLoader_Tests).Assembly,
FindPotentialSdkResolversFunc = (rootFolder, loc) => new List<string>
{
"myresolver.dll"
Expand Down Expand Up @@ -157,7 +157,7 @@ public void VerifyThrowsWhenResolverHasNoPublicConstructor()
{
SdkResolverLoader sdkResolverLoader = new MockSdkResolverLoader
{
LoadResolverAssemblyFunc = (resolverPath) => typeof(SdkResolverLoader_Tests).GetTypeInfo().Assembly,
LoadResolverAssemblyFunc = (resolverPath) => typeof(SdkResolverLoader_Tests).Assembly,
FindPotentialSdkResolversFunc = (rootFolder, loc) => new List<string>
{
"myresolver.dll"
Expand Down
6 changes: 3 additions & 3 deletions src/Build.UnitTests/BackEnd/TaskExecutionHost_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1226,8 +1226,8 @@ public bool BuildProjectFile(string projectFileName, string[] targetNames, IDict
/// </summary>
private static bool IsTaskFactoryClass(Type type, object unused)
{
return type.GetTypeInfo().IsClass &&
!type.GetTypeInfo().IsAbstract &&
return type.IsClass &&
!type.IsAbstract &&
(type.GetInterface("Microsoft.Build.Framework.ITaskFactory") != null);
}

Expand All @@ -1249,7 +1249,7 @@ private void InitializeHost()
#if !FEATURE_ASSEMBLYLOADCONTEXT
AssemblyLoadInfo loadInfo = AssemblyLoadInfo.Create(Assembly.GetAssembly(typeof(TaskBuilderTestTask.TaskBuilderTestTaskFactory)).FullName, null);
#else
AssemblyLoadInfo loadInfo = AssemblyLoadInfo.Create(typeof(TaskBuilderTestTask.TaskBuilderTestTaskFactory).GetTypeInfo().FullName, null);
AssemblyLoadInfo loadInfo = AssemblyLoadInfo.Create(typeof(TaskBuilderTestTask.TaskBuilderTestTaskFactory).FullName, null);
#endif
LoadedType loadedType = new LoadedType(typeof(TaskBuilderTestTask.TaskBuilderTestTaskFactory), loadInfo, typeof(TaskBuilderTestTask.TaskBuilderTestTaskFactory).Assembly, typeof(ITaskItem));

Expand Down
24 changes: 2 additions & 22 deletions src/Build.UnitTests/BackEnd/TaskRegistry_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public class TaskRegistry_Tests
/// </summary>
public TaskRegistry_Tests(ITestOutputHelper output)
{
_testTaskLocation = typeof(TaskRegistry_Tests).GetTypeInfo().Assembly.ManifestModule.FullyQualifiedName;
_testTaskLocation = typeof(TaskRegistry_Tests).Assembly.ManifestModule.FullyQualifiedName;

_loggingService = LoggingService.CreateLoggingService(LoggerMode.Synchronous, 1);
_targetLoggingContext = new TargetLoggingContext(_loggingService, _loggerContext);
Expand Down Expand Up @@ -1127,7 +1127,7 @@ public void TaskFactoryWithNullTaskTypeLogsError()
List<ProjectUsingTaskElement> elementList = new List<ProjectUsingTaskElement>();
ProjectRootElement project = ProjectRootElement.Create();

ProjectUsingTaskElement element = project.AddUsingTask("Task1", AssemblyUtilities.GetAssemblyLocation(typeof(TaskRegistry_Tests.NullTaskTypeTaskFactory).GetTypeInfo().Assembly), null);
ProjectUsingTaskElement element = project.AddUsingTask("Task1", typeof(TaskRegistry_Tests.NullTaskTypeTaskFactory).Assembly.Location, null);

element.TaskFactory = typeof(NullTaskTypeTaskFactory).FullName;
elementList.Add(element);
Expand Down Expand Up @@ -1351,11 +1351,7 @@ public void BadScalarInputOnInputParameterDerivedFromITask()
// Note output is false so these are only input parameters
string output = bool.FalseString;
string required = bool.TrueString;
#if FEATURE_ASSEMBLY_LOCATION
string type = type = typeof(DerivedFromITaskItem).FullName + "," + typeof(DerivedFromITaskItem).Assembly.FullName;
#else
string type = type = typeof(DerivedFromITaskItem).FullName + "," + typeof(DerivedFromITaskItem).GetTypeInfo().Assembly.FullName;
#endif

List<ProjectUsingTaskElement> elementList = CreateParameterElementWithAttributes(output, required, type);
TaskRegistry registry = CreateTaskRegistryAndRegisterTasks(elementList);
Expand Down Expand Up @@ -1406,11 +1402,7 @@ public void GoodOutPutParameters()
type = typeof(ITaskItem).FullName;
VerifyTypeParameter(output, required, type);

#if FEATURE_ASSEMBLY_LOCATION
type = typeof(DerivedFromITaskItem).FullName + "," + typeof(DerivedFromITaskItem).Assembly.FullName;
#else
type = typeof(DerivedFromITaskItem).FullName + "," + typeof(DerivedFromITaskItem).GetTypeInfo().Assembly.FullName;
#endif
VerifyTypeParameter(output, required, type);

type = typeof(ITaskItem[]).FullName;
Expand All @@ -1425,11 +1417,7 @@ public void GoodOutPutParameters()
type = typeof(DateTime[]).FullName;
VerifyTypeParameter(output, required, type);

#if FEATURE_ASSEMBLY_LOCATION
type = typeof(DerivedFromITaskItem[]).FullName + "," + typeof(DerivedFromITaskItem).Assembly.FullName;
#else
type = typeof(DerivedFromITaskItem[]).FullName + "," + typeof(DerivedFromITaskItem).GetTypeInfo().Assembly.FullName;
#endif
VerifyTypeParameter(output, required, type);
}

Expand Down Expand Up @@ -1596,11 +1584,7 @@ public void ExpandedGoodParameters()
Assert.Equal(
parameterInfo.PropertyType,
Type.GetType(
#if FEATURE_ASSEMBLY_LOCATION
expandedType + "," + typeof(ITaskItem).Assembly.FullName,
#else
expandedType + "," + typeof(ITaskItem).GetTypeInfo().Assembly.FullName,
#endif
false /* don't throw on error */,
true /* case-insensitive */));
}
Expand Down Expand Up @@ -1980,11 +1964,7 @@ private void VerifyTypeParameter(string output, string required, string type)
if (paramType == null)
{
paramType = Type.GetType(
#if FEATURE_ASSEMBLY_LOCATION
type + "," + typeof(ITaskItem).Assembly.FullName,
#else
type + "," + typeof(ITaskItem).GetTypeInfo().Assembly.FullName,
#endif
false /* don't throw on error */,
true /* case-insensitive */);
}
Expand Down
Loading