DNN Forums

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

Internal property is accessed from another assembly

Sort:
You are not authorized to post a reply.





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





      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





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

        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.

        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.

        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.

        Hope it helps!

        DNN partner specializing in custom, enterprise DNN development https://engagesoftware.com/showcase
        You are not authorized to post a reply.

        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:

        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