Fix nullref in ComponentsAnalyzer (#18608)
This commit is contained in:
parent
2481862682
commit
547350002a
|
|
@ -30,6 +30,9 @@
|
||||||
-->
|
-->
|
||||||
<IsStableBuild>false</IsStableBuild>
|
<IsStableBuild>false</IsStableBuild>
|
||||||
<IsStableBuild Condition=" '$(DotNetFinalVersionKind)' == 'release' ">true</IsStableBuild>
|
<IsStableBuild Condition=" '$(DotNetFinalVersionKind)' == 'release' ">true</IsStableBuild>
|
||||||
|
|
||||||
|
<!-- Workaround issue with ComponentsAnalyzer throwing for interfaces -->
|
||||||
|
<DisableImplicitComponentsAnalyzers>true</DisableImplicitComponentsAnalyzers>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Import Project="eng\FlakyTests.BeforeArcade.props" />
|
<Import Project="eng\FlakyTests.BeforeArcade.props" />
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ namespace Microsoft.Extensions.Internal
|
||||||
// Similar logic here to VisitDeclarationSymbol, keep these in sync.
|
// Similar logic here to VisitDeclarationSymbol, keep these in sync.
|
||||||
private void VisitOperationSymbol(OperationAnalysisContext context, ISymbol symbol)
|
private void VisitOperationSymbol(OperationAnalysisContext context, ISymbol symbol)
|
||||||
{
|
{
|
||||||
if (symbol.ContainingAssembly == context.Compilation.Assembly)
|
if (symbol == null || symbol.ContainingAssembly == context.Compilation.Assembly)
|
||||||
{
|
{
|
||||||
// The type is being referenced within the same assembly. This is valid use of an "internal" type
|
// The type is being referenced within the same assembly. This is valid use of an "internal" type
|
||||||
return;
|
return;
|
||||||
|
|
@ -155,7 +155,7 @@ namespace Microsoft.Extensions.Internal
|
||||||
// Similar logic here to VisitOperationSymbol, keep these in sync.
|
// Similar logic here to VisitOperationSymbol, keep these in sync.
|
||||||
private void VisitDeclarationSymbol(SymbolAnalysisContext context, ISymbol symbol, ISymbol symbolForDiagnostic)
|
private void VisitDeclarationSymbol(SymbolAnalysisContext context, ISymbol symbol, ISymbol symbolForDiagnostic)
|
||||||
{
|
{
|
||||||
if (symbol.ContainingAssembly == context.Compilation.Assembly)
|
if (symbol == null || symbol.ContainingAssembly == context.Compilation.Assembly)
|
||||||
{
|
{
|
||||||
// This is part of the compilation, avoid this analyzer when building from source.
|
// This is part of the compilation, avoid this analyzer when building from source.
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,15 @@ namespace Microsoft.AspNetCore.Components.Analyzers.Tests.TestFiles.ComponentInt
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*MMParameter*/protected override Task UpdateDisplayAsync(in RenderBatch renderBatch)
|
/*MMParameter*/protected override Task UpdateDisplayAsync(in RenderBatch renderBatch)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*MMReturnType*/private Renderer GetRenderer() => _field;
|
/*MMReturnType*/private Renderer GetRenderer() => _field;
|
||||||
|
|
||||||
|
public interface ITestInterface
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue