I find it difficult to find out exactly why the following error occurs. I will talk about the mysterious aspects of the error description below.
[A] ASP.common_resultmessagepanel_ascx cannot be used to
[B] ASP.common_resultmessagepanel_ascx .
Type A comes from 'App_Web_resultmessagepanel.ascx.38131f0b.2c4hpv_z, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = null'
in the "Default" context in the location
'C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Temporary ASP.NET files \ MyWebApp \ dc3e0df6 \ ba1606c8 \ App_Web_resultmessagepanel.ascx.38131f0b.2c4hpv_z.dll'.
Type B comes from 'App_Web_wz3shqfq, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = null'
in the "Default" context in the location
'C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Temporary ASP.NET files \ MyWebApp \ dc3e0df6 \ ba1606c8 \ App_Web_wz3shqfq.dll'.
The class referenced by the error is a web user control that inherits from System.Web.UI.UserControl and implements System.Web.UI.ITextControl.
The control is registered and used on the main page. None of the parent master or implementation pages have control instances.
The class and markup page are in the web application project.
The exception does not occur as a direct result of the application code, it occurs during the execution of the internal .NET code.
A project is a web application, not a website.
The web application is compiled into a single binary file, and culture-specific resources are compiled into a single binary file culture.
The context specified for each type in the exception is the same, but I was able to verify that when an exception occurs, there are actually 2 separate class definitions in the Temporary ASP.NET Files folder for the application.
A user control has always existed and was used in the application, but an exception started after the user control was added to the main page.
The exception does not occur sequentially. After creating temporary files, an exception will occur every time a page is requested. If something causes temporary files to be deleted or recreated, the coincidence is whether duplicate temporary class definitions / DLLs will be created again. This can be a change to web.config, reuse of the application pool, sometimes even just an updated / restored binary application of the web application.
Last bit of the stack trace:
ASP.Default.__BuildControl__control35(Control ctrl) in C:\Projects\ABC.Web\App_Themes\Default\CheckBox.skin:3 System.Web.UI.ControlSkin.ApplySkin(Control control) +12 System.Web.UI.PageTheme.ApplyControlSkin(Control control) +119 System.Web.UI.Control.ApplyStyleSheetSkin(Page page) +61 ASP.masterpages_mymaster_master.__BuildControlpnlResults() in C:\Projects\ABC.Web\MasterPages\MyMaster.master:10 ASP.masterpages_mymaster_master.__BuildControl__control2(Control __ctrl) in C:\Projects\ABC.Web\MasterPages\MyMaster.master:9 System.Web.UI.CompiledTemplateBuilder.InstantiateIn(Control container) +12 System.Web.UI.MasterPage.InstantiateInContentPlaceHolder(Control contentPlaceHolder, ITemplate template) +87
The alleged source of the violation (the only line in the skin file is C: \ Projects \ ABC.Web \ App_Themes \ Default \ CheckBox.skin):
<asp:CheckBox runat="server" SkinID="FormInput" CssClass="FormLabel FormInputCheckBox" />
At this moment, I do not know if this problem is caused by the solution, its configuration, IIS and the application pool, or something related to the actual file of the temp file itself, where, possibly, the old files are not cleared. I checked that the temporary folder is not indexed by the OS.
I am concerned that in a production environment, the application pool will be recycled or some configuration parameter will change, and these temp files will be recreated using the definition of a repeating class and therefore errors. We cannot test the application every time the application pool processes and deletes temporary files if an error occurs until the application loads correctly. Therefore, I need to find out what causes duplication, but at the moment I do not know where else to explore.
Any ideas?
I removed the user control from the main page and placed it directly on each of the pages that required it, and executed the main page.
So far, the exception has not been repeated. I'm going to give him a couple more days of test time to see if he appears again.
I still want to know why the exception occurred at all. Anyone with deep knowledge of how IIS runs .net web applications or how temporary files are created?
New theory!
While this is a compiled binary web project, the IIS instance that I run for development points to the project folder. Thus, the source code files are actually in the web path. I think IIS can compile source code files into separate binary files, especially if the application pool is being processed. Therefore, accounting for duplicate temp files that are created and errors.
Other developers experienced errors when starting the project from the visual studio. I do not know how this will explain these cases, but I do not exclude this as a reason.