Skip to content

Assembly.LoadFrom overload unconditionally throws NotSupportedException #96410

@Epic-Santiago

Description

@Epic-Santiago

Description

The following API:
public static Assembly LoadFrom(string assemblyFile, byte[]? hashValue, AssemblyHashAlgorithm hashAlgorithm)
Unconditionally throws NotSupportedException.
This is a bad development experience. It looks like a valid API until it is used and it throws at runtime. Marking it as obsolete (or implementing it) would give the necessary development time signal to not use it rather than waste a developer's time.

Reproduction Steps

System.Reflection.Assembly.LoadFrom("", null, System.Configuration.Assemblies.AssemblyHashAlgorithm.None);

Expected behavior

The call should either be functional or the API should be marked obsolete.

Actual behavior

Code compiles with no warnings only to unconditionally throw an exception at runtime.

Regression?

Not tested but this API presumably worked on .NET Framework.

Known Workarounds

Don't use this API.

Configuration

  • .NET 8
  • Windows 10
  • x64
  • Not specific to this configuration
  • Not using Blazor

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-AssemblyLoader-coreclrin-prThere is an active PR which will close this issue when it is merged

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions