Slack Groverglow
Slack Groverglow

Reputation: 856

Managed pointers in .NET 6+

I'm trying to port an existing c++ library to .net 6. I have set the framework version and CLR support flag:

<TargetFramework>net6.0</TargetFramework>
...
<CLRSupport>NetCore</CLRSupport>

I get the compilation error

CurrentProject.cpp(9,88): error C3699: '^': cannot use this indirection on type 'System::ComponentModel::PropertyChangedEventHandler'
CurrentProject.cpp(9,88): message : compiler replacing '^' with '*' to continue parsing
CurrentProject.cpp(9,88): message : This diagnostic occurred while importing type 'ArcGIS::Desktop::Framework::Contracts::PropertyChangedBase' from assembly 'ArcGIS.Desktop.Framework, Version=13.1.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86'.
CurrentProject.cpp(9,88): message : This diagnostic occurred while importing type 'ArcGIS::Desktop::Core::Project' from assembly 'ArcGIS.Desktop.Core, Version=13.1.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86'.
CurrentProject.cpp(9,88): fatal  error C1903: unable to recover from previous error(s); stopping compilation

And the line in question is

ArcGIS::Desktop::Core::Project ^curProject = ArcGIS::Desktop::Core::Project::Current;

Does netcore not support managed pointers?

Upvotes: -2

Views: 88

Answers (1)

Slack Groverglow
Slack Groverglow

Reputation: 856

I'm not sure of the explanation but I found that removing the System reference from the vcxproj file solved this.

<Reference Include="System" />

This doesnt seem to be needed in NetCore but was probably needed in the old NetFramework CLR.

Upvotes: -1

Related Questions