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

AdditionalFiles do not show up in CompilationStartAnalysisContext.Options.AdditionalFiles #12840

Closed
torgabor opened this issue Jul 30, 2016 · 10 comments
Assignees
Milestone

Comments

@torgabor
Copy link

Version Used:
Microsoft.CodeAnalysis.Analyzers version=1.1.0
others: 1.2.1
Steps to Reproduce:

  1. Create example analyzer project, modify it to include a CompilationStartAction
  2. Add text file to project, set its type to "AdditionalFiles"
  3. The CompilationStartAnalysisContext' Options.AdditionalFiles array reports as empty.
    This is consistently reproducible between two installations.

I've tried following the instructions on adding additional files:
https://github.com/dotnet/roslyn/blob/master/docs/analyzers/Using%20Additional%20Files.md
I'm really thinking I'm missing something here, however the whole process seems pretty straightforward.
I can send an example project if it helps.
Expected Behavior:
Included text file appears in context.Options.AdditionalFiles
Actual Behavior:
context.Options.AdditionalFiles is empty

@Pilchie
Copy link
Member

Pilchie commented Aug 1, 2016

Also tagging @srivatsn - does this all seem right to you?

@srivatsn
Copy link
Contributor

srivatsn commented Aug 4, 2016

Ya the instructions in that doc should work. @torgabor, do you see the same behavior if you add some other item type to as well?

@torgabor
Copy link
Author

torgabor commented Aug 4, 2016

Hi! I'm not sure what you mean by adding other item type.
I've tried specifying Contentin the AdditionalFileItemNames tag also(as described in the document), then setting the type of an item to Content. Same results, file does not show up.
Also, sorry, forgot to mention, I'm using Visual Studio 2015 Update 3

@Pilchie Pilchie modified the milestones: 2.0 (Preview 5), 2.0 (RC) Sep 26, 2016
@jasonmalinowski jasonmalinowski modified the milestones: 2.0 (RC), 2.0 (RTM) Oct 19, 2016
@Pilchie Pilchie modified the milestones: 3.0, 2.0 (RTM) Jan 19, 2017
@jaybarden
Copy link

I've just encountered the same issue when running VS2017 15.7.1 for a .Net Standard project (using the https://github.com/dotnet/roslyn/blob/master/docs/analyzers/Using%20Additional%20Files.md example) so it still seems to be an issue :-(

@jasonmalinowski
Copy link
Member

Hmm, @Pilchie any chance that's something to move to the project system for new stuff?

@Pilchie
Copy link
Member

Pilchie commented May 17, 2018

@jaybarden If you:

  1. Start a Developer command prompt
  2. Run set PROJECTSYSTEM_PROJECTOUTPUTPANEENABLED=1
  3. Start VS from the command prompt with devenv
  4. Open your solution

There should be an extra output window pane that logs what the project system passes to the language service. Can you share that, and we can see if the project system is telling Roslyn about the file?

@jaybarden
Copy link

ProjectOutputForTermsTesting.txt

Analyzer1.zip
@Pilchie - I've attached both the output and a zip of the solution I was using to try this out. Please let me know if you need anything else and many thanks for the speedy response!
Jay

@Pilchie
Copy link
Member

Pilchie commented May 18, 2018

Thanks - @jasonmalinowski in the log, I do see:

        Adding additional file 'C:\JB\Analyzer1\Analyzer1\Analyzer1\terms.txt'

So it looks like project system is passing this through to Roslyn.

@Pilchie
Copy link
Member

Pilchie commented May 18, 2018

Note however, that from this comment, I see that dotnet/project-system#2160 is still an issue.

@CyrusNajmabadi
Copy link
Member

Closing out due to lack of feedback on this in 5+ years.

@CyrusNajmabadi CyrusNajmabadi closed this as not planned Won't fix, can't repro, duplicate, stale Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants