2sxc: Oqtane - Error compiling AppCode.dll

I’m submitting a

[x] bug report

…about

[x] other / unknown

Current Behavior / Expected Behavior

Importing apps from DNN to test in Oqtane. Some work with no issues, other report this:

Error: System.Exception: Error: Can't compile 'AppCode.dll' in AppCode. Details are logged into insights. Bad IL format. The format of the file ' .... \App_Data\2sxc.bin\App-00006-AppCode-5c98a772de834cf2f6cbaba95a058d43347c40224e3ac673b0d60a04183c20b8.dll' is invalid. at ToSic.Sxc.Razor.RazorCompiler.FindViewAsync(ActionContext actionContext, String partialName, IApp app, HotBuildSpec spec) at ToSic.Sxc.Razor.RazorCompiler.CompileView(String partialName, Action1 configure, IApp app, HotBuildSpec spec) at ToSic.Sxc.Razor.RazorRenderer.RenderToStringAsync[TModel](String templatePath, TModel model, Action1 configure, IApp app, HotBuildSpec hotBuildSpec) at ToSic.Sxc.Razor.RazorEngine.RenderTask(RenderSpecs specs)

This is the content of the folder: image

Instructions to Reproduce the Problem

Load any view (from specific apps with no significant differences).

Your environment

  • 2sxc version(s): 18.02.00
  • Oqtane: 5.2.4
  • Hosting platform: IIS

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Ok.

I tried three things:

  1. Moving the current database and files to a new server
  2. Removing IIS and configurations from the current server and reinstalling everything
  3. Creating a new install of Oqtane 6.0 in the current server after the IIS config reset

There are two important issues I tested: the file upload failures in Oqtane and the AppCode compile failure. On 1 (same files, different server) and 3 (new 6.0 install on same server with new IIS config ) the file upload issues are gone and the AppCode issue is gone (mostly). On 2 (same files, new IIS config) the issues persist.

So this have to be caused by a combination of IIS config and files / oqtane config. Either way I’m not going to pursuit this any more. Just going forward with the new 6.0 install.

BUT, I can still replicate the AppCode compile error with this condition: Any code error in the AppCode/helper.cs causes an initial display of the error, and then the “Can’t compile ‘AppCode.dll’ in AppCode” after a reload. I migrate the test apps from DNN, so there are a lot of issues with framework => .net core (like the HttpCookie class and all cookie related fetch functions).

So this HAS TO be replicate the issue on your end:

@inherits Custom.Hybrid.RazorTyped
@using AppCode

<div @Kit.Toolbar.Default()>
    MyHelpers.Hello("World")
</div>
namespace AppCode
{
    public class MyHelpers {

        public static string Hello(string a) {
            return "Hello" + a;
        }
    }
}

To trigger the issue change return "Hello" + a; to return "Hello" + ab; or any other code error

The first load gets this: Error: System.Exception: CS0103: The name ‘ab’ does not exist in the current context at ToSic.Sxc.Razor.RazorCompiler.FindViewAsync(ActionContext actionContext, String partialName, IApp app, HotBuildSpec spec) at ToSic.Sxc.Razor.RazorCompiler.CompileView(String partialName, Action1 configure, IApp app, HotBuildSpec spec) at ToSic.Sxc.Razor.RazorRenderer.RenderToStringAsync[TModel](String templatePath, TModel model, Action1 configure, IApp app, HotBuildSpec hotBuildSpec) at ToSic.Sxc.Razor.RazorEngine.RenderTask(RenderSpecs specs)

And after a reload: Error: System.Exception: Error: Can’t compile ‘AppCode.dll’ in AppCode. Details are logged into insights. Image is too small. at ToSic.Sxc.Razor.RazorCompiler.FindViewAsync(ActionContext actionContext, String partialName, IApp app, HotBuildSpec spec) at ToSic.Sxc.Razor.RazorCompiler.CompileView(String partialName, Action1 configure, IApp app, HotBuildSpec spec) at ToSic.Sxc.Razor.RazorRenderer.RenderToStringAsync[TModel](String templatePath, TModel model, Action1 configure, IApp app, HotBuildSpec hotBuildSpec) at ToSic.Sxc.Razor.RazorEngine.RenderTask(RenderSpecs specs)

The only thing that changed with the new server or new install in new IIS config is that the error now only triggers if there are codding errors on the helper (before is happened even with no helpers in the folder).

If you still cannot replicate this, please give me an e-mail address to send you the login info to a test install on my server.

I have had the same problem with oqtane 6.0 for .NET 9.0 Cheers

I believe @tvatavuk will look into this this week.