-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
required and GenerateReferenceAssemblySource #71559
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsWhen using the new [System.Runtime.CompilerServices.RequiredMemberAttribute]
public sealed partial class QuicClientConnectionOptions : System.Net.Quic.QuicConnectionOptions
{
[System.ObsoleteAttribute("Constructors of types with required members are not supported in this version of your compiler.", true)]
[System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute("RequiredMembers")]
public QuicClientConnectionOptions() { }
[System.Runtime.CompilerServices.RequiredMemberAttribute]
public System.Net.Security.SslClientAuthenticationOptions ClientAuthenticationOptions { get { throw null; } set { } }
public System.Net.IPEndPoint? LocalEndPoint { get { throw null; } set { } }
[System.Runtime.CompilerServices.RequiredMemberAttribute]
public System.Net.EndPoint RemoteEndPoint { get { throw null; } set { } }
} And then compiler complains that required keyword should be used instead:
I don't know which way is the correct way. @ViktorHofer @333fred Follow up issue is that if I manually remove the attributes and add public sealed partial class QuicClientConnectionOptions : System.Net.Quic.QuicConnectionOptions
{
public QuicClientConnectionOptions() { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); }
public required System.Net.Security.SslClientAuthenticationOptions ClientAuthenticationOptions { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); }
public System.Net.IPEndPoint? LocalEndPoint { get { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); } }
public required System.Net.EndPoint RemoteEndPoint { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); }
} Does anyone know where the GeneratePlatformNotSupportedAssemblyMessage lives and whom to contact?
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure Issue DetailsWhen using the new [System.Runtime.CompilerServices.RequiredMemberAttribute]
public sealed partial class QuicClientConnectionOptions : System.Net.Quic.QuicConnectionOptions
{
[System.ObsoleteAttribute("Constructors of types with required members are not supported in this version of your compiler.", true)]
[System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute("RequiredMembers")]
public QuicClientConnectionOptions() { }
[System.Runtime.CompilerServices.RequiredMemberAttribute]
public System.Net.Security.SslClientAuthenticationOptions ClientAuthenticationOptions { get { throw null; } set { } }
public System.Net.IPEndPoint? LocalEndPoint { get { throw null; } set { } }
[System.Runtime.CompilerServices.RequiredMemberAttribute]
public System.Net.EndPoint RemoteEndPoint { get { throw null; } set { } }
} And then compiler complains that required keyword should be used instead:
I don't know which way is the correct way. @ViktorHofer @333fred Follow up issue is that if I manually remove the attributes and add public sealed partial class QuicClientConnectionOptions : System.Net.Quic.QuicConnectionOptions
{
public QuicClientConnectionOptions() { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); }
public required System.Net.Security.SslClientAuthenticationOptions ClientAuthenticationOptions { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); }
public System.Net.IPEndPoint? LocalEndPoint { get { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); } }
public required System.Net.EndPoint RemoteEndPoint { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); }
} Does anyone know where the GeneratePlatformNotSupportedAssemblyMessage lives and whom to contact?
|
It looks like the runtime's generator needs to be updated. |
Here is the task: https://github.com/dotnet/arcade/blob/main/src/Microsoft.DotNet.GenFacades/NotSupportedAssemblyGenerator.cs and the msbuild file with the target that invokes the task is here: https://github.com/dotnet/arcade/blob/main/src/Microsoft.DotNet.GenFacades/build/Microsoft.DotNet.GenFacadesNotSupported.targets. |
Maybe it's enough to bump the Microsoft.CodeAnalysis.CSharp version in arcade by updating the |
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsWhen using the new [System.Runtime.CompilerServices.RequiredMemberAttribute]
public sealed partial class QuicClientConnectionOptions : System.Net.Quic.QuicConnectionOptions
{
[System.ObsoleteAttribute("Constructors of types with required members are not supported in this version of your compiler.", true)]
[System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute("RequiredMembers")]
public QuicClientConnectionOptions() { }
[System.Runtime.CompilerServices.RequiredMemberAttribute]
public System.Net.Security.SslClientAuthenticationOptions ClientAuthenticationOptions { get { throw null; } set { } }
public System.Net.IPEndPoint? LocalEndPoint { get { throw null; } set { } }
[System.Runtime.CompilerServices.RequiredMemberAttribute]
public System.Net.EndPoint RemoteEndPoint { get { throw null; } set { } }
} And then compiler complains that required keyword should be used instead:
I don't know which way is the correct way. @ViktorHofer @333fred Follow up issue is that if I manually remove the attributes and add public sealed partial class QuicClientConnectionOptions : System.Net.Quic.QuicConnectionOptions
{
public QuicClientConnectionOptions() { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); }
public required System.Net.Security.SslClientAuthenticationOptions ClientAuthenticationOptions { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); }
public System.Net.IPEndPoint? LocalEndPoint { get { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); } }
public required System.Net.EndPoint RemoteEndPoint { throw new System.PlatformNotSupportedException(System.SR.SystemNetQuic_PlatformNotSupported); }
} Does anyone know where the GeneratePlatformNotSupportedAssemblyMessage lives and whom to contact?
|
I asked @ericstj to take a look as I'm unsure if bumping the CodeAnalysis version is sufficient to make this work. |
When new language features come along the arcade tools GenAPI and GenFacades need to be updated to understand them. The issue with
There's a very good chance that would work, though someone would need to try and see. The rewriter for the not-supported assemblies is just parsing the source and replacing the member bodies: https://github.com/dotnet/arcade/blob/3895dfc219f7cea2c028164db691389d0b1a73a8/src/Microsoft.DotNet.GenFacades/NotSupportedAssemblyGenerator.cs#L125-L130 |
I don't know of an attribute like this that we allow, even with a warning. For example, extension methods are represented by an attribute, but it is illegal to use that attribute in C# itself. |
I noticed some other ones like |
Another thought here around |
It looks like |
I went ahead and fixed this: dotnet/arcade#10021 |
This should be fixed in arcade now. You'll be able to use that change once it merges to dotnet/runtime - likely next week. Check on Monday if it's made it by looking for a build of GenAPI / GenFacades that's newer than 7.0.0-beta.22365.1. If it hasn't landed by then we can manually pick up the new packages to get this functionality before Darc flows the build. |
When using the new
required
keyword, GenerateReferenceAssemblySource generates code like this:And then compiler complains that required keyword should be used instead:
I don't know which way is the correct way. @ViktorHofer @333fred
Follow up issue is that if I manually remove the attributes and add
required
keyword, the GeneratePlatformNotSupportedAssemblyMessage generator generates another code that cannot be compiled. See the missingget
andset
:Does anyone know where the GeneratePlatformNotSupportedAssemblyMessage lives and whom to contact?
The text was updated successfully, but these errors were encountered: