Skip to content

[Bug]: CDF - Could Not Load Theme, Error: Type DnnJsInclude does not have a public property named HtmlAttributesAsString #6839

@jeremy-farrance

Description

@jeremy-farrance

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

DNN v10.02.00 RC1

Testing with existing custom theme. In our partial/include, preheader.ascx we use the following declaration to bring an external JS script on to the page.

<%-- FontAwesome Pro, Kits are managed here; https://fontawesome.com/kits 
- Note: Make sure you add the domain to the staging and real domain, delete this once completed.
- <script src="https://kit.fontawesome.com/a8bdac967e.js" crossorigin="anonymous"></script>
--%>
<dnn:DnnJsInclude
  FilePath="https://kit.fontawesome.com/a8bdac967e.js"
  ForceProvider="DnnFormBottomProvider"
  HtmlAttributesAsString="async defer crossorigin:anonymous" 
  Priority="42"
  runat="server"
/>

In versions of DNN up to v10.01.02, this resulted in the following output:

<script src="https://kit.fontawesome.com/a8bdac967e.js?cdv=223" async defer crossorigin="anonymous" type="text/javascript"></script>

Note that the hack of including spaces allowed the previous CDF version to treat anonymous as the value and using all of async defer crossorigin as the attribute name.

A more typical assignment to HtmlAttributesAsString would be:

HtmlAttributesAsString = "type:module,async:async,defer:defer,crossorigin:anonymous",

Steps to reproduce?

On a running DNN v10.02.00 RC1, add the code example above into your [skin-file].ascx.

Current Behavior

Covered above.

Expected Behavior

Covered above.

Relevant log output

Admin Logs recorded this:

Message:Unhandled error loading page.

StackTrace:

InnerMessage:Type 'DotNetNuke.Web.Client.ClientResourceManagement.DnnJsInclude' does not have a public property named 'HtmlAttributesAsString'.

InnerStackTrace:

   at System.Web.UI.TemplateParser.ProcessException(Exception ex)
   at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
   at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
   at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
   at System.Web.UI.TemplateParser.ParseInternal()
   at System.Web.UI.TemplateParser.Parse()
   at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
   at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
   at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
   at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
   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.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)
   at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath)
   at DotNetNuke.UI.ControlUtilities.LoadControl[T](TemplateControl containerControl, String controlSrc)
   at DotNetNuke.UI.Skins.Skin.LoadSkin(PageBase page, String skinPath)

Anything else?

Additional example from this post also cause the same error to throw: Using Dnn-Elements in a 2sxc View.

Affected Versions

Current development branch (unreleased)

What browsers are you seeing the problem on?

Chrome

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions