Skip to content

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

@oold

Description

@oold

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): -

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions