Skip to content

[Bug]: Two step upgrade to v10.3.1 breaks CodeDom .NET Compiler #7213

Description

@skarpik

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

Upgrading from DNN v9.13.10 to v10.3.1 via v10.2.4 breaks the CodeDom .NET compiler.

The CodeDom .NET compiler is required for 2sxc version 17 and higher. The test website had 2sxc v21.07.00 installed a worked properly. The upgrade to DNN v10.2.4 went smoothly and the website continued to work properly.

After using the new upgrade procedure to move to v10.3.1, the 2sxc modules suffered errors.

Steps to reproduce?

  1. Created a test DNN v9.13.10 website with CodeDom .NET compiler and 2sxc v21.07.00 added as extensions. The website had three pages: a traditional DNN page (HTML modules), a page demonstrating 2sxc Content and a page demonstrating a 2sxc App (the photo gallery).
  2. Upgraded the website to DNN v10.2.4 using the standard upgrade procedure. The upgrade went smoothly and everything was functional.
  3. Upgraded to DNN v10.3.1 using the new procedure. The upgrade appeared to complete normally. Loading 2sxc pages showed errors (see below).

Current Behavior

Image

Expected Behavior

While at DNN v9.13.10 and v10.2.4, the web.config file contained:

<system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701;612;618" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008,40000,40008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
</system.codedom>

After the upgrade, the same section of web.config contains:

``` <system.codedom> <compilers></compilers> </system.codedom>


### Relevant log output

Error: System.TypeLoadException: Could not load type 'ASP._Page_portals_0_2sxc_content_bs5_shared_content_list_header_cshtml' from assembly 'App_Web_content list header.cshtml🎯.f0a4b4d7.93h_fnmr, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because the method 'Execute' has no implementation (no RVA). at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) at System.Web.Compilation.BuildProvider.CreateBuildResult(CompilerResults results) at System.Web.Compilation.BuildProvider.GetBuildResult(CompilerResults results) at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath) at ToSic.Sxc.Dnn.Razor.Sys.DnnRazorCompiler.CreateWebPageInstance(String templatePath) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Dnn\Razor\Sys\DnnRazorCompiler.cs:line 112 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at ToSic.Sxc.Dnn.Razor.Sys.DnnRazorCompiler.CreateWebPageInstance(String templatePath) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Dnn\Razor\Sys\DnnRazorCompiler.cs:line 127 at ToSic.Sxc.Dnn.Razor.Sys.DnnRazorCompiler.InitWebpage(String templatePath, Boolean exitIfNoHotBuild) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Dnn\Razor\Sys\DnnRazorCompiler.cs:line 155 at ToSic.Sxc.Dnn.Razor.Sys.DnnRazorCompiler.PrepareForRoslyn(RazorComponentBase parent, String templatePath, Object data) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Dnn\Razor\Sys\DnnRazorCompiler.cs:line 218 at ToSic.Sxc.Dnn.Razor.HtmlHelper.RenderWithRoslynOrClassic(String relativePath, String normalizedPath, RenderSpecs renderSpecs) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Dnn\Razor\HtmlHelper.cs:line 146 at ToSic.Sxc.Dnn.Razor.HtmlHelper.Partial(String relativePath, Object data) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Dnn\Razor\HtmlHelper.cs:line 81


### Anything else?

The underlying cause of the error message is clear - the reference to the CodeDom .NET compiler disappeared in the update from v10.2.4 to v10.3.1. I have no idea why this happened.

Adding the missing references to the compiler:

<compiler language="c#;cs;csharp"...></compiler>
<compiler language="vb;vbs;visualbasic;vbscript"...></compiler>

allows the website to load properly.

### Affected Versions

10.3.1 (latest release)

### What browsers are you seeing the problem on?

Microsoft Edge

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions