Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] HotBuild Could not load file or assembly 'App_SubCode_Util.cqarunqp #3595

Open
ZecRepublic opened this issue Mar 7, 2025 · 0 comments

Comments

@ZecRepublic
Copy link

Bug Affects...

[x] Razor templating
[x] other (HotBuild)

Current Behavior / Expected Behavior

I have a custom 2sxc app that relies on HotBuild. This app has a service class within the app's "AppCode" folder, which inherits from the "CodeTyped" class. For the last couple weeks, there have been no issues using this service in the app's razor templates. However, recently the following error message appears when I try to use a method on my service class.

Error: System.IO.FileNotFoundException: Could not load file or assembly 'App_SubCode_Util.cqarunqp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'App_SubCode_Util.cqarunqp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' at AppCode.PermissionService.HasPermission(Permission permission) at RazorHost.RazorViewFooter.Execute() in C:\inetpub\wwwroot\mywebsite\uat\Portals\0\2sxc\Site\Components\Footer.cshtml🎯:line 99 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at ToSic.Sxc.Dnn.Razor.Internal.DnnRazorCompiler.Render(RazorComponentBase page, TextWriter writer, Object data) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Dnn\Razor\Internal\DnnRazorCompiler.cs:line 77 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at ToSic.Sxc.Dnn.Razor.Internal.DnnRazorCompiler.Render(RazorComponentBase page, TextWriter writer, Object data) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Dnn\Razor\Internal\DnnRazorCompiler.cs:line 84 at ToSic.Sxc.Dnn.Razor.DnnRazorEngine.RenderImplementation(RazorComponentBase webpage, RenderSpecs specs) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Dnn\Razor\DnnRazorEngine.cs:line 64 at ToSic.Sxc.Dnn.Razor.DnnRazorEngine.RenderEntryRazor(RenderSpecs specs) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Dnn\Razor\DnnRazorEngine.cs:line 58 at ToSic.Sxc.Engines.EngineBase.Render(RenderSpecs specs) in C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Engines\EngineBase.cs:line 115 at ToSic.Sxc.Dnn.Razor.DnnRazorEngine.Render(RenderSpecs specs) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Dnn\Razor\DnnRazorEngine_Callbacks.cs:line 33 at ToSic.Sxc.Blocks.Internal.BlockBuilder.RenderInternal(RenderSpecs specs) in C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Blocks\Internal\BlockBuilder\BlockBuilder_Render.cs:line 134 === Pre-bind state information === LOG: DisplayName = App_SubCode_Util.cqarunqp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = file:///C:/inetpub/wwwroot/mywebsite/uat/ LOG: Initial PrivatePath = C:\inetpub\wwwroot\mywebsite\uat\bin Calling assembly : App-00026-AppCode-b5eb8363f360bad1cbd367f4db11bfe0f4ff20de91ef6542f03dd285c784b6c4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null. === LOG: This bind starts in LoadFrom load context. WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load(). LOG: Using application configuration file: C:\inetpub\wwwroot\mywebsite\uat\web.config LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: The same bind was seen before, and was failed with hr = 0x80070002.

Here is my service:

using System;
using AppCode.Data;
using Custom.Hybrid;
using DotNetNuke.Entities.Users;
using My.Extensions;
using System.Linq;

namespace AppCode {

    public class PermissionService : CodeTyped {

        UserInfo CurrentUser { get; }
        
        public PermissionService() {
            CurrentUser = UserController.Instance.GetCurrentUserInfo();
        }

        // Checks if current user has any roles in the comma-separated string list of DNN user roles
        private bool HasAnyRoles(string rolesList) {
            string[] roles = rolesList.Split(',');
            return roles.Any(role => CurrentUser.IsInRole(role));
        }

        public bool HasPermission(Permission permission) {

            if (permission == null || permission.Rule == "all") {
                return true;
            }

            if (permission.Rule == "guest" && !CurrentUser.IsLoggedIn()) {
                return true;
            }

            if (permission.Rule == "registered") {
                
                bool hasIncludeRoles = true;

                if (permission.IncludeRoles.Length > 0) {
                    hasIncludeRoles = HasAnyRoles(permission.IncludeRoles);
                }

                bool hasExcludeRoles = false;

                if (permission.ExcludeRoles.Length > 0) {
                    hasExcludeRoles = HasAnyRoles(permission.ExcludeRoles) && !CurrentUser.IsSuperUser;
                }

                return hasIncludeRoles && !hasExcludeRoles;
            }

            return false;
        }
    }
}

Attempts to resolve the issue include:

  • Renaming class
  • Renaming code file
  • Deleting compiled app dll from /App_Data/2sxc.bin/
  • Restarting DNN application
  • Recycling app pool

To Reproduce (Steps, Videos, Screenshots, Apps)

I am unsure of how to replicate this issue, as the other app services are all loading correctly.

Your environment

  • 2sxc version(s): v.18.06.01
  • Browser: all
  • DNN / Oqtane: v.09.11.00
  • Hosting platform: IIS (Azure VM)
  • Ui Languages: any/all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant