Skip to content

Intermittent ambiguous reference when building on .NET 6 with Global Usings #1668

Open
@Bouke

Description

@Bouke

I have a .NET 6 project with Global Usings. The project is built on Azure DevOps. I see intermittent build failures. Restarting the build often fixes this.

System.CommandLine.DragonFruit 0.3.0-alpha.21216.1

D:\a\1\s\Source\Tools\Migrate\obj\Debug\net6.0\Migrate.Program.g.cs(8,31): error CS0104: 'Task<>' is an ambiguous reference between 'System.Threading.Tasks.Task' and 'System.Threading.Tasks.Task' [D:\a\1\s\Source\Tools\Migrate\Migrate.csproj]

Migrate.Program.g.cs:

// <auto-generated>This file was created automatically</auto-generated>
        using System.Runtime.CompilerServices;
        using System.Threading.Tasks;

        [CompilerGenerated]
        internal class AutoGeneratedProgram
        {
          public static async Task<int> Main(string[] args)
          {
            return await System.CommandLine.DragonFruit.CommandLine.ExecuteAssemblyAsync(
              entryAssembly: typeof(global::AutoGeneratedProgram).Assembly,
              args: args,
           entryPointFullTypeName: ""              
              );
          }
        }

Migrate.GlobalUsings.g.cs:

// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Threading;
global using global::System.Threading.Tasks;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions