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

CS8785 due to missing System.Text.Encodings.Web assembly in Dev16.11 #1163

Closed
oold opened this issue Mar 18, 2024 · 4 comments · Fixed by #1173
Closed

CS8785 due to missing System.Text.Encodings.Web assembly in Dev16.11 #1163

oold opened this issue Mar 18, 2024 · 4 comments · Fixed by #1173
Assignees
Labels
bug Something isn't working

Comments

@oold
Copy link

oold commented Mar 18, 2024

Actual behavior

Building the project fails to generate the sources when a NativeMethods.json file exists.

The following warning is emitted:

CSC : warning CS8785: Generator 'SourceGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'FileNotFoundException' with message 'Could not load file or assembly 'System.Text.Encodings.Web, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.'

Expected behavior

The sources are successfully generated during the build.

Repro steps

  1. NativeMethods.txt content:
CopyFileEx
CoTaskMemFree
ExtractIconEx
FileOpenDialog
FileSaveDialog
GetActiveWindow
GetModuleFileName
GetSystemWindowsDirectory
GetWindowLongPtr
HRESULT_FROM_WIN32
IFileDialog
IShellItem2
ITaskbarList3
SendMessage
SetWindowLongPtr
SHCreateItemFromParsingName
ShellExecuteEx
SHGetFileInfo
SHGetKnownFolderItem
SHGetStockIconInfo
SHOpenFolderAndSelectItems
SHParseDisplayName
StrCmpLogical
TaskbarList
TaskDialogIndirect

E_*
FOLDERID_*
ICON_*
MAX_PATH
MESSAGEBOX_RESULT
PBST_*
S_*
SEE_MASK_*
SHOW_WINDOW_CMD
TASKDIALOG_ELEMENTS
TASKDIALOG_MESSAGES
TD_*
WIN32_ERROR
WINDOW_EX_STYLE
WM_*
  1. NativeMethods.json content (if present):
{
  "$schema": "https://aka.ms/CsWin32.schema.json",
  "comInterop": {
    "preserveSigMethods": [
      "IFileDialogEvents"
    ]
  }
}
  1. Any of your own code that should be shared?

Context

  • CsWin32 version: 0.3.49-beta
  • Win32Metadata version (if explicitly set by project): 59.0.13-preview
  • Target Framework: net5.0-windows
  • LangVersion (if explicitly set by project): -
@oold oold added the bug Something isn't working label Mar 18, 2024
@AArnott
Copy link
Member

AArnott commented Mar 22, 2024

Note: Your target framework (net5.0-windows) is no longer supported.

System.Text.Encodings.Web being missing suggests you're running on a compiler that's older than one we test with. What .NET SDK or VS version are you building with?

@oold
Copy link
Author

oold commented Mar 22, 2024

Running on the latest VS 16 version.

@AArnott AArnott changed the title CS8785 after adding NativeMethods.json CS8785 due to missing System.Text.Encodings.Web assembly in Dev16.11 Apr 5, 2024
@AArnott AArnott self-assigned this Apr 5, 2024
@AArnott
Copy link
Member

AArnott commented May 3, 2024

It works for me:

image

Can you send more repro details?

@AArnott
Copy link
Member

AArnott commented May 3, 2024

Actually, I could repro it after filling in the Nativemethods text files like you described.

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.

2 participants