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

NativeAOT doesn't generate IL3000 and IL3001 - access to Assembly.Location property #82475

Closed
vitek-karas opened this issue Feb 22, 2023 · 3 comments · Fixed by #83253
Closed

Comments

@vitek-karas
Copy link
Member

The Single-File analyzer produces two warnings which are not triggered by RequiresAssemblyFiles, but are basically intrinsics:

  • IL3000 - basically just when accessing Assembly.Location
  • IL3001 - when accessing Assembly.GetFiles and several other methods

The NativeAOT compiler doesn't produce these warnings.

There also seem to be some issue with RequiresAssemblyFiles since the below program only produces analyzer warnings:

var a = typeof(object).Assembly.Location;   // IL3000
var b = typeof(object).Assembly.GetFiles();  // IL3001

But Assembly.GetFiles is annotated with RequiresAssemblyFiles attribute, so I would at least expect to get IL3002 in this case (but ideally IL3001).

/cc @tlakollo

@ghost
Copy link

ghost commented Feb 22, 2023

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

Issue Details

The Single-File analyzer produces two warnings which are not triggered by RequiresAssemblyFiles, but are basically intrinsics:

  • IL3000 - basically just when accessing Assembly.Location
  • IL3001 - when accessing Assembly.GetFiles and several other methods

The NativeAOT compiler doesn't produce these warnings.

There also seem to be some issue with RequiresAssemblyFiles since the below program only produces analyzer warnings:

var a = typeof(object).Assembly.Location;   // IL3000
var b = typeof(object).Assembly.GetFiles();  // IL3001

But Assembly.GetFiles is annotated with RequiresAssemblyFiles attribute, so I would at least expect to get IL3002 in this case (but ideally IL3001).

/cc @tlakollo

Author: vitek-karas
Assignees: -
Labels:

area-NativeAOT-coreclr

Milestone: 8.0.0

@MarcoRossignoli
Copy link
Member

cc: @Evangelink

@MichalStrehovsky
Copy link
Member

We should also enable the single file roslyn analyzer when publishaot is set in the project: filed #82503.

@agocke agocke added this to AppModel Mar 6, 2023
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Mar 10, 2023
vitek-karas added a commit that referenced this issue Mar 15, 2023
This also implements the suppression of the IL3002 on the affected methods both in the NativeAOT compiler and the analyzer.

Adds single-file specific tests which are skipped for the trimmer.

Fixes: #83088
Fixes: #82475
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Mar 15, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Apr 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants