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

PInvoke006: An error occurred while reading docs file #953

Closed
0xced opened this issue Jun 2, 2023 · 3 comments · Fixed by #1037
Closed

PInvoke006: An error occurred while reading docs file #953

0xced opened this issue Jun 2, 2023 · 3 comments · Fixed by #1037
Labels
bug Something isn't working

Comments

@0xced
Copy link
Contributor

0xced commented Jun 2, 2023

Actual behavior

Warning PInvoke006 occurs when using the latest compiler toolset (i.e. Microsoft.Net.Compilers.Toolset 4.6.0).

Expected behavior

No warning is produced.

Repro steps

  1. MyProject.csproj content:
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="4.6.0" PrivateAssets="all" />
    <PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.2-beta" PrivateAssets="all" />
  </ItemGroup>

</Project>
  1. NativeMethods.txt content: (an empty file is enough to trigger the warning)

dotnet build produces the following warning:

CSC : warning PInvoke006: An error occurred while reading docs file: "%USERPROFILE%\.nuget\packages\microsoft.windows.sdk.win32docs\0.1.41-alpha\ buildTransitive..\apidocs.msgpack": Failed to deserialize System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=6 .0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Windows.SDK.Win32Docs.ApiDetails, Microsoft.Windows.SDK.Win32Docs, Version=0.1. 41.51634, Culture=neutral, PublicKeyToken=7c40c7c34b1fcfe1]] value. [C:\MyProject\MyProject.csproj]

Context

  • CsWin32 version: 0.3.2-beta
  • Win32Metadata version: not set explicitly
  • Target Framework: net6.0
  • LangVersion: not set explicitly

Additional info

The warning does not occur when using Microsoft.Net.Compilers.Toolset version 4.5.0.

@0xced 0xced added the bug Something isn't working label Jun 2, 2023
@AArnott
Copy link
Member

AArnott commented Jun 7, 2023

I can repro it as you say, when I use dotnet build. Thank you for this report.

@AArnott
Copy link
Member

AArnott commented Jun 7, 2023

@sharwell do you have any guesses as to what breaking change may have occurred in Roslyn between the 4.5.0 and 4.6.0 versions?

@alexrp
Copy link

alexrp commented Sep 13, 2023

I've started running into this as well, in a .NET 8 RC 1 project. Oddly, it only appears in VS Code, not with dotnet build... 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants