[Bug 45930] New: Microsoft .NET Framework 4.x GAC update fails for some assemblies, ' Error compiling mscorlib, Path not found. (Exception from HRESULT: 0x80070003)' (legacy GAC missing: '%systemroot%\assembly')

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Oct 3 16:44:38 CDT 2018


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

            Bug ID: 45930
           Summary: Microsoft .NET Framework 4.x GAC update fails for some
                    assemblies, 'Error compiling mscorlib, Path not found.
                    (Exception from HRESULT: 0x80070003)' (legacy GAC
                    missing: '%systemroot%\assembly')
           Product: Wine
           Version: 3.17
          Hardware: x86-64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: -unknown
          Assignee: wine-bugs at winehq.org
          Reporter: focht at gmx.net
      Distribution: ---

Hello folks,

as it says.

After .NET Framework 4.x installation, when manually triggering GAC update,
some assemblies fail to install in pre .NET 4.0 (1.0 - 3.5) legacy GAC location
because it's missing. The failure is not really critical though (has no effect
on .NET 4.x apps).

NOTE: This is not MSI regression, it was afaik always present. Had this one
bitrotting on my disk for at least a year.

Console output:

--- snip ---
$ wine "c:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\ngen.exe" update
...
1>    Compiling assembly mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 (CLR v4.0.30319) ...
0183:fixme:thread:SetThreadStackGuarantee (0x33ee40): stub
017d:err:ole:CoGetContextToken apartment not initialised
019d:err:ole:CoGetContextToken apartment not initialised
016c:fixme:shell:URL_ParseUrl failed to parse L"System.ServiceModel.Activation"
016c:fixme:shell:URL_ParseUrl failed to parse
L"System.Runtime.DurableInstancing"
016c:fixme:shell:URL_ParseUrl failed to parse L"System.ServiceModel.Activities"
016c:fixme:shell:URL_ParseUrl failed to parse L"System.Activities"
016c:fixme:shell:URL_ParseUrl failed to parse L"System.Xaml.Hosting"
016c:fixme:shell:URL_ParseUrl failed to parse
L"System.Activities.DurableInstancing"
016c:fixme:shell:URL_ParseUrl failed to parse
L"Microsoft.VisualBasic.Activities.Compiler"
016c:fixme:shell:URL_ParseUrl failed to parse L"System"
1>Error compiling mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089: Path not found. (Exception from HRESULT:
0x80070003)
016c:fixme:shell:URL_ParseUrl failed to parse L"System.EnterpriseServices"
016c:fixme:shell:URL_ParseUrl failed to parse L"System.Configuration"
0183:fixme:process:FlushProcessWriteBuffers : stub
016c:fixme:shell:URL_ParseUrl failed to parse L"System.ServiceModel"
1>Failed to generate native code for dependent image mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089 because of the following
error: Path not found. (Exception from HRESULT: 0x80070003)
0183:err:ole:CoReleaseMarshalData IMarshal::ReleaseMarshalData failed with
error 0x8001011d
--- snip --- 

Trace log:

--- snip ---
$ WINEDEBUG=+seh,+relay wine
"c:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\ngen.exe" update >>log.txt
2>&1
...
0009:Call KERNEL32.CreateProcessW(0033e5f4
L"C:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscorsvw.exe",00165b30
L"C:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscorsvw.exe -UseCLSID
{49B5CB8A-401C-4FE3-9BE6-B265330F3332} -Comment \"NGen Worker
Process\"",00000000,00000000,00000000,00000000,00000000,00000000,0033e134,0033e178)
ret=60900813
...
004b:Call KERNEL32.__wine_kernel_init() ret=7bc6d0ee
...
0049:Ret  KERNEL32.CreateProcessW() retval=00000001 ret=60900813 
...
004b:Call KERNEL32.GetEnvironmentVariableW(0033f798
L"COMPlus_NGENBreakOnWorker",00000000,00000000) ret=100104e3
004b:Ret  KERNEL32.GetEnvironmentVariableW() retval=00000000 ret=100104e3
...
004b:Call KERNEL32.SearchPathW(00000000,0033eab4
L"C:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscoree.tlb",00000000,00000105,0033e81e,00000000)
ret=7e3300b5
004b:Ret  KERNEL32.SearchPathW() retval=00000039 ret=7e3300b5
004b:Call KERNEL32.CreateFileW(0033e81e
L"C:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscoree.tlb",80000000,00000000,00000000,00000003,00000080,00000000)
ret=7e33016c
004b:Ret  KERNEL32.CreateFileW() retval=000000a8 ret=7e33016c
...
004b:Call KERNEL32.LoadLibraryExW(0033ec98
L"C:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscoreei.dll",00000000,00000008)
ret=79004b0f 
...
004b:Ret  PE DLL (proc=0x603b3578,module=0x603b0000
L"mscoreei.dll",reason=PROCESS_ATTACH,res=(nil)) retval=1
004b:Ret  KERNEL32.LoadLibraryExW() retval=603b0000 ret=79004b0f
...
004b:Call KERNEL32.GetProcAddress(603b0000,79007ed0 "RegisterShimImplCallback")
ret=79007e9c
004b:Ret  KERNEL32.GetProcAddress() retval=603b6975 ret=79007e9c
004b:Call KERNEL32.GetProcAddress(603b0000,79007eb0
"RegisterShimImplCleanupCallback") ret=79007ea8
004b:Ret  KERNEL32.GetProcAddress() retval=00000000 ret=79007ea8
004b:Call KERNEL32.GetProcAddress(603b0000,7900c90c "SetShellShimInstance")
ret=7900c820
004b:Ret  KERNEL32.GetProcAddress() retval=00000000 ret=7900c820
004b:Call KERNEL32.GetProcAddress(603b0000,7900c8f8 "OnShimDllMainCalled")
ret=7900c84a
004b:Ret  KERNEL32.GetProcAddress() retval=603b43ef ret=7900c84a
...
004b:Call KERNEL32.GetProcAddress(603b0000,7901ab04 "CLRCreateInstance")
ret=7901aaec
004b:Ret  KERNEL32.GetProcAddress() retval=603bc640 ret=7901aaec
...
004b:Call KERNEL32.CreateFileW(0033edc4
L"C:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\clr.dll",00020000,00000007,00000000,00000003,10000000,00000000)
ret=603b9264
004b:Ret  KERNEL32.CreateFileW() retval=000000c0 ret=603b9264
...
004b:Call KERNEL32.LoadLibraryExW(00171858
L"C:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\clr.dll",00000000,00000008)
ret=603b1711 
...
004b:Ret  PE DLL (proc=0x791f58f0,module=0x79140000
L"clr.dll",reason=PROCESS_ATTACH,res=(nil)) retval=1
004b:Ret  KERNEL32.LoadLibraryExW() retval=79140000 ret=603b1711
...
004b:Call KERNEL32.GetProcAddress(79140000,10002034 "NGenCreateNGenWorker")
ret=603b539f
004b:Ret  KERNEL32.GetProcAddress() retval=79242b1b ret=603b539f
...
004b:Call advapi32.RegOpenKeyExW(80000002,792a453c
L"Software\\Microsoft\\Fusion",00000000,00020019,0033e348) ret=7918cbff
004b:Ret  advapi32.RegOpenKeyExW() retval=00000002 ret=7918cbff
...
004b:Call KERNEL32.GetProcAddress(7b420000,792a4804
"GetSystemWindowsDirectoryW") ret=792a47e7
004b:Ret  KERNEL32.GetProcAddress() retval=7b431c1c ret=792a47e7
004b:Call KERNEL32.GetSystemWindowsDirectoryW(7972f058,00000105) ret=792a47f5
004b:Ret  KERNEL32.GetSystemWindowsDirectoryW() retval=0000000a ret=792a47f5
...
004b:Call advapi32.RegOpenKeyExW(80000002,0033e4a4
L"Software\\Microsoft\\Fusion\\NativeImagesIndex\\v4.0.30319_32",00000000,00020019,0018f97c)
ret=7918cbff
004b:Ret  advapi32.RegOpenKeyExW() retval=00000002 ret=7918cbff
...
004b:Call KERNEL32.GetFileAttributesW(0033e554
L"C:\\windows\\Microsoft.Net\\assembly\\GAC_32\\mscorlib\\v4.0_4.0.0.0__b77a5c561934e089\\mscorlib.dll")
ret=791de214
004b:Ret  KERNEL32.GetFileAttributesW() retval=00000020 ret=791de214
...
004b:Call KERNEL32.lstrlenW(00176b80 L"v4.0.30319") ret=79299594
004b:Ret  KERNEL32.lstrlenW() retval=0000000a ret=79299594
004b:Call KERNEL32.lstrlenW(79299670 L"\\NativeImages_") ret=7929959d
004b:Ret  KERNEL32.lstrlenW() retval=0000000e ret=7929959d
004b:Call KERNEL32.lstrlenW(7922b37c L"\\assembly") ret=792995a6
004b:Ret  KERNEL32.lstrlenW() retval=00000009 ret=792995a6
004b:Call KERNEL32.lstrlenW(7972f058 L"C:\\windows") ret=792995b1
004b:Ret  KERNEL32.lstrlenW() retval=0000000a ret=792995b1
004b:Call shlwapi.PathRemoveBackslashW(7972e700 L"C:\\windows") ret=792995e7
004b:Ret  shlwapi.PathRemoveBackslashW() retval=7972e712 ret=792995e7
004b:Call KERNEL32.lstrlenW(7972e700
L"C:\\windows\\assembly\\NativeImages_v4.0.30319_32") ret=7924643b
004b:Ret  KERNEL32.lstrlenW() retval=0000002e ret=7924643b
004b:Call KERNEL32.CreateDirectoryW(0033e86c
L"C:\\windows\\assembly\\NativeImages_v4.0.30319_32",00000000) ret=792462c3
004b:Ret  KERNEL32.CreateDirectoryW() retval=00000000 ret=792462c3 
...
004b:Call KERNEL32.RaiseException(e06d7363,00000001,00000003,0033e5dc)
ret=79084c0f
004b:trace:seh:raise_exception code=e06d7363 flags=1 addr=0x7b446fe6
ip=7b446fe6 tid=004b
004b:trace:seh:raise_exception  info[0]=19930520
004b:trace:seh:raise_exception  info[1]=0033e61c
004b:trace:seh:raise_exception  info[2]=7923b608
004b:trace:seh:raise_exception  eax=7b4356b1 ebx=00000000 ecx=00000000
edx=0033e5c8 esi=0033e5c8 edi=0033e590
004b:trace:seh:raise_exception  ebp=0033e568 esp=0033e504 cs=330023 ds=33002b
es=f7c3002b fs=f7c30063 gs=f7c3006b flags=00000212
004b:trace:seh:call_vectored_handlers calling handler at 0x791f5a7c
code=e06d7363 flags=1
004b:Call KERNEL32.GetLastError() ret=791f5aa7
004b:Ret  KERNEL32.GetLastError() retval=00000003 ret=791f5aa7
004b:trace:seh:call_vectored_handlers handler at 0x791f5a7c returned 0
004b:trace:seh:call_stack_handlers calling handler at 0x7923b644 code=e06d7363
flags=1 
...
004b:Call
KERNEL32.FormatMessageW(000031ff,00000000,80070003,00000400,0033e620,00000000,0033e5cc)
ret=7923ae16
004b:Ret  KERNEL32.FormatMessageW() retval=00000010 ret=7923ae16
...
004b:Call oleaut32.SysAllocString(001b7900 L"Error compiling mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089: Path not
found. (Exception from HRESULT: 0x80070003)\n") ret=7927d1d9 
...
--- snip --- 

https://social.msdn.microsoft.com/Forums/vstudio/en-US/099c0590-8bc3-4006-a223-16a40ce47910/gac-locations?forum=clr

--- quote ---
I know that the .NET 4.0 GAC stores its assemblies at
C:\Windows\Microsoft.NET\assembly and the .NET GAC pre-4.0 assemblies are at:
C:\Windows\assembly.  The .NET 4.0 GAC is broken down into subdirectories:

C:\Windows\Microsoft.NET\assembly>dir
 Volume in drive C has no label.
 Volume Serial Number is 108E-C26D

 Directory of C:\Windows\Microsoft.NET\assembly

09/12/2012  01:31 PM    <DIR>          .
09/12/2012  01:31 PM    <DIR>          ..
09/12/2012  01:54 PM    <DIR>          GAC_32
09/12/2012  01:54 PM    <DIR>          GAC_64
09/12/2012  01:35 PM    <DIR>          GAC_MSIL

GAC_32 (for 32-bit compiled assemblies)
GAC_64 (for 64-bit compiled assemblies)
GAC_MSIL (for assemblies compiled as "any cpu")

The earlier .NET GAC has these three subdirectories, plus one called just plain
GAC i.e. C:\Windows\assembly\GAC:

C:\Windows\assembly>dir
 Volume in drive C has no label.
 Volume Serial Number is 108E-C26D

 Directory of C:\Windows\assembly

09/12/2012  02:06 PM    <DIR>          GAC
09/12/2012  01:54 PM    <DIR>          GAC_32
09/12/2012  01:54 PM    <DIR>          GAC_64
09/12/2012  02:06 PM    <DIR>          GAC_MSIL
09/12/2012  02:42 PM    <DIR>          NativeImages_v2.0.50727_32
09/12/2012  01:48 PM    <DIR>          NativeImages_v2.0.50727_64
09/12/2012  02:42 PM    <DIR>          NativeImages_v4.0.30319_32
09/12/2012  01:48 PM    <DIR>          NativeImages_v4.0.30319_64
09/12/2012  02:42 PM    <DIR>          temp
09/12/2012  02:05 PM    <DIR>          tmp
--- quote ---

https://blogs.msdn.microsoft.com/gauravseth/2006/03/07/moving-from-32-bit-to-64-bit-application-development-on-net-framework/

.NET GAC pre-4.0 (1.0 - 3.5) assemblies are stored in 'c:\windows\assembly'
(%systemroot%\assembly)

Install from 'winetricks':

* WinVer set to 'Windows XP' (otherwise 'mscoree.dll' is not installed).
* WINEDLLOVERRIDES=fusion=b wine dotNetFx40_Full_x86_x64.exe 

References in Shared Source CLI 2.0:

https://github.com/fixdpt/shared-source-cli-2.0

https://github.com/fixdpt/shared-source-cli-2.0/blob/d63349c09c2e93e4bfc4c8b147ff0805f36cec68/clr/src/fusion/utils/helpers.cpp

https://github.com/fixdpt/shared-source-cli-2.0/blob/d63349c09c2e93e4bfc4c8b147ff0805f36cec68/clr/src/fusion/asmcache/cacheutils.cpp

https://github.com/fixdpt/shared-source-cli-2.0/search?q=FUSION_CACHE_STAGING_DIR_SZ&unscoped_q=FUSION_CACHE_STAGING_DIR_SZ 

--- snip ---
#define REG_KEY_FUSION_SETTINGS             TEXT("Software\\Microsoft\\Fusion")

#define FUSION_CACHE_DIR_ROOT_SZ            TEXT("\\assembly")
#define FUSION_CACHE_DIR_DOWNLOADED_SZ      TEXT("\\assembly\\dl3")
#define FUSION_CACHE_DIR_GAC_SZ             TEXT("\\GAC")
#define FUSION_CACHE_DIR_GACNE_SZ           TEXT("\\GAC_MSIL")
#define FUSION_CACHE_DIR_GAC32_SZ           TEXT("\\GAC_32")
#define FUSION_CACHE_DIR_GAC64_SZ           TEXT("\\GAC_64")
#define FUSION_CACHE_DIR_ZAP_SZ             TEXT("\\NativeImages_")
#define FUSION_CACHE_DIR_ZAP_SHADOW_SZ      TEXT("_shadow")
#define FUSION_CACHE_STAGING_DIR_SZ         TEXT("\\assembly\\tmp")
#define FUSION_CACHE_PENDING_DEL_DIR_SZ TEXT("\\assembly\\temp")
--- snip ---

https://github.com/fixdpt/shared-source-cli-2.0/blob/d63349c09c2e93e4bfc4c8b147ff0805f36cec68/clr/src/fusion/asmcache/cacheutils.cpp#L126

--- snip ---
HRESULT SetGACDir(CACHE_FLAGS dwCacheFlags)
{
    CCriticalSection    cs(g_csSingleUse);
    HRESULT             hr = S_OK;
    LPWSTR              pwzDestBuffer = NULL;
    BOOL                fLocked = FALSE;
    DWORD               dwFlagToOr = 0;
    DWORD               dwLen = 0;

    // Validate cache flag
    _ASSERTE( dwCacheFlags & (CACHE_GAC_ANY | CACHE_ROOT));

    // execute entire function under critical section
    hr = cs.Lock();
    if (FAILED(hr)) {
        goto Exit;
    }
...
--- snip ---

https://github.com/fixdpt/shared-source-cli-2.0/blob/d63349c09c2e93e4bfc4c8b147ff0805f36cec68/clr/src/fusion/asmcache/cacheutils.cpp#L231

I haven't figured out why the legacy assembly root directory doesn't exist
after .NET Framework installation. It's not created by the runtime itself but
somehow during .NET install process. Manually creating it fixes the GAC update
issue.

--- snip ---
$ wine cmd.exe /c "mkdir %systemroot%\assembly"
$ wine "c:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\ngen.exe" update
...
$ ls -1 .wine/drive_c/windows/assembly/*
.wine/drive_c/windows/assembly/NativeImages_v4.0.30319_32:
Accessibility
index40.dat
index6f.dat
Microsoft.Build.Eng#
Microsoft.Build.Fra#
Microsoft.Build.Tas#
Microsoft.Build.Uti#
Microsoft.JScript
Microsoft.Transacti#
Microsoft.VisualBas#
Microsoft.VisualC
mscorlib
PresentationBuildTa#
PresentationCore
PresentationFramewo#
PresentationUI
ReachFramework
SMDiagnostics
System
System.Activities
...
UIAutomationProvider
UIAutomationTypes
WindowsBase
WindowsFormsIntegra#
XamlBuildTask

.wine/drive_c/windows/assembly/temp:
--- snip ---

$ sha1sum dotNetFx40_Full_x86_x64.exe 
58da3d74db353aad03588cbb5cea8234166d8b99  dotNetFx40_Full_x86_x64.exe

$ du -sh dotNetFx40_Full_x86_x64.exe 
49M    dotNetFx40_Full_x86_x64.exe

$ wine --version
wine-3.17-51-g5f4e5d9a38

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