Sdk: dotnet compile issue with Microsoft.Cci.ISymUnmanagedWriter5

Created on 16 Feb 2016  路  47Comments  路  Source: dotnet/sdk

Hello,

I have just installed dotnet cli using installer from here: http://dotnet.github.io/getting-started/

And I can't get it to compile HelloWorld.cs.

Here's what I do:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\tmp\dotnettest>dotnet new
Created new C# project in C:\tmp\dotnettest.

C:\tmp\dotnettest>dotnet restore
log  : Restoring packages for C:\tmp\dotnettest\project.json...
info : Committing restore...
log  : Restore completed in 3328ms.
NuGet Config files used:
    C:\tmp\dotnettest\NuGet.Config
    C:\Users\dmsu\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
    https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
    https://api.nuget.org/v3/index.json

C:\tmp\dotnettest>dotnet run
Compiling dotnettest for DNXCore,Version=v5.0
C:\Program Files\dotnet\bin\dotnet.exe compile-csc @C:\tmp\dotnettest\obj\Debug\dnxcore50\dotnet-compile.rsp returned Exit Code 1
C:\tmp\dotnettest\error CS0041: Unexpected error writing debug information -- 'Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Cci.ISymUnmanagedWriter5'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{DCF7780D-BDE9-45DF-ACFE-21731A32000C}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).'

Compilation failed.
    0 Warning(s)
    1 Error(s)
Bug

Most helpful comment

Installing C++ Redist shouldn't be necessary. The binary we are loading is distributed with dotnet cli. Perhaps there is an issue in load path and CoreCLR loads it from some other path first.

All 47 comments

What version of windows?

Windows 7 SP1

CC @tmat

Looks like our PDB COM object doesn't implement ISymUnmanagedWriter5. That interface should be present. Wondering if Windows 7 has anything to do with it.

@tmat could this have anything to do with the update to 1.3.0 of System.Reflection.Metadata?

@davidfowl doubtful. That error is coming from here

http://source.roslyn.io/#Microsoft.CodeAnalysis/NativePdbWriter/PdbWriter.cs,808

It's essentially an error casting the PDB COM object to an interface that it should definitely be implementing.

@tannergooding I think we didn't include Microsoft.DiaSymReader.Native in dotnet cli and Tanner fixed that. If the library is not present then we fall back to the diasymreader.dll version that ships with the OS, which on Win7 might be quite old.

What's the fix here, then, @tmat?

The fix should have been there already. @tannergooding, can you point at the commit?
You can double check whether Microsoft.DiaSymReader.Native.x86.dll is deployed next to Microsoft.CodeAnalysis.dll in dotnet cli distro.

See dotnet/cli#1209. @piotrpMSFT, Can you confirm that the latest MSI installer (found from here: https://dotnet.github.io/getting-started/) contains at least commit 5f5a59a1363c89acabb760fac3589425a8e670ef?

@tannergooding that change was first available in build 1312. I'm checking to see if that build has made it to the getting-started page. We had some build issues lately due to a big build system revamp.

Can confirm that as of about 10-15 minutes ago the change/fix had NOT made it to the installer on that web page, because I just ran into the same exact problem. More info: This repro'd on Windows 7 SP1 and then also on Windows 10 Pro 10.0.10586. Thanks!

Thanks @markdall. That's interesting. We got Windows publishing unblocked this morning. Let me take a look at the MSI...

@piotrpMSFT Thanks!

I saw the PR was merged so I thought I'd just clone the repo and build it for myself to get the fix that way, but running build.cmd after cloning the repository failed with the same error. Guess I'll just wait. :)

@markdall can yo update to the latest and try again?

@davidfowl After a pull just now, build.cmd still failed like so: http://pastebin.com/PbeTmbZ2 (Same error. Windows 7 6.1.7601)

Thanks though!

I'm not seeing this bug repro anymore. I created a new Win7 SP1 machine to test on and ran through the following repro steps:

  1. Used the MSI installer from http://dotnet.github.io/getting-started/

    • Note: This was a clean machine without VS hence I did not run the patch for VS 2012.

  2. Opened a cmd shell and moved into a temp directory
  3. dotnet new
  4. dotnet restore
  5. dotnet compile

This completed successfully and a subsequent dotnet run printed out "Hello World!" as expected.

@susl is there any step I missed in this repro?

I downloaded 1.0.0.1540 shp 40,685,674 02-25-2016 dotnet-win-x64.latest.exe and the issue still reproduced on my Windows 7 machine. My Windows 10 machine was able to succeed at home. Not sure what to tell you.

error CS0041: Unexpected error writing debug information -- 'Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Cci.ISymUnmanagedWriter5'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{DCF7780D-BDE9-45DF-ACFE-21731A32000C}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

@markdall can you run a dir Microsoft.Dia* command inside c:\Program Files\dotnet\bin and send us the results? In particular I'm interested to see if your installation has the following files:

  • Microsoft.DiaSymReader.dll
  • Microsoft.DiaSymReader.Native.amd64.dll

