Fix warnings in external .NET projects

This commit is contained in:
YoshiRulz 2022-09-28 06:43:31 +10:00
parent 04fcf59afe
commit 65f5aecfa6
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
4 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,9 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<Import Project="../../Common.props" />
<PropertyGroup>
<NoWarn>$(NoWarn);SA1200</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" PrivateAssets="all" />

View File

@ -31,7 +31,7 @@ namespace BizHawk.SrcGen.ReflectionCache
private string CalcNamespace()
{
// black magic wizardry to find common prefix https://stackoverflow.com/a/35081977
var ns = new string(_namespaces.First()
var ns = new string(_namespaces[0]
.Substring(0, _namespaces.Min(s => s.Length))
.TakeWhile((c, i) => _namespaces.All(s => s[i] == c))
.ToArray());
@ -44,7 +44,7 @@ namespace BizHawk.SrcGen.ReflectionCache
{
SimpleNameSyntax simple => simple.Identifier.ValueText,
QualifiedNameSyntax qual => $"{Ser(qual.Left)}.{Ser(qual.Right)}",
_ => throw new Exception()
_ => throw new InvalidOperationException()
};
if (_namespace != null || syntaxNode is not NamespaceDeclarationSyntax syn) return;
var newNS = Ser(syn.Name);

View File

@ -3,4 +3,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<Import Project="../../Common.props" />
<PropertyGroup>
<Nullable>disable</Nullable>
</PropertyGroup>
</Project>