sdk icon indicating copy to clipboard operation
sdk copied to clipboard

dotnet build fails with COM exception on Win7

Open victorhurdugaci opened this issue 10 years ago • 25 comments

You can use the code under https://github.com/aspnet/dnx-watch

C:\Users\victorhu\dev\dnx-watch\src\Microsoft.DotNet.Watcher.Core>dotnet build
Compiling Microsoft.DotNet.Watcher.Core for DNXCore,Version=v5.0
C:\Users\victorhu\AppData\Local\Microsoft\dotnet\cli\bin\dotnet.exe compile-csc @C:\Users\victorhu\dev\dnx-watch\src\Microsoft.DotNet.Watcher.Core\obj\Debug\dnx
core50\dotnet-compile.rsp returned Exit Code 1
C:\Users\victorhu\dev\dnx-watch\src\Microsoft.DotNet.Watcher.Core\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)

Time elapsed 00:00:03.4682894

victorhurdugaci avatar Feb 23 '16 21:02 victorhurdugaci

PS: This is on Win7 SP1 with the latest updates and the project I'm compiling only targets dnxcore50 (no desktop)

victorhurdugaci avatar Feb 23 '16 22:02 victorhurdugaci

I wonder if this is Win7 or just a machine (including Win10) that does not have Visual Studio installed.

moozzyk avatar Feb 24 '16 00:02 moozzyk

Running windows 8 and vs 2013 pro i have the same issue

smitty92 avatar Feb 24 '16 14:02 smitty92

This error went away after installing VS2015. @piotrpMSFT is this an expected limitation, not being able to run without VS?

victorhurdugaci avatar Feb 24 '16 23:02 victorhurdugaci

I meet same error and fixed when I install "Visual C++ Redistributable for Visual Studio 2015": https://www.microsoft.com/en-hk/download/details.aspx?id=48145

JumpingYang001 avatar Feb 26 '16 05:02 JumpingYang001

. @JumpingYang001 used Windows Server 2012 R2

vors avatar Feb 26 '16 07:02 vors

@vors did this repro for you on Windows Server 2012 R2? And if it did, did it go away after installing the CRT for VS2015?

thesmithee avatar Feb 27 '16 05:02 thesmithee

@blackdwarf I repro this on WS2012R2 as below picture:

repro1

It works fine after install "Visual C++ Redistributable for Visual Studio 2015". repro2

JumpingYang001 avatar Feb 29 '16 04:02 JumpingYang001

@JumpingYang001 ok, so this seems like a pre-req/documentation issue then. Will update the docs.

thesmithee avatar Feb 29 '16 04:02 thesmithee

@piotrpMSFT would be good to know why we have this pre-req though.

thesmithee avatar Feb 29 '16 04:02 thesmithee

@blackdwarf I agree. I thought the whole point of .NET CLI was you could just build and run code like you can on Linux--all with one simple install (like using apt-get for Ruby). The readme here does not mention that there are other dependencies on Windows.

nathan-alden-sr avatar Mar 01 '16 17:03 nathan-alden-sr

@nathan-alden there shouldn't be outside of CRT. We also have an issue that tracks chaining it in dotnet/cli#1627 .

thesmithee avatar Mar 01 '16 18:03 thesmithee

This is not a doc issue. It is a product bug. We just learned yesterday that CRT is now a dependency again (we had gotten rid of it through linking but new usages popped up).

We can document a workaround, but the product is currently broken.

@sridhar-ms

TheRealPiotrP avatar Mar 02 '16 00:03 TheRealPiotrP

@piotrpMSFT @gkhanna79 @schellap Any idea when we introduced the dependency on CRT redist? I see this PR has not been merged yet - https://github.com/dotnet/coreclr/pull/3425

Sridhar-MS avatar Mar 02 '16 00:03 Sridhar-MS

By virtue of building with VS 2015, the native toolset always inserts the dependency on uCRT and that is made available downlevel (to Win10) by installing the redist. This is true for any native component built in any repo.

Also, presence of this CRT redist is also be required when we go to smaller OS SKUs.

Finally, I believe we are on similar boat on non-Windows - need to install components like libunwind (which require sudo unless previously installed) to be present for CoreCLR to work.

gkhanna79 avatar Mar 02 '16 00:03 gkhanna79

This is true for any native component built in any repo.

In this case, Roslyn is bringing it in through NativePdbWriter:

https://github.com/dotnet/roslyn/blob/master/src/Compilers/Core/Portable/NativePdbWriter/ISymUnmanagedWriter.cs#L21

    [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("DCF7780D-BDE9-45DF-ACFE-21731A32000C"), SuppressUnmanagedCodeSecurity]
    internal interface ISymUnmanagedWriter5
    {

schellap avatar Mar 02 '16 00:03 schellap

Ok. I was under the impression that we were statically linking all the CRT libraries.

Sridhar-MS avatar Mar 02 '16 01:03 Sridhar-MS

Static linking of CRT (or even carrying it applocal) puts the servicing burden on your component if there is a need to service it (e.g. security fix).

gkhanna79 avatar Mar 02 '16 01:03 gkhanna79

@piotrpMSFT ok, so I'm taking the documentation label off. So, what is the plan?

thesmithee avatar Mar 02 '16 01:03 thesmithee

I just ran into the same issue. But after installing "Visual C++ Redistributable for Visual Studio 2015": https://www.microsoft.com/en-hk/download/details.aspx?id=48145 it fixed my simple build.

My machine is Windows 7 in the enterprise enviroment Service Pack 1. Visual Studio 2012.

I suggest that dotnet utility installs this package in the background if needed.

kdcllc avatar Mar 10 '16 20:03 kdcllc