Skip to content

Assembly.CodeBase obsoletion is incomplete #42857

Closed

Description

@agocke

Assembly.CodeBase and Assembly.EscapedCodeBase were marked obsolete in #31127

but this work was incomplete: AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are not marked. In addition, usages of these obsolete APIs remain in the source code.

We need to carefully audit all the use-sites and either remove them or provide explicit justification for our continued use.

Activity

  1. added
    area-AssemblyLoader-coreclr
    untriaged
    on Sep 29, 2020
  2. added this to the 6.0.0 milestone on Sep 29, 2020
  3. added and removed
    area-AssemblyLoader-coreclr
    untriaged
    on Sep 29, 2020
  4. agocke commented on Sep 29, 2020

    @agocke
    MemberAuthor
  5. ericstj commented on Sep 29, 2020

    @ericstj
    Member

    Looks like @jkotas suggested pragma here: #31127 (comment)

    Not sure about AssemblyName WRT original issue. Cc @jeffhandley @JoshSchreuder

  6. agocke commented on Sep 29, 2020

    @agocke
    MemberAuthor

    At the stage of the release we were in, I think silencing the warnings was reasonable, but I don't think it's a long-term solution.

    This issue just tracks finishing that long-term work.

  7. jeffhandley commented on Sep 29, 2020

    @jeffhandley
    Member

    I'd be supportive of adding AssemblyName.CodeBase and AssemblyName.EscapedCodeBase into the same obsoletion diagnostic id in 6.0 and also taking a sweep through our own usage to remove the #pragmas.

  8. jkotas commented on Sep 29, 2020

    @jkotas
    Member

    sweep through our own usage to remove the #pragmas

    There is one pragma in the shipping code that #42306 is attempting to fix. The remaining pragmas are in method overrides where they are used by design, and in tests.

  9. 2 remaining items

  10. modified the milestones: 6.0.0, 7.0.0 on Jul 31, 2021
  11. jeffhandley commented on Aug 1, 2021

    @jeffhandley
    Member

    @dotnet/area-system-reflection I spent some time looking into this, but I am not familiar enough with how AssemblyName is being used to determine the right path forward here.

    I moved the issue to 7.0.0, but if time permits before .NET 6 RC1, this would be nice-to-have.

  12. buyaa-n commented on Jun 9, 2022

    @buyaa-n
    Contributor

    I don't see much real usage of CodeBase in source.dot.net, mostly setting the property from passed AssemblyName to the newly created/cloned AssemblyName. There is a few usage that try to load the assembly by setting CodeBase and seems it was the main functional usage:

    private static Assembly LoadAssembly(string codeBase)
    {
        AssemblyName assemblyName = new AssemblyName { CodeBase = assemblyPath };
        return Assembly.Load(assemblyName);
    }

    but this code would not work in .Net Core, therefore I think we should obsolete CodeBase/EscapedCodeBase and let developers avoid from issues like: AssemblyName.CodeBase is ignored in LoadFromAssemblyName while porting their app from .Net framework

  13. ghost added
    in-pr
    on Jun 10, 2022
  14. Repository owner moved this from Future to Done in Triage POD for Reflection, META, etc.on Jun 14, 2022
  15. ghost removed
    in-pr
    on Jun 14, 2022
  16. ghost locked as resolved and limited conversation to collaborators on Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions