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 AssemblyInfo.cs in the main "Library" project.
AssemblyInfo.cs
The plan is currently to support dependency injection in business controller classes in 10.0.0, which would allow HtmlTextController to add a constructor with an overload accepting an INavigationManager and the framework would automatically supply that.
HtmlTextController
INavigationManager
That said, in this scenario, the HtmlTextController is being created by the modules, so it doesn't necessarily need to use Globals.DependencyProvider in that scenario, but can use the DependencyProvider exposed to the modules. I've submitted pull request #4786 which implements those changes.
Globals.DependencyProvider
DependencyProvider
For your scenario, you can either leave HtmlTextController.NavigationManager set to null when instantiated by the platform or you can inherit from the core DotNetNuke.Modules.Html.HtmlTextController class and use its protected NavigationManager property. Or just remove the INavigationManager usages and fall back to the deprecated Globals.NavigateURL for now.
HtmlTextController.NavigationManager
null
DotNetNuke.Modules.Html.HtmlTextController
protected
NavigationManager
Globals.NavigateURL
Hope it helps!
These Forums are dedicated to the discussion of DNN Platform.
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.