[Bug 45853] MSBuild 15.x fails with Wine-Mono 4.7.3 (assembly ' System.Runtime.InteropServices.RuntimeInformation', Version= 4.0.1.0 not remapped/found with Mono implementation)

wine-bugs at winehq.org wine-bugs at winehq.org
Tue Sep 18 20:11:23 CDT 2018


https://bugs.winehq.org/show_bug.cgi?id=45853

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |focht at gmx.net
         Resolution|FIXED                       |---
                URL|                            |https://visualstudio.micros
                   |                            |oft.com/downloads/#build-to
                   |                            |ols-for-visual-studio-2017
             Status|RESOLVED                    |REOPENED
            Summary|MSBuild 15.7.179.6572 Can't |MSBuild 15.x fails with
                   |run due missing             |Wine-Mono 4.7.3 (assembly
                   |GetStdHandle                |'System.Runtime.InteropServ
                   |                            |ices.RuntimeInformation',
                   |                            |Version=4.0.1.0 not
                   |                            |remapped/found with Mono
                   |                            |implementation)
           Keywords|                            |download
          Component|kernel32                    |mscoree

--- Comment #4 from Anastasius Focht <focht at gmx.net> ---
Hello folks,

even if native .NET Framework "fixes" it - technically there is still with
Wine-Mono. Some Wine folks consider the usage/preference of native .NET
Framework over Wine-Mono a "workaround" (not me) so lets give them a chance to
fix it there too (if technically feasible).

One can get the build tools as standalone package:

https://stackoverflow.com/questions/25506178/getting-msbuild-exe-without-installing-visual-studio

https://stackoverflow.com/questions/42696948/how-can-i-install-the-vs2017-version-of-msbuild-on-a-build-server-without-instal

->
https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15

Wine-Mono source:

https://github.com/madewokherd/wine-mono -> mono @ de4ceea

Mono upstream reference:

https://github.com/mono/mono/blob/de4ceea/mcs/class/corlib/System/WindowsConsoleDriver.cs#L104

--- snip ---
public WindowsConsoleDriver ()
{
    outputHandle = GetStdHandle (Handles.STD_OUTPUT);
    inputHandle = GetStdHandle (Handles.STD_INPUT);
    ConsoleScreenBufferInfo info = new ConsoleScreenBufferInfo ();
    GetConsoleScreenBufferInfo (outputHandle, out info);
    defaultAttribute = info.Attribute; // Not sure about this...
}

...

//
// Imports
//
[DllImport ("kernel32.dll", EntryPoint="GetStdHandle", SetLastError=true,
CharSet=CharSet.Unicode)]
extern static IntPtr GetStdHandle (Handles handle);

...
--- snip ---

That one shouldn't be a problem and in fact is the result of a broken
Wine-Mono/prefix installation. To make this ticket still useful, targeting the
real problem (otherwise it would be 'INVALID').

On my machine (using Mono debug facility):

--- snip ---
$ MONO_LOG_LEVEL=debug wine ./MSBuild.exe
...
Mono: Config attempting to parse:
'C:\users\focht\.mono\assemblies\System.Configuration\System.Configuration.config'.
Mono: Assembly Ref addref MSBuild[005AD8B0] -> System.Configuration[005D05B0]:
2
Mono: Assembly Ref addref System.Configuration[005D05B0] -> System[005BDC48]: 3
Mono: The request to load the assembly
System.Runtime.InteropServices.RuntimeInformation v4.0.1.0 was remapped to
v4.0.0.0
Mono: The request to load the assembly
System.Runtime.InteropServices.RuntimeInformation v4.0.1.0 was remapped to
v4.0.0.0
Mono: Assembly Loader probing location:
'Z:\home\focht\Downloads\MSBuild\15.0\Bin\System.Runtime.InteropServices.RuntimeInformation.dll'.
Mono: Denying load of problematic image
Z:\home\focht\Downloads\MSBuild\15.0\Bin\System.Runtime.InteropServices.RuntimeInformation.dll
Mono: Unloading image
Z:\home\focht\Downloads\MSBuild\15.0\Bin\System.Runtime.InteropServices.RuntimeInformation.dll
[005DCF80].
Mono: Assembly Loader probing location:
'C:\windows\mono\mono-2.0\lib\mono\gac\System.Runtime.InteropServices.RuntimeInformation\4.0.1.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.RuntimeInformation.dll'.
Mono: Assembly Loader probing location:
'C:\windows\mono\mono-2.0\lib\System.Runtime.InteropServices.RuntimeInformation.dll'.
Mono: Assembly Loader probing location:
'C:\windows\mono\mono-2.0\lib\mono\4.5\/Facades\System.Runtime.InteropServices.RuntimeInformation.dll'.
Mono: Assembly Loader probing location:
'C:\windows\mono\mono-2.0\lib\mono\gac\System.Runtime.InteropServices.RuntimeInformation\4.0.1.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.RuntimeInformation.exe'.
Mono: Assembly Loader probing location:
'C:\windows\mono\mono-2.0\lib\System.Runtime.InteropServices.RuntimeInformation.exe'.
Mono: Assembly Loader probing location:
'C:\windows\mono\mono-2.0\lib\mono\4.5\/Facades\System.Runtime.InteropServices.RuntimeInformation.exe'.
Mono: The request to load the assembly
System.Runtime.InteropServices.RuntimeInformation v4.0.1.0 was remapped to
v4.0.0.0
Mono: The request to load the assembly
System.Runtime.InteropServices.RuntimeInformation v4.0.1.0 was remapped to
v4.0.0.0
Mono: Assembly Loader probing location:
'Z:\home\focht\Downloads\MSBuild\15.0\Bin\System.Runtime.InteropServices.RuntimeInformation.dll'.
Mono: Denying load of problematic image
Z:\home\focht\Downloads\MSBuild\15.0\Bin\System.Runtime.InteropServices.RuntimeInformation.dll
Mono: Unloading image
Z:\home\focht\Downloads\MSBuild\15.0\Bin\System.Runtime.InteropServices.RuntimeInformation.dll
[005ECC28].
Mono: Assembly Loader probing location:
'C:\windows\mono\mono-2.0\lib\mono\gac\System.Runtime.InteropServices.RuntimeInformation\4.0.1.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.RuntimeInformation.dll'.
Mono: Assembly Loader probing location:
'Z:\home\focht\Downloads\MSBuild\15.0\Bin\System.Runtime.InteropServices.RuntimeInformation.dll'.
Mono: Denying load of problematic image
Z:\home\focht\Downloads\MSBuild\15.0\Bin\System.Runtime.InteropServices.RuntimeInformation.dll
Mono: Unloading image
Z:\home\focht\Downloads\MSBuild\15.0\Bin\System.Runtime.InteropServices.RuntimeInformation.dll
[005ECC28].
Mono: Assembly Loader probing location:
'C:\windows\mono\mono-2.0\lib\System.Runtime.InteropServices.RuntimeInformation.dll'.
Mono: Assembly Loader probing location:
'C:\windows\mono\mono-2.0\lib\mono\4.5\/Facades\System.Runtime.InteropServices.RuntimeInformation.dll'.
Mono: Assembly Loader probing location:
'C:\windows\mono\mono-2.0\lib\mono\gac\System.Runtime.InteropServices.RuntimeInformation\4.0.1.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.RuntimeInformation.exe'.
Mono: Assembly Loader probing location:
'Z:\home\focht\Downloads\MSBuild\15.0\Bin\System.Runtime.InteropServices.RuntimeInformation.exe'.
Mono: Assembly Loader probing location:
'C:\windows\mono\mono-2.0\lib\System.Runtime.InteropServices.RuntimeInformation.exe'.
Mono: Assembly Loader probing location:
'C:\windows\mono\mono-2.0\lib\mono\4.5\/Facades\System.Runtime.InteropServices.RuntimeInformation.exe'.
Mono: The following assembly referenced from
Z:\home\focht\Downloads\MSBuild\15.0\Bin\MSBuild.exe could not be loaded:
     Assembly:   System.Runtime.InteropServices.RuntimeInformation   
(assemblyref_index=7)
     Version:    4.0.1.0
     Public Key: b03f5f7f11d50a3a
The assembly was not found in the Global Assembly Cache, a path listed in the
MONO_PATH environment variable, or in the location of the executing assembly
(Z:\home\focht\Downloads\MSBuild\15.0\Bin\).

Mono: Failed to load assembly MSBuild[005AD8B0].

Unhandled Exception:
System.TypeInitializationException: The type initializer for
'Microsoft.Build.CommandLine.MSBuildApp' threw an exception. --->
System.TypeInitializationException: The type initializer for
'Microsoft.Build.Shared.FileUtilities' threw an exception. --->
System.TypeInitializationException: The type initializer for
'Microsoft.Build.Shared.FileSystem.FileSystems' threw an exception. --->
System.IO.FileNotFoundException: Could not load file or assembly
'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
  at Microsoft.Build.Shared.FileSystem.FileSystems.GetFileSystem () [0x00000]
in <827c8d80aa904f50b766f54f738c79e2>:0 
  at Microsoft.Build.Shared.FileSystem.FileSystems..cctor () [0x00000] in
<827c8d80aa904f50b766f54f738c79e2>:0 
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
  at Microsoft.Build.CommandLine.MSBuildApp..cctor () [0x00087] in
<827c8d80aa904f50b766f54f738c79e2>:0 
   --- End of inner exception stack trace ---
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type
initializer for 'Microsoft.Build.CommandLine.MSBuildApp' threw an exception.
---> System.TypeInitializationException: The type initializer for
'Microsoft.Build.Shared.FileUtilities' threw an exception. --->
System.TypeInitializationException: The type initializer for
'Microsoft.Build.Shared.FileSystem.FileSystems' threw an exception. --->
System.IO.FileNotFoundException: Could not load file or assembly
'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
  at Microsoft.Build.Shared.FileSystem.FileSystems.GetFileSystem () [0x00000]
in <827c8d80aa904f50b766f54f738c79e2>:0 
  at Microsoft.Build.Shared.FileSystem.FileSystems..cctor () [0x00000] in
<827c8d80aa904f50b766f54f738c79e2>:0 
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
  at Microsoft.Build.CommandLine.MSBuildApp..cctor () [0x00087] in
<827c8d80aa904f50b766f54f738c79e2>:0 
   --- End of inner exception stack trace ---
--- snip ---

Some "special" assemblies are blacklisted by Mono and replaced/remapped to own
implementation.

Source:
https://github.com/mono/mono/blob/de4ceea817dc4bf0f2ec7a1abc53f74bca6dda88/mono/metadata/image.c#L1104

--- snip ---
const char *ignored_assemblies_file_names[] = {
    "System.Runtime.InteropServices.RuntimeInformation.dll",
    "System.Globalization.Extensions.dll",
    "System.IO.Compression.dll",
    "System.Net.Http.dll",
    "System.Text.Encoding.CodePages.dll",
    "System.Threading.Overlapped.dll"
};

#define IGNORED_ASSEMBLY(HASH, NAME, GUID, VER_STR)    { .hash = HASH,
.assembly_name = NAME, .guid = GUID }

static const IgnoredAssembly ignored_assemblies [] = {
    IGNORED_ASSEMBLY (0x1136045D, SYS_GLOBALIZATION_EXT,
"475DBF02-9F68-44F1-8FB5-C9F69F1BD2B1", "4.0.0 net46"),
    IGNORED_ASSEMBLY (0x358C9723, SYS_GLOBALIZATION_EXT,
"5FCD54F0-4B97-4259-875D-30E481F02EA2", "4.0.1 net46"),
    IGNORED_ASSEMBLY (0x450A096A, SYS_GLOBALIZATION_EXT,
"E9FCFF5B-4DE1-4BDC-9CE8-08C640FC78CC", "4.3.0 net46"),
    IGNORED_ASSEMBLY (0x1CBD59A2, SYS_IO_COMPRESSION,
"44FCA06C-A510-4B3E-BDBF-D08D697EF65A", "4.1.0 net46"),
    IGNORED_ASSEMBLY (0x5E393C29, SYS_IO_COMPRESSION,
"3A58A219-266B-47C3-8BE8-4E4F394147AB", "4.3.0 net46"),
    IGNORED_ASSEMBLY (0x27726A90, SYS_NET_HTTP,
"269B562C-CC15-4736-B1B1-68D4A43CAA98", "4.1.0 net46"),
    IGNORED_ASSEMBLY (0x10CADA75, SYS_NET_HTTP,
"EA2EC6DC-51DD-479C-BFC2-E713FB9E7E47", "4.1.1 net46"),
    IGNORED_ASSEMBLY (0x8437178B, SYS_NET_HTTP,
"C0E04D9C-70CF-48A6-A179-FBFD8CE69FD0", "4.3.0 net46"),
    IGNORED_ASSEMBLY (0xFAFDA422, SYS_NET_HTTP,
"817F01C3-4011-477D-890A-98232B85553D", "4.3.1 net46"),
    IGNORED_ASSEMBLY (0x472FA630, SYS_NET_HTTP,
"09D4A140-061C-4884-9B63-22067E841931", "4.3.2 net46"),
    IGNORED_ASSEMBLY (0x46A4A1C5, SYS_RT_INTEROP_RUNTIME_INFO,
"F13660F8-9D0D-419F-BA4E-315693DD26EA", "4.0.0 net45"),
    IGNORED_ASSEMBLY (0xD07383BB, SYS_RT_INTEROP_RUNTIME_INFO,
"DD91439F-3167-478E-BD2C-BF9C036A1395", "4.3.0 net45"),
    IGNORED_ASSEMBLY (0x911D9EC3, SYS_TEXT_ENC_CODEPAGES,
"C142254F-DEB5-46A7-AE43-6F10320D1D1F", "4.0.1 net46"),
    IGNORED_ASSEMBLY (0xFA686A38, SYS_TEXT_ENC_CODEPAGES,
"FD178CD4-EF4F-44D5-9C3F-812B1E25126B", "4.3.0 net46"),
    IGNORED_ASSEMBLY (0xF6D18A2E, SYS_TEXT_ENC_CODEPAGES,
"F5CCCBEC-E1AD-4DBB-9B44-9B42C86B94B8", "4.4.0 net461"),
    IGNORED_ASSEMBLY (0xAA21986B, SYS_THREADING_OVERLAPPED,
"9F5D4F09-787A-458A-BA08-553AA71470F1", "4.0.0 net46"),
    IGNORED_ASSEMBLY (0x7D927C2A, SYS_THREADING_OVERLAPPED,
"FCBD003B-2BB4-4940-BAEF-63AF520C2336", "4.0.1 net46"),
    IGNORED_ASSEMBLY (0x6FE03EE2, SYS_THREADING_OVERLAPPED,
"87697E71-D192-4F0B-BAD4-02BBC7793005", "4.3.0 net46")
};


const char *ignored_assemblies_names[] = {
    "System.Runtime.InteropServices.RuntimeInformation",
    "System.Globalization.Extensions",
    "System.IO.Compression",
    "System.Net.Http",
    "System.Text.Encoding.CodePages",
    "System.Threading.Overlapped"
};

#define IGNORED_ASM_VER(NAME, MAJOR, MINOR, BUILD, REVISION) { .assembly_name =
NAME, .major = MAJOR, .minor = MINOR, .build = BUILD, .revision = REVISION }

static const IgnoredAssemblyVersion ignored_assembly_versions [] = {
    IGNORED_ASM_VER (SYS_GLOBALIZATION_EXT, 4, 0, 0, 0),
    IGNORED_ASM_VER (SYS_GLOBALIZATION_EXT, 4, 0, 1, 0),
    IGNORED_ASM_VER (SYS_GLOBALIZATION_EXT, 4, 0, 2, 0),
    IGNORED_ASM_VER (SYS_IO_COMPRESSION, 4, 1, 0, 0),
    IGNORED_ASM_VER (SYS_IO_COMPRESSION, 4, 1, 2, 0),
    IGNORED_ASM_VER (SYS_NET_HTTP, 4, 1, 0, 0),
    IGNORED_ASM_VER (SYS_NET_HTTP, 4, 1, 0, 1),
    IGNORED_ASM_VER (SYS_NET_HTTP, 4, 1, 1, 0),
    IGNORED_ASM_VER (SYS_NET_HTTP, 4, 1, 1, 1),
    IGNORED_ASM_VER (SYS_RT_INTEROP_RUNTIME_INFO, 4, 0, 0, 0),
    IGNORED_ASM_VER (SYS_RT_INTEROP_RUNTIME_INFO, 4, 0, 1, 0),
    IGNORED_ASM_VER (SYS_TEXT_ENC_CODEPAGES, 4, 0, 1, 0),
    IGNORED_ASM_VER (SYS_TEXT_ENC_CODEPAGES, 4, 0, 2, 0),
    IGNORED_ASM_VER (SYS_TEXT_ENC_CODEPAGES, 4, 1, 0, 0),
    IGNORED_ASM_VER (SYS_THREADING_OVERLAPPED, 4, 0, 0, 0),
    IGNORED_ASM_VER (SYS_THREADING_OVERLAPPED, 4, 0, 1, 0),
    IGNORED_ASM_VER (SYS_THREADING_OVERLAPPED, 4, 0, 2, 0),
};
...
--- snip ---

'MSBuild.exe.config':

--- snip ---
...
        <dependentAssembly>
          <assemblyIdentity
name="System.Runtime.InteropServices.RuntimeInformation"
publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
          <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0"/>
        </dependentAssembly>
--- snip ---

"Mono: The request to load the assembly
System.Runtime.InteropServices.RuntimeInformation v4.0.1.0 was remapped to
v4.0.0.0"

it still probes GAC location with:

--- snip ---
'C:\windows\mono\mono-2.0\lib\mono\gac\System.Runtime.InteropServices.RuntimeInformation\4.0.1.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.RuntimeInformation.dll'.
--- snip ---

Providing a copy in GAC from to '4.0.0.0__b03f5f7f11d50a3a' to
'4.0.1.0__b03f5f7f11d50a3a' fixes it and allows the tool to print synopsis:

--- snip ---
$ wine ./MSBuild.exe 
0009:fixme:mscoree:ConfigFileHandler_startElement Unknown element
L"configSections" in state 2
0009:fixme:mscoree:ConfigFileHandler_startElement Unknown element L"section" in
state 6
0009:fixme:mscoree:parse_startup useLegacyV2RuntimeActivationPolicy=L"true" not
implemented
0009:fixme:mscoree:parse_supported_runtime sku=L".NETFramework,Version=v4.6"
not implemented
0009:fixme:mscoree:ConfigFileHandler_startElement Unknown element
L"AppContextSwitchOverrides" in state 4
0009:fixme:mscoree:ConfigFileHandler_startElement Unknown element
L"DisableFXClosureWalk" in state 4
0009:fixme:mscoree:ConfigFileHandler_startElement Unknown element
L"generatePublisherEvidence" in state 4
0009:fixme:mscoree:ConfigFileHandler_startElement Unknown element
L"dependentAssembly" in state 0
0009:fixme:mscoree:ConfigFileHandler_startElement Unknown element
L"assemblyIdentity" in state 6
...
Microsoft (R) Build Engine version 15.8.168+ga8fba1ebd7 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1003: Specify a project or solution file. The current
working directory does not contain a project or solution file.
--- snip ---

NOTE: In general "install in Windows copy over to Linux" type installations are
not supported for bug triaging. There are a few few exceptions though, when
applications/installations are fully "portable".

$ sha1sum vs_buildtools.exe 
1d3db6d5ea240e9ac4a6b779a339ddad936a0deb  vs_buildtools.exe

$ du -sh vs_buildtools.exe 
1.3M    vs_buildtools.exe

$ wine --version
wine-3.16-74-g93994dfc0b

Regards

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list