Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

MVC/Razor issue after updating to beta6 with multiple in-memory assembly on local iis server and azure but not in debug #2959

Closed
Rinsen opened this issue Aug 12, 2015 · 14 comments
Assignees
Labels

Comments

@Rinsen
Copy link

Rinsen commented Aug 12, 2015

Hi!

I have been trying to understand why I get an error when I deploy my app to run on IIS, but not in debug in Visual Studio. I get the same result on all pages and some of them are nothing fancy at all, so one idea I have is that it is in some way related to _Layout.cshtml och some other file that is always running but is running in some other way on IIS than in Visual Studio.

Any idea on how to figure out what is wrong?

This is my stacktrace

An error occurred while handling the request.
Microsoft.AspNet.Mvc.Razor.Compilation.CompilationFailedException: One or more compilation failures occured:
error CS1703: Multiple assemblies with equivalent identity have been imported: '<in-memory assembly>' and '<in-memory assembly>'. Remove one of the duplicate references.
error CS1703: Multiple assemblies with equivalent identity have been imported: '<in-memory assembly>' and '<in-memory assembly>'. Remove one of the duplicate references.
error CS1703: Multiple assemblies with equivalent identity have been imported: '<in-memory assembly>' and '<in-memory assembly>'. Remove one of the duplicate references.
error CS1703: Multiple assemblies with equivalent identity have been imported: '<in-memory assembly>' and '<in-memory assembly>'. Remove one of the duplicate references.
error CS1703: Multiple assemblies with equivalent identity have been imported: '<in-memory assembly>' and '<in-memory assembly>'. Remove one of the duplicate references.
   at Microsoft.AspNet.Mvc.Razor.Compilation.CompilationResult.EnsureSuccessful()
   at Microsoft.AspNet.Mvc.Razor.Compilation.CompilerCache.OnCacheMiss(RelativeFileInfo file, String normalizedPath, Func`2 compile)
   at Microsoft.AspNet.Mvc.Razor.Compilation.CompilerCache.GetOrAddCore(String relativePath, Func`2 compile)
   at Microsoft.AspNet.Mvc.Razor.Compilation.CompilerCache.GetOrAdd(String relativePath, Func`2 compile)
   at Microsoft.AspNet.Mvc.Razor.VirtualPathRazorPageFactory.CreateInstance(String relativePath)
   at Microsoft.AspNet.Mvc.Razor.RazorViewEngine.LocatePageFromViewLocations(ActionContext context, String pageName, Boolean isPartial)
   at Microsoft.AspNet.Mvc.Razor.RazorViewEngine.GetRazorPageResult(ActionContext context, String pageName, Boolean isPartial)
   at Microsoft.AspNet.Mvc.Razor.RazorViewEngine.FindView(ActionContext context, String viewName)
   at Microsoft.AspNet.Mvc.Rendering.CompositeViewEngine.FindView(ActionContext context, String viewName, Boolean partial)
   at Microsoft.AspNet.Mvc.Rendering.CompositeViewEngine.FindView(ActionContext context, String viewName)
   at Microsoft.AspNet.Mvc.ViewResult.<ExecuteResultAsync>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNet.Mvc.Core.FilterActionInvoker.<InvokeResultAsync>d__52.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.AspNet.Mvc.Core.FilterActionInvoker.<InvokeResultFilterAsync>d__51.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNet.Mvc.Core.FilterActionInvoker.<InvokeAllResultFiltersAsync>d__50.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.AspNet.Mvc.Core.FilterActionInvoker.<InvokeResourceFilterAsync>d__45.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNet.Mvc.Core.FilterActionInvoker.<InvokeAsync>d__40.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNet.Mvc.MvcRouteHandler.<InvokeActionAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNet.Mvc.MvcRouteHandler.<RouteAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNet.Routing.Template.TemplateRoute.<RouteAsync>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNet.Routing.RouteCollection.<RouteAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNet.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Rinsen.Identity.RinsenAuthenticationMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNet.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNet.Hosting.Internal.HostingEngine.<>c__DisplayClass29_0.<<Start>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNet.Loader.IIS.RuntimeHttpApplication.<ProcessRequestAsyncImpl>d__10.MoveNext()
@davidfowl
Copy link
Member

Can you provide a repro project?

@Rinsen
Copy link
Author

Rinsen commented Aug 12, 2015

Sure, I'll give it a try.

@Rinsen
Copy link
Author

Rinsen commented Aug 12, 2015

The repo is very simple, add Dapper 1.41.0-beta5 to your dependency list and you will get this error.

It's of course related to that version of Dapper being built on older packages in some way. But I actually had a look at the dependencies in Dapper before I sent this Issue and couldn't think of any problems related to that from the dependency list in Dappers nuget package and it didn't give me any warnings from my knowledge.

But it took me a lot of time to understand what the problem was from the provided error message. I could get nightmares from that type of "help" ;-)

So tho sum things up, I could of course build things only on Microsoft signed code and be all happy whit that, but this will still give me problems when I forget to fix my own code. And I also love all the code the community is sharing so I really want a better fault for problems like this one! :-)

And I will file the issue with Dapper version support update where it belongs. :-)

@Rinsen
Copy link
Author

Rinsen commented Aug 12, 2015

And one more question, why did it run on my local development machine but not on my lab 2012 IIS setup or on Azure?

@davidfowl
Copy link
Member

The repo is very simple, add Dapper 1.41.0-beta5 to your dependency list and you will get this error.

Can you make the sample application? What kind of application does it need to be? I assume you need razor views? Does it repro with a single view and that dependency and nothing else?

@Rinsen
Copy link
Author

Rinsen commented Aug 13, 2015

Here you go, not much left more than a controller a view and a startup and i still get the same issue :)

https://github.com/Rinsen/DnxVersionIssues

@Rinsen
Copy link
Author

Rinsen commented Aug 13, 2015

One thing is strange, I din´t get a 500 error on azure with this slimmed down solution, but I get it in my local 2012 IIS setup..

I will try to do some more thinking about this but it will take some time because I will be away traveling for some time, I will get back to you.

@danroth27 danroth27 modified the milestone: 6.0.0-beta8 Aug 14, 2015
@danroth27
Copy link
Member

@pranavkm Please take a look.

@Rinsen
Copy link
Author

Rinsen commented Aug 21, 2015

I will try to create a better repo during next week.

@Rinsen
Copy link
Author

Rinsen commented Aug 24, 2015

I have done some investigation and it is related to dependency "System.Runtime" : "4.0.20-beta-22816" and I have also tested "System.Runtime" : "4.0.20-beta-23109" with the same result.

I have updated my repo app with this change https://github.com/Rinsen/DnxVersionIssues

One thing that I do not understand at all is why there is a difference when I run this on IIS and Windows 2012 r2 compared to Azure and my local Windows 10/VS2015 dev machine where there is no problems at all.

@pranavkm
Copy link
Contributor

@Rinsen, I was able to repro the issue simply by building the application (dnu build) on my dev box. The issue seems to be a result of Dapper (1.41.0-*) referencing the System.Runtime (4.0.20.0) package in the net45 target framework. @davidfowl might be able to explain why that doesn't work, but that would explain the issue. Building and running the application in CoreCLR (dnxcore50) works fine.

I've responded to your comment on DapperLib/Dapper#241 to suggest a work around to the issue.

I've also sent a PR to fix the diagnostics in DNX (aspnet/dnx#2553) so the error is a bit more cogent.

Closing this issue since there's not much Mvc can do here to resolve the issue.

@Rinsen
Copy link
Author

Rinsen commented Aug 24, 2015

Thanks!

I got the problem by simply change target platform on my local machine... So now I understand a bit more about that, and the fix in diagnostics in DNX will help a lot with this kind of problems! :)

@birarich
Copy link

DNX version is 1.0.0-beta7
i tried even with 1.0.0-beta8
After installing xunit 2.1.0....

"dependencies": {
"xunit": "2.1.0",
"xunit.runner.dnx": "2.1.0-beta6-build191"
},
Error CS1703 Multiple assemblies with equivalent identity have been imported: '' and ''. Remove one of the duplicate references. CapitalOneInvesting.Services.Quotes.Tests 1

I am getting this issue.

@Rinsen
Copy link
Author

Rinsen commented Oct 26, 2015

If you run the beta8 runtime you should get the names of the duplicated assembly. I have had that issue now with the latest beta8 runtime also but now I got the correct error message as it should be after the change @pranavkm did in diagnostics.

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

No branches or pull requests

5 participants