Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
genlu committed Feb 8, 2023
1 parent 2940423 commit f4f2ef8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ protected override async Task FixAllAsync(
return;
}

Contract.ThrowIfNull(namespaceDecl);
document = await ConvertAsync(document, namespaceDecl, options.GetFormattingOptions(), cancellationToken).ConfigureAwait(false);
var newRoot = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
editor.ReplaceNode(editor.OriginalRoot, newRoot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Threading;
using Microsoft.CodeAnalysis.LanguageService;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.GenerateMember
{
Expand Down Expand Up @@ -137,6 +138,8 @@ private static void TryDetermineTypeToGenerateInWorker(
if (syntaxFacts.IsAttributeNamedArgumentIdentifier(expression))
{
var attributeNode = expression.GetAncestors().FirstOrDefault(syntaxFacts.IsAttribute);
Contract.ThrowIfNull(attributeNode);

var attributeName = syntaxFacts.GetNameOfAttribute(attributeNode);
var attributeType = semanticModel.GetTypeInfo(attributeName, cancellationToken);

Expand Down

0 comments on commit f4f2ef8

Please sign in to comment.