Re: Duplicate assembly issue

101 views
Skip to first unread message

RobertTheGrey

unread,
Nov 13, 2012, 5:27:26 PM11/13/12
to spar...@googlegroups.com
Hey Johnno,

Are you by any chance referencing a namespace in the _global.spark or a shared partial as well as putting a using statement of the same in a view file somewhere? I had this problem a long time ago when working a clone that brought down a old file (_global.spark), but that was excluded from the VS project and therefore invisible to me, but visible to Spark because it checks the file system, not VS project included files. This caused the same "using statement" to be rendered out in certain views and I got the same error message as you.

That's about all I can think of for now, but perhaps if you've got any more detail than that, it may give me more clues...

Hope you find it...
Cheers,
Rob

On Tuesday, November 13, 2012 3:23:41 PM UTC, Johnno Nolan wrote:

Hi All,


This has turned into a huge time sink for me.

Step 1: clone working project
Step 2: change code in non-view related code
...
some time later
Step 3: see error


An assembly with the same simple name 'MyMvcApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null has already been imported. Try removing one of the references or sign them to enable side-by-side.


Step 4: tear hair out in frustration.

Can anyone give me a list of steps I can take to prevent any damage to my scalp and resolve the issue. Every time I get a fresh copy of the code I don't have the issue.

Thanks


John

Robert Greyling

unread,
Mar 15, 2013, 6:18:21 PM3/15/13
to spar...@googlegroups.com
Hey Matt,

Any chance you can pull out a subset that can reproduce this error? That's the only way I can see to debug what's happening, unless you pull down the Spark source and step through it yourself. I can only reproduce this error by intentionally referencing it two places, but I can't get it to happen "sometimes", it's either happening or it's not, so I'd really like to get to the bottom of this with a reproducible scenario.

Thoughts?
Rob


On Thu, Mar 14, 2013 at 10:23 AM, autonomatt <ma...@tronik.co.uk> wrote:
This issue has just appeared on our servers too. It's quite annoying.
It used to only happen on our development servers and a Rebuild fixed the problem,
but now it happens after deployment to production (using TeamCity) and the website goes down.

Does anyone have a solution to this?

We've checked the _global.spark, but the fact that it sometimes works is a little odd.
--
You received this message because you are subscribed to the Google Groups "Spark View Engine Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spark-dev+...@googlegroups.com.

To post to this group, send email to spar...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Matt Ross

unread,
Mar 15, 2013, 8:11:39 PM3/15/13
to spar...@googlegroups.com
Hi Rob,

It's a fairly large ecommerce website. I will try and extract the relevant part of this project so that you might reproduce this. Thanks for taking the time to look at this.

It's a stab in the dark, but we did initially referenced spark manually, before removing and then nugetting the latest version of spark.mvc3. I wonder if somewhere along the line an old reference is still lurking somewhere. I have of course checked, but will double check while trying to get some code together for you to reproduce this error.

Cheers
Matt


--
You received this message because you are subscribed to a topic in the Google Groups "Spark View Engine Dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spark-dev/JC7IpnPhRs0/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to spark-dev+...@googlegroups.com.

autonomatt

unread,
Mar 18, 2013, 6:33:53 AM3/18/13
to spar...@googlegroups.com
Hi Rob,

I think we've cracked it now. It turns out that the Spark View Engine was getting registered twice. Once in global.asx and once in the WebActivator class that gets added by nuget. We removed the latter file and it appears to have fixed the issue. Although we can't be 100% sure since the error was happening sporadically. 

Robert Greyling

unread,
Mar 18, 2013, 6:35:15 AM3/18/13
to spar...@googlegroups.com
Great news - keep us posted if it happens again.

autonomatt

unread,
Mar 26, 2013, 12:52:53 PM3/26/13
to spar...@googlegroups.com
Hey Rob,

Just wanted to let you know that I was still getting an error:

Dynamic view compilation failed.
(0,0): error CS0518: Predefined type 'Microsoft.CSharp.RuntimeBinder.Binder' is not defined or imported

I managed to reliably reproduce the error. When I deploy updates via TeamCity everything works fine. However, if I recycle the AppPool in IIS I get this error.
The error only happens on one particual partial view file. On closer inspection of that file I found that I was using the "dynamic" keyword as part of a .GroupBy linq expression:

<table each="var group in Model.Variants.GroupBy(x => new { x.Year, x.Season, x.Model, x.Bundle })" class="table table-striped">
-                    # dynamic key = group.Key;

I changed this to use a struct as the group key and so got rid of the need for "dynamic":

<table each="var group in Model.Variants.GroupBy(x => new VariantGroupKey())" class="table table-striped">
+                    # var key = group.Key;

And this fixed the problem. So I guess using anonymous types in Spark views is a no-no(?)

Matt

Robert Greyling

unread,
Mar 27, 2013, 9:48:24 AM3/27/13
to spar...@googlegroups.com
Thanks for the update Matt. I don't think anon types is a no-no per se, I'm pretty sure I've used them before, but there may very well be things that are not accounted for in the engine which may lead to a bug.

Have you got a small reproducible sample I can download a zip or git repo to test and debug locally to get to the bottom of it?

Cheers,
Rob

Matt Ross

unread,
Mar 28, 2013, 10:11:27 AM3/28/13
to spar...@googlegroups.com


--
You received this message because you are subscribed to a topic in the Google Groups "Spark View Engine Dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spark-dev/JC7IpnPhRs0/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to spark-dev+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages