Skip to content

ArrayMarshaller.cs file doesn't get included when a project sets DisableImplicitAssemblyReferences to false but depends on System.Memory #67425

@ViktorHofer

Description

@ViktorHofer

Repro:

  1. Add <DisableImplicitAssemblyReferences>false</DisableImplicitAssemblyReferences> to the Odbc.csproj
  2. Remove the <Reference Include="..." /> statements at the bottom of the project file.
  3. Run the following: .\dotnet.cmd build src\libraries\System.Data.Odbc\src\System.Data.Odbc.csproj /bl -f net7.0-windows

Error:

C:\git\runtime5\src\libraries\Common\src\Interop\Interop.Odbc.cs(172,34): error SYSLIB1051: The type 'byte[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'Value'. [C:\git\runtime5\src\libraries\System.Data.Odbc\src\System.Data.Odbc.csproj]
C:\git\runtime5\src\libraries\Common\src\Interop\Interop.Odbc.cs(199,35): error SYSLIB1051: The type 'char[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'rchState'. [C:\git\runtime5\src\libraries\System.Data.Odbc\src\System.Data.Odbc.csproj]
C:\git\runtime5\src\libraries\Common\src\Interop\Interop.Odbc.cs(201,35): error SYSLIB1051: The type 'char[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'MessageText'. [C:\git\runtime5\src\libraries\System.Data.Odbc\src\System.Data.Odbc.csproj]
C:\git\runtime5\src\libraries\Common\src\Interop\Interop.Odbc.cs(211,35): error SYSLIB1051: The type 'char[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'rchState'. [C:\git\runtime5\src\libraries\System.Data.Odbc\src\System.Data.Odbc.csproj]
C:\git\runtime5\src\libraries\Common\src\Interop\Interop.Odbc.cs(225,34): error SYSLIB1051: The type 'byte[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'rgbInfoValue'. [C:\git\runtime5\src\libraries\System.Data.Odbc\src\System.Data.Odbc.csproj]
C:\git\runtime5\src\libraries\Common\src\Interop\Interop.Odbc.cs(233,34): error SYSLIB1051: The type 'byte[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'rgbInfoValue'. [C:\git\runtime5\src\libraries\System.Data.Odbc\src\System.Data.Odbc.csproj]

Workaround: Set EnableLibraryImportGenerator to true.

cc @jkoritzinsky

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions