Skip to content

Commit 27ca575

Browse files
committed
No resources needed yet
1 parent 970ca19 commit 27ca575

File tree

2 files changed

+9
-156
lines changed

2 files changed

+9
-156
lines changed

src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff/MemoryOutputDiffGenerator.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ private async Task<string> ProcessAfterAssemblyAsync(IAssemblySymbol afterAssemb
189189
CSharpAssemblyDocumentGenerator docGenerator = new(_log, options);
190190

191191
Document document = await docGenerator.GetDocumentForAssemblyAsync(assemblySymbol).ConfigureAwait(false); // Super hot and resource-intensive path
192-
SyntaxNode root = await document.GetSyntaxRootAsync().ConfigureAwait(false) ?? throw new InvalidOperationException(string.Format(Resources.RootNodeNotFound, assemblySymbol.Name));
193-
SemanticModel model = await document.GetSemanticModelAsync().ConfigureAwait(false) ?? throw new InvalidOperationException(string.Format(Resources.SemanticModelNotFound, assemblySymbol.Name));
192+
SyntaxNode root = await document.GetSyntaxRootAsync().ConfigureAwait(false) ?? throw new InvalidOperationException($"Root node could not be found for document of assembly '{assemblySymbol.Name}'.");
193+
SemanticModel model = await document.GetSemanticModelAsync().ConfigureAwait(false) ?? throw new InvalidOperationException($"Semantic model could not be found for document of assembly '{assemblySymbol.Name}'.");
194194

195195
return (root, model);
196196
}
@@ -353,7 +353,7 @@ private ConcurrentDictionary<string, MemberDeclarationSyntax> CollectChildrenNod
353353
}
354354
else
355355
{
356-
throw new InvalidOperationException(string.Format(Resources.UnexpectedNodeType, parentNode.Kind()));
356+
throw new InvalidOperationException($"Unexpected node type '{parentNode.Kind()}'");
357357
}
358358

359359
return dictionary;
@@ -410,7 +410,7 @@ private ConcurrentDictionary<string, MemberDeclarationSyntax> CollectChildrenNod
410410
}
411411
break;
412412
default:
413-
throw new NotSupportedException(string.Format(Resources.UnexpectedChangeType, changeType));
413+
throw new NotSupportedException($"Unexpected change type '{changeType}'.");
414414
}
415415

416416
return sb.Length > 0 ? sb.ToString() : null;
@@ -520,7 +520,7 @@ private Dictionary<string, AttributeSyntax> CollectAttributeNodes(MemberDeclarat
520520

521521
if (!dictionary.TryAdd(GetAttributeDocId(constructor, attributeNode, model), realAttributeNode))
522522
{
523-
_log.LogWarning(string.Format(Resources.AttributeAlreadyExists, realAttributeNode.ToFullString(), GetDocId(memberNode, model)));
523+
_log.LogWarning($"Attribute already exists in dictionary. Attribute: '{realAttributeNode.ToFullString()}', Member: '{GetDocId(memberNode, model)}'");
524524
}
525525
}
526526
}
@@ -568,7 +568,7 @@ private string GetCodeWrappedByParent(string diffedChildrenCode, SyntaxNode pare
568568
ChangeType.Inserted => GenerateAddedDiff(codeToDiff),
569569
ChangeType.Deleted => GenerateDeletedDiff(codeToDiff),
570570
ChangeType.Unchanged => codeToDiff,
571-
_ => throw new InvalidOperationException(string.Format(Resources.UnexpectedChangeType, parentChangeType)),
571+
_ => throw new InvalidOperationException($"Unexpected change type '{parentChangeType}'."),
572572
};
573573
}
574574
}
@@ -627,7 +627,7 @@ private string GetClosingBraceCode(SyntaxNode childlessNode, SyntaxTriviaList le
627627
RecordDeclarationSyntax recordDecl => recordDecl.CloseBraceToken.IsMissing ? _missingCloseBrace : recordDecl.CloseBraceToken,
628628
BaseTypeDeclarationSyntax typeDecl => typeDecl.CloseBraceToken,
629629
NamespaceDeclarationSyntax nsDecl => nsDecl.CloseBraceToken,
630-
_ => throw new InvalidOperationException(string.Format(Resources.UnexpectedNodeType, childlessNode.Kind()))
630+
_ => throw new InvalidOperationException($"Unexpected node type '{childlessNode.Kind()}'")
631631
};
632632

633633
return closeBrace.WithTrailingTrivia(_endOfLineTrivia)
@@ -691,7 +691,7 @@ private string GetDocId(SyntaxNode node, SemanticModel model)
691691
EventFieldDeclarationSyntax eventFieldDeclaration => model.GetDeclaredSymbol(eventFieldDeclaration.Declaration.Variables.First()),
692692
PropertyDeclarationSyntax propertyDeclaration => model.GetDeclaredSymbol(propertyDeclaration),
693693
_ => model.GetDeclaredSymbol(node)
694-
};
694+
};
695695

696696
if (symbol?.GetDocumentationCommentId() is string docId)
697697
{
@@ -704,7 +704,7 @@ private string GetDocId(SyntaxNode node, SemanticModel model)
704704
return docId;
705705
}
706706

707-
throw new NullReferenceException(string.Format(Resources.CouldNotGetDocIdForNode, node));
707+
throw new NullReferenceException($"Could not get the DocID for node: {node}");
708708
}
709709

710710
private static string? GenerateAddedDiff(SyntaxNode afterNode) => GenerateAddedDiff(afterNode.ToFullString());

src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff/Resources.resx

Lines changed: 0 additions & 147 deletions
This file was deleted.

0 commit comments

Comments
 (0)