tags:

views:

312

answers:

3

I have a ASP.NET application running on a remote web server and I just started getting this error. I can't seem to reproduce it in my development environment:

Method not found: 'Void System.Collections.Generic.ICollection`1..ctor()'.

Could this be due to some misconfiguration of .NET Framework or IIS 6?

Update: I disassembled the code in the DLL and it seems like the compiler is incorrectly optimizing the code. (Note that Set is a class that implements a set of unique objects. It inherits from IEnumerable.) This line:

Set<int> set = new Set<int>();

Is compiled into this line:

Set<int> set = (Set<int>) new ICollection<CalendarModule>();

The Calendar class is a totally unrelated class!! Has anyone ever noticed .NET incorrectly compiling code like this before?

A: 

Is your IIS setup to use .NET 2.0? If not, change it to 2.0. If you can't see 2.0 in the list then you'll need to run aspnet_regiis from the 2.0 framework directory.

Ben Scheirman
+1  A: 

Are the .NET versions on both systems the same inc. the same service pack?

pb
A: 

This was caused by a bug in the aspnet merge tool which incorrectly merged optimized assemblies. It can be solved by either not merging the assemblies or not optimizing them.

Kevin Albrecht