Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assembly.LoadFrom overload unconditionally throws NotSupportedException #96410

Closed
Epic-Santiago opened this issue Jan 2, 2024 · 1 comment · Fixed by #102292
Closed

Assembly.LoadFrom overload unconditionally throws NotSupportedException #96410

Epic-Santiago opened this issue Jan 2, 2024 · 1 comment · Fixed by #102292
Labels
area-AssemblyLoader-coreclr in-pr There is an active PR which will close this issue when it is merged

Comments

@Epic-Santiago
Copy link

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

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jan 2, 2024
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jan 2, 2024
@danmoseley danmoseley added area-AssemblyLoader-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jan 2, 2024
@ghost
Copy link

ghost commented Jan 2, 2024

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

Issue Details

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

Author: Epic-Santiago
Assignees: -
Labels:

area-AssemblyLoader-coreclr, untriaged, needs-area-label

Milestone: -

@Epic-Santiago Epic-Santiago changed the title Assembly.LoadFrom overload unconditionally throws NotSupportedException and should therefore be marked obsolete Assembly.LoadFrom overload unconditionally throws NotSupportedException Jan 2, 2024
agocke added a commit to agocke/runtime that referenced this issue May 15, 2024
@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label May 15, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label May 17, 2024
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this issue May 30, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-AssemblyLoader-coreclr in-pr There is an active PR which will close this issue when it is merged
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants