Note that there are some explanatory texts on larger screens.

plurals
  1. POC# Compiler Incorrectly Optimizes Code
    primarykey
    data
    text
    <p>I have a ASP.NET application running on a remote web server and I just started getting this error:</p> <pre><code>Method not found: 'Void System.Collections.Generic.ICollection`1..ctor()'. </code></pre> <p>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:</p> <pre><code>Set&lt;int&gt; set = new Set&lt;int&gt;(); </code></pre> <p>Is compiled into this line:</p> <pre><code>Set&lt;int&gt; set = (Set&lt;int&gt;) new ICollection&lt;CalendarModule&gt;(); </code></pre> <p>The CalendarModule class is a totally unrelated class!! Has anyone ever noticed .NET incorrectly compiling code like this before?</p> <p><strong>Update #1:</strong> This problem seems to be introduced by Microsoft's <a href="http://research.microsoft.com/~mbarnett/ILMerge.aspx" rel="nofollow noreferrer">ILMerge</a> tool. We are currently investigating how to overcome it.</p> <p><strong>Update #2:</strong> We found two ways to solve this problem so far. We don't quite understand what the underlying problem is, but both of these fix it:</p> <ol> <li><p>Turn off optimization.</p></li> <li><p>Merge the assemblie with ILMerge on a different machine.</p></li> </ol> <p>So we are left wondering if the build machine is misconfigured somehow (which is strange considering that we have been using the machine to build releases for over a year now) or if it is some other problem.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload