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

Bug: Additional files not regonized #244

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Corniel
Copy link
Contributor

@Corniel Corniel commented Jan 28, 2024

As mentioned in #243, I noticed that in some projects additional files (and other properties as well I guess, but that was not what I was investigating) are not recognized.

I've added created this PR, that adds a replay where the additional files are not available in the AnalyzerResult.

  1. I noticed (so far) that EventProcessor.MessageRaised(object sender, BuildMessageEventArgs e) is triggered only for v6.0.
  2. For the (existing) test that succeeds, only one TFM is detected, for this failing test, both v6.0 and v5.0 are added. The latter lacks the additional files, but is used to build anyway.
  3. If change the targets to only build .NET 5.0, or for .NET 8.0 and .NET 6.0 combined, everything works just fine.

I'll update mine findings here.

For some background, I use Buildalyzer to test Roslyn Analyzers that check for issues in .NET project files, such as MS Build project files, and RESX files. Access to the additional files is the perquisite for those tests to work. See: dotnet-project-file-analyzers

@Corniel
Copy link
Contributor Author

Corniel commented Jul 31, 2024

@phmonte with a nice [DebuggerDisplay] attribute, I was able to finally find what is going wrong: for the .NET 5.0 target, nothing is compiled: No source files, no additional files. Would you be so kind to also have a look?

@Corniel Corniel force-pushed the additional-file-not-detected branch from 37f4356 to 4d856cb Compare August 1, 2024 14:26
@phmonte
Copy link
Owner

phmonte commented Sep 7, 2024

I think I found the problem, you can see it in my commit.
But, some tests broke and I still don't think it's the best solution.

@Corniel
Copy link
Contributor Author

Corniel commented Sep 7, 2024

I've been working on a new way of tracing/logging, that also is really in draft mode, but I think it looks promising. I've created another (draft) pr for that: #286

@phmonte
Copy link
Owner

phmonte commented Sep 8, 2024

Perfect, I made a small change to the test project, keeping only 1 TargetFrameworks field and removing the TargetFramework, looking at the documentation here .

I believe the additional files worked and the test passed.

I noticed that the MessageRaised event is called according to the number of TargetFramework(s), when placing the 2 fields, it considered only the first one, as it says in the documentation

@Corniel
Copy link
Contributor Author

Corniel commented Sep 8, 2024

@phmonte It defined wrong on purpose. ;) It is part of a test for .NET project file analyzers. I was suspecting that it might not work because of this. Sorry, I should have specified that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants