DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Internal property is accessed from another assembly

 2 Replies
 1 Subscribed to this topic
 26 Subscribed to this forum
Sort:
Author
Messages
New Around Here
Posts: 2
New Around Here

DNN 9.9.1

I'm trying to create an extended version of the standard Html module.

When I copy the module VS project and update the namespace & assembly name I get the error "'Globals.DependencyProvider' is inaccessible due to its protection level" in HtmlTextController, ln 54.  This makes sense as it is marked as 'internal' in the DotNetNuke.dll assembly.

What I don't understand is how the standard HTML doesn't have this problem - it is also in a separate assembly? But I can compile the standard HTML project without errors.

If I change my assembly name back to DotNetNuke.Modules.Html the error message goes away.  But if I change it to say, DoteNetNuke.Modules.MyHtml, it reappears.

I'm missing something fundamental here. Any thoughts please?

New Around Here
Posts: 2
New Around Here

The reason was DotNetNuke.dll had an InternalsVisibleTo attribute in AssemblyInfo.cs for this and a few other modules:

[assembly: InternalsVisibleTo("DotNetNuke.Modules.Html")] // Once Globals is refactored to Dependency Injection we should be able to remove this

 

 

 

Advanced Member
Posts: 159
Advanced Member
MVP
MVP
You're an MVP!

For reference, this is in line 43 of <code>AssemblyInfo.cs</code> in the main "Library" project.

The plan is currently to support dependency injection in business controller classes in 10.0.0, which would allow <code>HtmlTextController</code> to add a constructor with an overload accepting an <code>INavigationManager</code> and the framework would automatically supply that.

That said, in this scenario, the <code>HtmlTextController</code> is being created by the modules, so it doesn't necessarily need to use <code>Globals.DependencyProvider</code> in that scenario, but can use the <code>DependencyProvider</code> exposed to the modules. I've submitted pull request #4786 which implements those changes.

For your scenario, you can either leave <code>HtmlTextController.NavigationManager</code> set to <code>null</code> when instantiated by the platform or you can inherit from the core <code>DotNetNuke.Modules.Html.HtmlTextController</code> class and use its <code>protected</code> <code>NavigationManager</code> property. Or just remove the <code>INavigationManager</code> usages and fall back to the deprecated <code>Globals.NavigateURL</code> for now.

Hope it helps!

These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved