Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Attribute constructor parameter has type, which is not a valid attribute parameter type
The following sample generates CS0181:
// CS0181.cs (12,6)
using System;
using System.Runtime.InteropServices;
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
unsafe class Attr : Attribute
{
public Attr(delegate*<void> d) {}
}
unsafe class C
{
[UnmanagedCallersOnly]
[Attr(&M1)]
static void M1()
{
}
}
The CLR currently does not allow generic attribute parameter types, so C# does not allow generic attribute parameter types.
.NET feedback
.NET is an open source project. Select a link to provide feedback: