Skip to content

Commit

Permalink
Fix nullref in ComponentsAnalyzer (#18608)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrennanConroy committed Jan 28, 2020
1 parent 2481862 commit 5473500
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Directory.Build.props
Expand Up @@ -30,6 +30,9 @@
-->
<IsStableBuild>false</IsStableBuild>
<IsStableBuild Condition=" '$(DotNetFinalVersionKind)' == 'release' ">true</IsStableBuild>

<!-- Workaround issue with ComponentsAnalyzer throwing for interfaces -->
<DisableImplicitComponentsAnalyzers>true</DisableImplicitComponentsAnalyzers>
</PropertyGroup>

<Import Project="eng\FlakyTests.BeforeArcade.props" />
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Analyzers/src/InternalUsageAnalyzer.cs
Expand Up @@ -126,7 +126,7 @@ private void AnalyzeSymbol(SymbolAnalysisContext context)
// Similar logic here to VisitDeclarationSymbol, keep these in sync.
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
return;
Expand Down Expand Up @@ -155,7 +155,7 @@ private void VisitOperationSymbol(OperationAnalysisContext context, ISymbol symb
// Similar logic here to VisitOperationSymbol, keep these in sync.
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.
return;
Expand Down
Expand Up @@ -22,11 +22,15 @@ protected override void HandleException(Exception exception)
throw new NotImplementedException();
}

/*MMParameter*/protected override Task UpdateDisplayAsync(in RenderBatch renderBatch)
/*MMParameter*/protected override Task UpdateDisplayAsync(in RenderBatch renderBatch)
{
throw new NotImplementedException();
}

/*MMReturnType*/private Renderer GetRenderer() => _field;

public interface ITestInterface
{
}
}
}

0 comments on commit 5473500

Please sign in to comment.