@markdall is your machine a 32 bit OS?

Is vs installed on the machine?

Hi! Thanks, here's the info:

dir "c:\Program Files\dotnet\bin\Microsoft.dia*"
Volume in drive C is Windows
Volume Serial Number is 008B-965B

Directory of c:\Program Files\dotnet\bin

10/07/2015 11:48 AM 24,016 Microsoft.DiaSymReader.dll
11/03/2015 06:08 PM 1,212,688 Microsoft.DiaSymReader.Native.amd64.dll

and for that matter a filever of it instead of just a dir:

filever "c:\Program Files\dotnet\bin\Microsoft.dia*"
c:\program files\dotnet\bin\Microsoft.DiaSymReader.dll
--a-- W32i DLL - 1.0.6.51007 shp 24,016 10-07-2015 microsoft.diasymreader.dll
c:\program files\dotnet\bin\Microsoft.DiaSymReader.Native.amd64.dll
--a-- WAMD64 DLL ENU 14.0.23431.0 shp 1,212,688 11-03-2015 microsoft.diasymreader.native.amd64.dll

The OS is 64-bit Windows 7 Enterprise (6.1.7601).

It does have VS 2010 and VS2013 installed.

@markdall did you install the C++ redist listed on the getting started page?

@jaredpar Yes and it's installed (downloaded again and ran it and it offered uninstall/repair). Full disclosure though - that redist says it's for VS 2012 U4 and we're on U3 - can't go to U4 at work until they do it officially. Still, the C++ redist _is_ installed.

I'm a bit stumped on this bug right now. Based on all the data here my working theory is the following call in the compiler is failing:

http://source.roslyn.io/#Microsoft.CodeAnalysis/NativePdbWriter/PdbWriter.cs,793

If that call succeeded the returned COM object would absolutely be convertible to ISymUnmanagedWriter5. The error though indicates this particular conversion is failing hence it seems that our call to CreateSymWriter64 must be failing, we are falling back to Activator.CreateInstance and getting an object back that does not implement ISymUnmanagedWriter5.

@tmat when was ISymUnmanagedWriter5 introduced? The documentation says Net 4.0 but given this is a native object that doesn't seem to be a valid release date.

@jaredpar I have repaired my VC++ 2012 Redist and also installed 2013 and 2015.

And now everything seems to be working..

Also, I installed version 1.0.0.1584, if that matters.
Now "dotnet run" works fine with HelloWorld, but "dotnet compile" shows me this:

No executable found matching command "dotnet-compile"

@susl dotnet compile is not a command i mean not anymore . you should use dotnet build instead

I could repro this on
$ dotnet --version
.NET Command Line Tools (1.0.0-beta-001598)

Product Information:
Version: 1.0.0-beta-001598
Commit Sha: 7582649f88

Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
Runtime Id: win10-x64

(Re)Installing VC++ Redistributable 2015 fixed the issue.

I could repro this on a fresh machine:

.NET Command Line Tools (1.0.0-beta-001598)

Product Information:
Version: 1.0.0-beta-001598
Commit Sha: 7582649f88

Runtime Environment:
OS Name: Windows
OS Version: 10.0.10240
OS Platform: Windows
Runtime Id: win10-x64

VS not installed

_updated os to OS Version: 10.0.10586 - still no joy_

I ran into the same issue and installed: Visual C++ Redistributable for Visual Studio 2015.
It solved it.

Installing C++ Redist shouldn't be necessary. The binary we are loading is distributed with dotnet cli. Perhaps there is an issue in load path and CoreCLR loads it from some other path first.

Just installed 64bit dotnet cli for WIndows. It's missing Microsoft.DiaSymReader.Native.amd64.dll in shared\Microsoft.NETCore.App\1.0.0-rc2-23911. Not sure what the shared stuff is.
@jaredpar @agocke

@tmat when i tested this out that DLL was present. Guess that's why it was working on my machine. I'm not sure who owns deploying this binary.

@jaredpar The binary is in sdk directory but it is not in Microsoft.NETCore.App. I don't know what's the purpose of these two directories.

Also having this problem. Not sure what in the world this error even begins to mean.

I just hit this when trying out on a clean WS2008R2 machine. I was able to examine a procmon trace and found that the problem has to do with the dependencies of Microsoft.DiaSymReader.Native.amd64.dll. It looks like this native binary was built against VC++ 14. That should not be a pre-requisite of dotnet CLI AFAIK. For other components we specifically build them against the OS CRT to avoid this dependency. Here are the relevant probing failures from LoadLibrary:

12:10:22.5553158 PM dotnet.exe  3140    CloseFile   C:\Users\ericstj\Downloads\dotnet-dev-win-x64.latest\sdk\1.0.0-beta-002215\runtimes\win-x64\native\Microsoft.DiaSymReader.Native.amd64.dll  SUCCESS 
12:10:22.5558098 PM dotnet.exe  3140    CreateFile  C:\Users\ericstj\Downloads\dotnet-dev-win-x64.latest\sdk\1.0.0-beta-002215\runtimes\win-x64\native\VCRUNTIME140.dll NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5561234 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\VCRUNTIME140.dll    NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5566377 PM dotnet.exe  3140    CreateFile  C:\Windows\system\VCRUNTIME140.dll  NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5569044 PM dotnet.exe  3140    CreateFile  C:\Windows\VCRUNTIME140.dll NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5571705 PM dotnet.exe  3140    CreateFile  C:\Users\ericstj\test\VCRUNTIME140.dll  NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5574418 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\VCRUNTIME140.dll    NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5577062 PM dotnet.exe  3140    CreateFile  C:\Windows\VCRUNTIME140.dll NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5579676 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\wbem\VCRUNTIME140.dll   NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5582273 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\WindowsPowerShell\v1.0\VCRUNTIME140.dll NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5584791 PM dotnet.exe  3140    CreateFile  C:\AegisTools\Bin\VCRUNTIME140.dll  NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5587431 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\VCRUNTIME140.dll    NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5590045 PM dotnet.exe  3140    CreateFile  C:\Windows\VCRUNTIME140.dll NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5592528 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\wbem\VCRUNTIME140.dll   NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5595215 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\WindowsPowerShell\v1.0\VCRUNTIME140.dll NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5597628 PM dotnet.exe  3140    CreateFile  C:\AegisTools\Bin\VCRUNTIME140.dll  NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5599385 PM dotnet.exe  3140    CreateFile  C:\users\ericstj\Downloads\dotnet-dev-win-x64.latest"\VCRUNTIME140.dll  NAME INVALID    Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5603406 PM dotnet.exe  3140    CreateFile  C:\Users\ericstj\Downloads\dotnet-dev-win-x64.latest\sdk\1.0.0-beta-002215\Microsoft.DiaSymReader.Native.amd64.dll  NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5606327 PM dotnet.exe  3140    CreateFile  C:\Users\ericstj\Downloads\dotnet-dev-win-x64.latest\Microsoft.DiaSymReader.Native.amd64.dll    NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5609136 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\Microsoft.DiaSymReader.Native.amd64.dll NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5613017 PM dotnet.exe  3140    CreateFile  C:\Windows\system\Microsoft.DiaSymReader.Native.amd64.dll   NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5615562 PM dotnet.exe  3140    CreateFile  C:\Windows\Microsoft.DiaSymReader.Native.amd64.dll  NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5618107 PM dotnet.exe  3140    CreateFile  C:\Users\ericstj\test\Microsoft.DiaSymReader.Native.amd64.dll   NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5620710 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\Microsoft.DiaSymReader.Native.amd64.dll NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5623521 PM dotnet.exe  3140    CreateFile  C:\Windows\Microsoft.DiaSymReader.Native.amd64.dll  NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5626120 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\wbem\Microsoft.DiaSymReader.Native.amd64.dll    NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5628734 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.DiaSymReader.Native.amd64.dll  NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5631214 PM dotnet.exe  3140    CreateFile  C:\AegisTools\Bin\Microsoft.DiaSymReader.Native.amd64.dll   NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5633942 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\Microsoft.DiaSymReader.Native.amd64.dll NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5636764 PM dotnet.exe  3140    CreateFile  C:\Windows\Microsoft.DiaSymReader.Native.amd64.dll  NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5639326 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\wbem\Microsoft.DiaSymReader.Native.amd64.dll    NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
12:10:22.5641838 PM dotnet.exe  3140    CreateFile  C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.DiaSymReader.Native.amd64.dll  NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a

I can see from https://github.com/dotnet/cli/pull/1939 that folks are planning to solve this in the machine-wide CLI by chaining in the VC redist. I would prefer that we don't do that since it is broken for the xcopy scenario.

/cc @piotrpMSFT @ellismg

@gkhanna79 who wanted the chaining to be done.

Is there a reason we just don't reference the DiaSymreader NuGet in the CLI?

@jaredpar That won't solve the dependency on VS++14. Microsoft.DiaSymReader.Native.amd64.dll is build from WinCComp branch.

CLI is picking up the nuget package: https://github.com/dotnet/cli/blob/rel/1.0.0/src/compilers/project.json#L13

You need a new version of that package with a DLL built against the OS CRT (msvcrt.dll). We do this already for native components in CoreFx. Regardless of where you build it from you should be able to set up the toolset to compile against the OS CRT.

Tracked by internal bug 209522

@ericstj @tmat @jaredpar Is this geting fixed for rc2?

I think for RC2 folks are reccomending to install the VC redist.

@ericstj Is that a different redist than the one listed? Because the one on the page doesn't fix the problem...

@markdall it definitely fixed it for me. Are you sure you're installing it and it completes successfully? If so, grab a procmon trace of the failure and I can take a look an see if there is some other missing dependency.

Microsoft.DiaSymReader.Native v1.4.0-rc has just been published, which doesn't have dependency on VCRUNTIME140 anymore.

Was this page helpful?
0 / 5 - 0 ratings