Skip to content
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

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

Closed
ViktorHofer opened this issue Apr 1, 2022 · 9 comments

Comments

@ViktorHofer
Copy link
Member

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

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Apr 1, 2022
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ViktorHofer
Copy link
Member Author

ViktorHofer commented Apr 1, 2022

Affects System.Diagnostics.EventLog as well:

C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System\Diagnostics\Reader\UnsafeNativeMethods.cs(467,73): error SYSLIB1051: The type 'System.IntPtr[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'events'. [C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj]
C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System\Diagnostics\Reader\UnsafeNativeMethods.cs(569,43): error SYSLIB1051: The type 'char[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'channelPathBuffer'. [C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj]
C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System\Diagnostics\Reader\UnsafeNativeMethods.cs(582,43): error SYSLIB1051: The type 'char[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'publisherIdBuffer'. [C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj]
C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System\Diagnostics\Reader\UnsafeNativeMethods.cs(664,42): error SYSLIB1051: The type 'string[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'valuePaths'. [C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj]
C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System\Diagnostics\Reader\UnsafeNativeMethods.cs(674,43): error SYSLIB1051: The type 'char[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'buffer'. [C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj]
C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System\Diagnostics\Reader\UnsafeNativeMethods.cs(746,49): error SYSLIB1051: The type 'Microsoft.Win32.UnsafeNativeMethods.EvtStringVariant[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'values'. [C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj]
C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System\Diagnostics\Reader\UnsafeNativeMethods.cs(749,44): error SYSLIB1051: The type 'char[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'buffer'. [C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj]
C:\git\runtime5\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.LookupAccountSid.cs(14,20): error SYSLIB1051: The type 'byte[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'Sid'. [C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj]
C:\git\runtime5\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.ReadEventLog.cs(21,20): error SYSLIB1051: The type 'byte[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'lpBuffer'. [C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj]
C:\git\runtime5\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.ReportEvent.cs(19,20): error SYSLIB1051: The type 'byte[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'lpUserSid'. [C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj]
C:\git\runtime5\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.ReportEvent.cs(23,20): error SYSLIB1051: The type 'byte[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'lpRawData'. [C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj]
C:\git\runtime5\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage_SafeLibraryHandle.cs(22,26): error SYSLIB1051: The type 'char[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'lpBuffer'. [C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj]
C:\git\runtime5\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage_SafeLibraryHandle.cs(24,22): error SYSLIB1051: The type 'System.IntPtr[]' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter 'arguments'. [C:\git\runtime5\src\libraries\System.Diagnostics.EventLog\src\System.Diagnostics.EventLog.csproj]

And DirectoryServices* projects

@ghost
Copy link

ghost commented Apr 1, 2022

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries
See info in area-owners.md if you want to be subscribed.

Issue Details

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

Author: ViktorHofer
Assignees: -
Labels:

area-Infrastructure-libraries, untriaged

Milestone: -

@ViktorHofer
Copy link
Member Author

@am11 unsure if that's actually infra libraries, depends on who owns the generators.targets file. I think area-Infrastructure would be better in this case :)

@ghost
Copy link

ghost commented Apr 1, 2022

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Issue Details

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

Author: ViktorHofer
Assignees: -
Labels:

area-Infrastructure, untriaged

Milestone: -

@ViktorHofer ViktorHofer added untriaged New issue has not been triaged by the area owner and removed untriaged New issue has not been triaged by the area owner labels Apr 1, 2022
@am11
Copy link
Member

am11 commented Apr 1, 2022

@ViktorHofer, my thinking was if it is related to infra && src/libraries, area-Infrastructure-libraries would be more accurate; but I will defer to your assessment. 😉

@jkoritzinsky
Copy link
Member

Given that this will go away after #66623 is approved and ArrayMarshaller is approved, I'm not inclined to fix this now if it's not blocking.

@ViktorHofer
Copy link
Member Author

Works for me, I can work around it for now.

@ViktorHofer
Copy link
Member Author

Fixed by #68173

@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Apr 25, 2022
@ghost ghost locked as resolved and limited conversation to collaborators May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants