Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure what's happening in your case, but I had this happen to me under the following circumstances:</p> <p>Website project type, not Web Application.</p> <p><code>/Controls</code> folder containing many ascx usercontrols. </p> <p><code>/Client/Controls</code> folder containing other ascx usercontrols, some of which register and reference <code>/Controls</code> usercontrols.</p> <p><code>/Controls/BadControl.ascx</code> using <code>/Client/Controls/DupedControl.ascx</code> as a child control.</p> <p>The compiler runs into a circular dependency as it tries to compile each folder into a separate assembly.</p> <p><code>/Controls/BadControl.ascx</code> needs <code>/Client/Controls</code> to be compiled first.</p> <p><code>/Client/Controls</code> needs <code>/Controls</code> to be compiled first.</p> <p>So the compiler punts and compiles <code>DupedControl.ascx</code> into its own separate assembly first. Then <code>/Controls</code>, then <code>/Client/Controls</code> <em>in which DupedControl still gets included</em>.</p> <p>At this point there are two distinct Types for DupedControl in two separate assemblies. <code>DupedControl.ascx</code> (markup) points to the correct Type -- let's call it TypeA, in the folder's assembly -- while BadControl's reference points to the dupe TypeB in the small extra assembly. </p> <p><strong>When a page using BadControl executes, DupedControl TypeA gets instantiated via the markup, but BadControl tries to cram it into a TypeB variable, resulting in the error you described.</strong></p> <p>The solution is to move ascx files around to get rid of the circular reference. I can't remember for certain, but I think maybe the "single page assemblies" and "fixed naming" options might also resolve it.</p> <p>All that said, Web Application projects compile to a single assembly, so I didn't think this kind of circular folder reference would be possible. Perhaps the problem lies elsewhere.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      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