Skip to content
This repository was archived by the owner on Dec 18, 2017. It is now read-only.

Failed to initalize runtime (80131522) on Beta6/Beta7 x64 #2343

Closed
NoralK opened this issue Jul 25, 2015 · 40 comments
Closed

Failed to initalize runtime (80131522) on Beta6/Beta7 x64 #2343

NoralK opened this issue Jul 25, 2015 · 40 comments
Assignees
Milestone

Comments

@NoralK
Copy link

NoralK commented Jul 25, 2015

I received this error on a new clean installation.
Windows 7 Enterprise x64 - SP1 VM with UAC turned off (NO PATCHES)
.Net v4.5.2
PowerShell v4.0 x64
Internet Explorer 11 x64 with the patches it installs
Node.js v0.12.7 x64
VS Code v0.5.0

Environment Variable

DNX_UNSTABLE_FEED=https://www.myget.org/F/aspnetbeta6/api/v2

Installed DNVM

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}"

Installed Beta6 x64 package by:

dnvm upgrade -arch x64 -u -r clr

DNVM List

*    1.0.0-beta6    clr    x64    C:\Users\Noral\.dnx\runtimes    default

closed command prompt
opened command prompt

dnu restore
Failed to initalize runtime (80131522)

However, if I do the following:

dnvm upgrade -arch x86 -u -r clr

DNVM List

     1.0.0-beta6    clr    x64    C:\Users\Noral\.dnx\runtimes
*    1.0.0-beta6    clr    x86    C:\Users\Noral\.dnx\runtimes    default

I can run dnu for x86. Did I miss something?

@NoralK NoralK changed the title Failed to initalize runtime (80131522) on Beta6 x64 Failed to initalize runtime (80131522) on Beta6/Beta7 x64 Jul 25, 2015
@NoralK
Copy link
Author

NoralK commented Jul 25, 2015

I think this might be related. I build a simple MVC project, compiles fine for Beta5, and I get this error:

E:\Projects\HelloMvc>dnu build --quiet
Microsoft .NET Development Utility CLR-x86-1.0.0-beta7-12274


Building HelloMvc for DNX,Version=v4.5.1
System.TypeLoadException: Could not load type 'Microsoft.Framework.Runtime.ICompilerOptionsProvider' from assembly 'Microsoft.Framework.Runtime.Abstra
ctions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at Microsoft.AspNet.Mvc.RazorPreCompileModule.BeforeCompile(BeforeCompileContext context)
   at Microsoft.Framework.Runtime.Roslyn.RoslynCompiler.CompileProject(CompilationProjectContext projectContext, IEnumerable`1 incomingReferences, IEn
umerable`1 incomingSourceReferences, Func`1 resourcesResolver)
   at Microsoft.Framework.Runtime.Roslyn.RoslynProjectCompiler.CompileProject(CompilationProjectContext projectContext, Func`1 referenceResolver, Func
`1 resourcesResolver)
   at Microsoft.Framework.Runtime.ProjectLibraryExportProvider.<>c__DisplayClass5_0.<GetLibraryExport>b__0(CacheContext ctx)
   at Microsoft.Framework.Runtime.Caching.CacheExtensions.<>c__DisplayClass0_0`1.<Get>b__0(CacheContext ctx)
   at Microsoft.Framework.Runtime.Caching.Cache.CreateEntry(Object k, Func`2 acquire)
   at Microsoft.Framework.Runtime.Caching.Cache.<>c__DisplayClass5_0.<AddEntry>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Microsoft.Framework.Runtime.Caching.Cache.Get(Object key, Func`2 factory)
   at Microsoft.Framework.Runtime.Caching.CacheExtensions.Get[T](ICache cache, Object key, Func`2 factory)
   at Microsoft.Framework.Runtime.ProjectLibraryExportProvider.GetLibraryExport(CompilationTarget target)
   at Microsoft.Framework.Runtime.CompositeLibraryExportProvider.<>c__DisplayClass2_0.<GetLibraryExport>b__0(ILibraryExportProvider r)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Microsoft.Framework.Runtime.CompositeLibraryExportProvider.GetLibraryExport(CompilationTarget target)
   at Microsoft.Framework.Runtime.ProjectExportProviderHelper.GetExportsRecursive(ILibraryManager manager, ILibraryExportProvider libraryExportProvide
r, CompilationTarget target, Func`2 include)
   at Microsoft.Framework.Runtime.ProjectExportProviderHelper.GetExportsRecursive(ILibraryManager manager, ILibraryExportProvider libraryExportProvide
r, CompilationTarget target, Boolean dependenciesOnly)
   at Microsoft.Framework.Runtime.LibraryManager.<>c__DisplayClass21_0.<GetAllExports>b__0(CacheContext ctx)
   at Microsoft.Framework.Runtime.Caching.CacheExtensions.<>c__DisplayClass0_0`1.<Get>b__0(CacheContext ctx)
   at Microsoft.Framework.Runtime.Caching.Cache.CreateEntry(Object k, Func`2 acquire)
   at Microsoft.Framework.Runtime.Caching.Cache.<>c__DisplayClass5_0.<AddEntry>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Microsoft.Framework.Runtime.Caching.Cache.Get(Object key, Func`2 factory)
   at Microsoft.Framework.Runtime.Caching.CacheExtensions.Get[T](ICache cache, Object key, Func`2 factory)
   at Microsoft.Framework.Runtime.LibraryManager.GetAllExports(String name, String aspect)
   at Microsoft.Framework.Runtime.LibraryManager.GetAllExports(String name)
   at Microsoft.Framework.PackageManager.BuildContext.ShowDependencyInformation(IReport report)
   at Microsoft.Framework.PackageManager.BuildContext.Initialize(IReport report)
   at Microsoft.Framework.PackageManager.BuildManager.BuildInternal(String projectPath)
   at Microsoft.Framework.PackageManager.BuildManager.Build()
   at Microsoft.Framework.PackageManager.BuildConsoleCommand.<>c__DisplayClass0_0.<Register>b__1()
   at Microsoft.Framework.Runtime.Common.CommandLine.CommandLineApplication.Execute(String[] args)
   at Microsoft.Framework.PackageManager.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
   at dnx.host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, FrameworkName targetFramework)
   at dnx.host.RuntimeBootstrapper.ExecuteAsync(String[] args, FrameworkName targetFramework)
   at dnx.host.RuntimeBootstrapper.Execute(String[] args, FrameworkName targetFramework)

Noral

@NoralK
Copy link
Author

NoralK commented Jul 25, 2015

Some more information:

On clean installation of:
Windows 8.1 Enterprise with Update x64 VM with UAC turned off (NO PATCHES)
.Net v4.5.2
Node.js v0.12.7 x64
VS Code v0.5.0

I am able to compile both Beta6 and Beta7.

@jtbennett
Copy link

I get the same error when deploying to an Azure web site via GitHub. It's a one-page MVC app that works and deploys to Azure just fine using beta 5. I changed all instances of "1.0.0-beta5" to "1.0.0-beta6" in global.json and project.json. Global.json specifies "clr" and "x64". Azure website is set to x64. Project builds and runs fine locally (on OS X).

Here's the log file from the Azure deploy:

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET 5 Web Application deployment.
Downloading dnx-clr-win-x64.1.0.0-beta6 from https://www.nuget.org/api/v2
Installing to D:\local\UserProfile\.dnx\runtimes\dnx-clr-win-x64.1.0.0-beta6
Adding D:\local\UserProfile\.dnx\runtimes\dnx-clr-win-x64.1.0.0-beta6\bin to process PATH
Native image generation (ngen) is skipped. Include -Ngen switch to turn on native image generation to improve application startup time.
Failed to initalize runtime (80131522)An error has occurred during web site deployment.
Handling ASP.NET 5 Web Application deployment.
Downloading dnx-clr-win-x64.1.0.0-beta6 from https://www.nuget.org/api/v2
Installing to D:\local\UserProfile\.dnx\runtimes\dnx-clr-win-x64.1.0.0-beta6
Adding D:\local\UserProfile\.dnx\runtimes\dnx-clr-win-x64.1.0.0-beta6\bin to process PATH
Native image generation (ngen) is skipped. Include -Ngen switch to turn on native image generation to improve application startup time.
Failed to initalize runtime (80131522)An error has occurred during web site deployment.
C:\Program Files (x86)\SiteExtensions\Kudu\47.40727.1709\bin\scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

@NoralK
Copy link
Author

NoralK commented Jul 29, 2015

@danroth27 do you have any insights/thoughts to why this is happening?

@NoralK
Copy link
Author

NoralK commented Jul 30, 2015

Sorry @danroth27 - I initially thought about sending this to you since you are on MVC but you were not a contributor on dnx. I had already copied your name to the clipboard when I thought I had copied @davidfowl since he is on both projects. Guess I needs better proofreaders.

David - do you have any insights/thoughts to why this is happening?

@NoralK
Copy link
Author

NoralK commented Jul 31, 2015

Hello ... anyone?

@danroth27
Copy link
Member

@glennc

@NoralK
Copy link
Author

NoralK commented Aug 5, 2015

Installed beta7-12302 clr x64 on the Windows 7 Enterprise machine and I am still getting:

E:\Projects\HelloMvc>dnu
Failed to initalize runtime (80131522)

Thoughts?

@moozzyk
Copy link
Contributor

moozzyk commented Aug 5, 2015

@NoralK - can you turn on tracing (set DNX_TRACE=1), run dnu and show the output?

@NoralK
Copy link
Author

NoralK commented Aug 5, 2015

Here you go:

E:\Projects\HelloMvc>set DNX_TRACE=1

E:\Projects\HelloMvc>dnu
The servicing index file at: C:\Program Files (x86)\Microsoft DNX\Servicing\index.txt does not exist or could not be opened.
Loaded module: dnx.clr.dll
Found export: CallApplicationMain
Failed to initalize runtime (80131522)

These directories Microsoft DNX on down and the file index.txt are not in C:\Program Files (x86) nor in C:\Program Files.

It should be noted that on Windows 8.1, where it does work, these are also not present.

@moozzyk
Copy link
Contributor

moozzyk commented Aug 5, 2015

This does not seem to be beta7 - can you show the output of dnvm list ?

@NoralK
Copy link
Author

NoralK commented Aug 5, 2015

It is beta7. Here is the output:

E:\Projects\HelloMvc>dnvm list

Active Version           Runtime Architecture Location                     Alias
------ -------           ------- ------------ --------                     -----
       1.0.0-beta6       clr     x64          C:\Users\Noral\.dnx\runtimes
       1.0.0-beta7-12274 clr     x64          C:\Users\Noral\.dnx\runtimes
       1.0.0-beta7-12274 clr     x86          C:\Users\Noral\.dnx\runtimes
       1.0.0-beta7-12275 clr     x64          C:\Users\Noral\.dnx\runtimes
       1.0.0-beta7-12290 clr     x64          C:\Users\Noral\.dnx\runtimes
  *    1.0.0-beta7-12302 clr     x64          C:\Users\Noral\.dnx\runtimes default

I have tried cleaning out all runtime, on another machine, and get the same output with just 1.0.0-beta7-12302.

@moozzyk
Copy link
Contributor

moozzyk commented Aug 5, 2015

Thanks. I need one more thing (hopefully the last one) - what does it show when you do where dnx from your command prompt?

@NoralK
Copy link
Author

NoralK commented Aug 5, 2015

Here you go:

E:\Projects\HelloMvc>where dnx
C:\Users\Noral\.dnx\runtimes\dnx-clr-win-x64.1.0.0-beta7-12302\bin\dnx.exe

Thank you for the help.

@NoralK
Copy link
Author

NoralK commented Aug 5, 2015

Take a look at this separate issue - dotnet/Scaffolding#106 at the dump from setting DNX_TRACE=1.

Dnx also has the issue, but on Windows 8.1 (where issue #106 occurs) I can run dnu and dnx without "Failed to initalize runtime (80131522)".

@moozzyk
Copy link
Contributor

moozzyk commented Aug 5, 2015

Do you actually have .NET Framework 4.5.1 installed on your Windows 7 box?

@NoralK
Copy link
Author

NoralK commented Aug 5, 2015

From the #106 error I found this reference:
C:\ProgramData\Microsoft DNX\BreadcrumbStore but in reality it is located here C:\ProgramData\Microsoft\NetFramework\BreadcrumbStore on Windows 8.1 and Windows 7. There is no folder called Microsoft DNX

@NoralK
Copy link
Author

NoralK commented Aug 5, 2015

I have .Net Framework v4.5.2 installed on both Windows 7 (having issue) and Windows 8.1.

@moozzyk
Copy link
Contributor

moozzyk commented Aug 5, 2015

You don't need to worry about missing C:\ProgramData\Microsoft DNX and/or breadcrumbs. It's not a problem here. I will try to create a clean Win7 OS with .NET Framework 4.5.2 to see if I can repro this.

@NoralK
Copy link
Author

NoralK commented Aug 5, 2015

From my initial post I listed all of my steps - Window 7 Enterprise x64 has no patches, except what IE 11 installed.

@moozzyk
Copy link
Contributor

moozzyk commented Aug 5, 2015

Good news: I was able to reproduce this issue.
Bad news: this seems to be a bug in CLR. 0x80131522 is COR_E_TYPELOAD meaning the CLR could not load a type. To investigate this I turned on fusion logging but then suddenly everything started to work and there is no error. As soon as I turn fusion logging off dnx will fail with COR_E_TYPELOAD.

@moozzyk
Copy link
Contributor

moozzyk commented Aug 5, 2015

I installed .NET Framework 4.6 (http://www.microsoft.com/en-us/download/details.aspx?id=48130) and this fixed the issue.

@NoralK Can you try this and let me know if it works for you?

@NoralK
Copy link
Author

NoralK commented Aug 5, 2015

I installed .Net 4.6 and I can launch dnu and dnx. Does this mean the requirements will change or will this be investigated further?

@moozzyk
Copy link
Contributor

moozzyk commented Aug 5, 2015

Thanks for confirmation. I am glad it is now working.

At this point the issue seems to affect only Windows 7 x64. IIS hosted apps are not impacted by this. I guess if people hit this the workaround will be to either upgrade to .NET Framework 4.6 or run the app with the x86 runtime.

/cc @danroth27 @davidfowl

@NoralK
Copy link
Author

NoralK commented Aug 5, 2015

If that is the case then I would suggest that the Readme.md in all the projects should reflect the minimum .Net version as 4.6.

Maybe the root of the problem can be fixed eventually.

@jtbennett
Copy link

I'm getting this error deploying a beta 6 asp.net site to Azure Web Apps (details earlier in this thread). That's IIS-hosted and (presumably) not Win 7.

Does this mean I need to wait for Azure to put .net 4.6 on those machines?

@analogrelay
Copy link
Contributor

We should definitely make sure we work without .NET 4.6 installed, @moozzyk was just providing a possible workaround. Obviously there is a bigger issue to resolve here given than Azure only provides earlier versions of .NET

@moozzyk
Copy link
Contributor

moozzyk commented Aug 6, 2015

@jtbennett - I suspect that the issue was introduced in this change 05ee5b3 where we changed the way we load the domain manager. However in case of IIS hosted apps we don't bootstrap CLR ourselves and therefore this code is not executed. I believe that in your case this is not the app itself that fails but one of the steps in the deploy.cmd script is using dnx.exe and this causes the failure. Maybe you could try modifying the deploy.cmd script to use x86 runtime for the deployment steps to workaround the issue (you would likely want to install both x86 and x64 runtimes so that the deploy script uses x86 runtime for deployment steps but the app itself uses x64 runtime)?

@moozzyk
Copy link
Contributor

moozzyk commented Aug 7, 2015

Fixed in 31093b2

@NoralK
Copy link
Author

NoralK commented Aug 7, 2015

@moozzyk As of beta7-12321 the problem still persists with .Net Framework v4.5.2:

C:\Users\Noral>dnvm list

Active Version           Runtime Architecture Location                     Alias
------ -------           ------- ------------ --------                     -----
       1.0.0-beta6       clr     x64          C:\Users\Noral\.dnx\runtimes
       1.0.0-beta7-12274 clr     x64          C:\Users\Noral\.dnx\runtimes
       1.0.0-beta7-12275 clr     x64          C:\Users\Noral\.dnx\runtimes
       1.0.0-beta7-12290 clr     x64          C:\Users\Noral\.dnx\runtimes
       1.0.0-beta7-12302 clr     x64          C:\Users\Noral\.dnx\runtimes
  *    1.0.0-beta7-12321 clr     x64          C:\Users\Noral\.dnx\runtimes default



C:\Users\Noral>dnu
Failed to initalize runtime (80131522)
C:\Users\Noral>dnx
Failed to initalize runtime (80131522)

Was your commit in this build? Can we keep the ticket open until both of us have resolution.

I also just noticed this - can the spelling of "initalize" be changed to "initialize".

@moozzyk moozzyk added this to the 1.0.0-beta7 milestone Aug 7, 2015
@moozzyk moozzyk added the bug label Aug 7, 2015
@moozzyk
Copy link
Contributor

moozzyk commented Aug 7, 2015

No the build with the fix is not out there yet. I will fix the spelling next time I touch this code - thanks for pointing this out.

@moozzyk moozzyk self-assigned this Aug 7, 2015
@moozzyk
Copy link
Contributor

moozzyk commented Aug 7, 2015

@NoralK - this issue is fixed in 12325

@NoralK
Copy link
Author

NoralK commented Aug 7, 2015

I can confirm that beta7-12325 does solve the issue - obviously it will not be solved on beta6. @jtbennett - I am not using Azure Web Apps so I cannot comment on that.

Thank you @moozzyk and @anurse

@moozzyk
Copy link
Contributor

moozzyk commented Aug 7, 2015

Thanks for confirmation @NoralK. You are correct beta6 won't be fixed. @jtbennett - stay tuned for beta7 or use the unstable feed.

@jtbennett
Copy link

Thanks! Will give beta 7 a try when it's released.
-JB
On Aug 7, 2015 7:09 PM, "Pawel Kadluczka" [email protected] wrote:

Thanks for confirmation @NoralK https://github.com/NoralK. You are
correct beta6 won't be fixed. @jtbennett https://github.com/jtbennett -
stay tuned for beta7 or use the unstable feed.


Reply to this email directly or view it on GitHub
#2343 (comment).

@darrenhull
Copy link

My app works locally, and I had this issue on the server after publishing the app but after installing 4.6 i get CS1703: multiple assemblies with equivalent identity have been imported. However it works fine locally. Any Ideas?

@jtbennett
Copy link

Just confirming that beta 7 works on Azure web apps. It got hung up deleting a DLL that was in use (Microsoft.AspNet.FeatureModel -- one of those that was renamed/removed, I think). Stopping the app, deploying, and restarting worked.

I'll use this comment inappropriately to complain about the undocumented steps upgrading to beta7 -- having to remove the Kestrel dependency in project.json and to rename Microsoft.AspNet.Runtime namespace to Microsoft.Dnx.Runtime in my Startup.cs. :)

Thanks for the great work -- can't wait for it to ship!

@moozzyk
Copy link
Contributor

moozzyk commented Sep 3, 2015

@jtbennett - you can find information on breaking changes in the Announcement repo:

@moozzyk
Copy link
Contributor

moozzyk commented Sep 3, 2015

(Thanks for confirming that the error was fixed)

@jtbennett
Copy link

Aha! Thanks for the pointer. Didn't know about the announcement repo. :)
-JB
On Sep 3, 2015 7:56 PM, "Pawel Kadluczka" [email protected] wrote:

(Thanks for confirming that the error was fixed)


Reply to this email directly or view it on GitHub
#2343 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants