CS8785 due to missing `System.Text.Encodings.Web` assembly in Dev16.11
oold opened this issue · comments
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
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_*
NativeMethods.json
content (if present):
{
"$schema": "https://aka.ms/CsWin32.schema.json",
"comInterop": {
"preserveSigMethods": [
"IFileDialogEvents"
]
}
}
- 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): -
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?
Running on the latest VS 16 version.
Actually, I could repro it after filling in the Nativemethods text files like you described.