Skip to content

C++/CLI compile error C3611 for "gcnew System::Windows::Forms::DataObject" #9644

Closed
@panxn

Description

@panxn

.NET version

.NET8 preview6

Did it work in .NET Framework?

Yes

Did it work in any of the earlier releases of .NET Core or .NET 5+?

It works in .NET6&7

Issue description

I'm not sure if it belongs to winform, maybe it's a bug of c++/cli compiler since these code compile well if rewrite with C#.

To reproduce the error, just create a new project in VS, add following attributes in vcxproj:

  <PropertyGroup>
    <TargetFramework>net8.0-windows</TargetFramework>
    <CLRSupport>NetCore</CLRSupport>
  </PropertyGroup>
  <ItemGroup>
    <FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" />
  </ItemGroup>

Compile following code, then we can see compile error C3611: a sealed function cannot have a pure-specifier

void HelloWorld()
{
    gcnew System::Windows::Forms::DataObject();
}

BTW I suspect it's a c++/cli compiler bug because I have encountered it in dotnet/runtime#88840 (comment), this comment also provides another sample. Please help forward this problem to right person if you treat it as a compiler bug. Thanks!

Steps to reproduce

see description

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions