You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With C# 12, it's possible to alias any type. A project that has ImplicitUsings, it works using GlobalUsings.cs. Switching from GlobalUsings.cs to Directory.Build.props breaks compilation.
I've run into a situation where a named tuple alias with a nullable doesn't work, but a collection with elements of an identical named tuple does.
Steps to Reproduce
// GlobalUsings.csglobalusing NamedTuple =(bool isUsed,string value);globalusing NamedTupleList = System.Collections.Generic.List<(bool isUsed,string value)>;// Anywhere in the projectNamedTuplent;// compilesNamedTupleListntl;// compiles
When attempting to use these aliases in all projects under solution using .csproj's Using element, NamedTuple doesn't work while NamedTupleList works.
The repro (link) is attempting to achieve this by defining the aliases in the Directory.Build.props file instead of GlobalUsing.cs in the following way.
Issue Description
With C# 12, it's possible to alias any type. A project that has
ImplicitUsings
, it works usingGlobalUsings.cs
. Switching fromGlobalUsings.cs
toDirectory.Build.props
breaks compilation.I've run into a situation where a named tuple alias with a nullable doesn't work, but a collection with elements of an identical named tuple does.
Steps to Reproduce
When attempting to use these aliases in all projects under solution using
.csproj
'sUsing
element,NamedTuple
doesn't work whileNamedTupleList
works.The repro (link) is attempting to achieve this by defining the aliases in the
Directory.Build.props
file instead ofGlobalUsing.cs
in the following way.With this change, the code fails.
Expected Behavior
NamedTuple
andNamedTupleList
types should be available and compilable.Actual Behavior
NamedTupleList
isn't available/compilable.Analysis
No response
Versions & Configurations
MSBuild version 17.10.4+10fbfbf2e
.NET 8.0.300
OS Windows 10 Pro 22H2
The text was updated successfully, but these errors were encountered: