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?
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
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:
Awesome! Simply post in the forums using the link below and we'll get you started.