Skip to content

Fix generated source causing compilation errors on some platforms#6

Merged
LiHRaM merged 1 commit intopodimo:developfrom
AshleighAdams:handle-empty-classnames
Aug 26, 2024
Merged

Fix generated source causing compilation errors on some platforms#6
LiHRaM merged 1 commit intopodimo:developfrom
AshleighAdams:handle-empty-classnames

Conversation

@AshleighAdams
Copy link
Copy Markdown
Contributor

On some dotnet SDKs and platforms, it's possible for an incorrect empty string to be returned by AnalyzerConfigOptions.TryGetValue() instead of a null when the attribute was not found

While it does look to be an upstream bug, a missing class name is also not an acceptable value to begin with as it fails the build. It would be reasonable for us to check for and skip entries expressing empty class names rather than nulls for anyone on dotnet SDKs with with this bug

The SDK/Platform known to be expressing this bug is 7.0.410, Linux x64 This is the current latest running on GitHub Actions for .NET 7.x

As for replicating the bug, it was encountered by adding a resource for the banned API analyzer in the solutions root's Directory.Build.props:

<ItemGroup>
  <GlobalPackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" />
  <AdditionalFiles Include="$(MSBuildThisFileDirectory)/.meta/BannedSymbols.txt" />
</ItemGroup>

Copy link
Copy Markdown
Contributor

@LiHRaM LiHRaM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reporting and providing a fix!

Comment thread src/Podimo.ConstEmbed/ConstEmbedGenerator.cs Outdated
On some dotnet SDKs and platforms, it's possible for an incorrect empty
string to be returned by `AnalyzerConfigOptions.TryGetValue()` instead
of a null when the attribute was not found

While it does look to be an upstream bug, a missing class name is also
not an acceptable value to begin with as it fails the build. It would be
reasonable for us to check for and skip entries expressing empty class
names rather than nulls for anyone on dotnet SDKs with with this bug

The SDK/Platform known to be expressing this bug is 7.0.410, Linux x64
This is the current latest running on GitHub Actions for .NET 7.x

As for replicating the bug, it was encountered by adding a resource for
the banned API analyzer in the solutions root's `Directory.Build.props`:

```xml
<ItemGroup>
  <GlobalPackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" />
  <AdditionalFiles Include="$(MSBuildThisFileDirectory)/.meta/BannedSymbols.txt" />
</ItemGroup>
```
@LiHRaM LiHRaM merged commit 37f63f1 into podimo:develop Aug 26, 2024
@AshleighAdams
Copy link
Copy Markdown
Contributor Author

@LiHRaM Hey, just wondering if you're going to do a release containing this fix?

@LiHRaM
Copy link
Copy Markdown
Contributor

LiHRaM commented Oct 22, 2024

@AshleighAdams Hey, sorry about that! I've published the latest version now, thanks for your patience!

@AshleighAdams
Copy link
Copy Markdown
Contributor Author

Thank you!

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