Skip to content

Commit 8c6210c

Browse files
committed
Eric comments
1 parent 4d3b512 commit 8c6210c

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/Microsoft.ML.Core/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
using System.Runtime.CompilerServices;
66

77
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.TestFramework, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")]
8-
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.CodeAnalyzer.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")]

tools-local/Microsoft.ML.InternalCodeAnalyzer/BestFriendAnalyzer.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ public sealed class BestFriendAnalyzer : DiagnosticAnalyzer
1717
private const string Category = "Access";
1818
internal const string DiagnosticId = "MSML_NoBestFriendInternal";
1919

20-
private const string Title = "Cross-assembly internal access requires.";
20+
private const string Title = "Cross-assembly internal access requires referenced item to have " + AttributeName + " attribute.";
2121
private const string Format = "Access of '{0}' is a cross assembly internal " +
2222
"reference, and the declaring assembly wants these accesses to be on something " +
2323
"with the attribute " + AttributeName + ".";
2424
private const string Description =
25-
"The ML.NET .";
25+
"The identifier indicated is defined as an internal member of an assembly that has the " +
26+
AssemblyAttributeName + " assembly-level attribute set. Even with friend access to that " +
27+
"assembly, such a usage requires that the item have the " + AttributeName + " on it.";
2628

2729
private static DiagnosticDescriptor Rule =
2830
new DiagnosticDescriptor(DiagnosticId, Title, Format, Category,
@@ -44,13 +46,13 @@ private void Analyze(SemanticModelAnalysisContext context)
4446
var model = context.SemanticModel;
4547
var comp = model.Compilation;
4648

47-
// Get the symbols of the key types we are analyzing. If we can't find any of them there is
48-
// no point in going further.
49-
var attrType = comp.GetTypeByMetadataName(AttributeName);
50-
if (attrType == null)
49+
// Get the symbols of the key types we are analyzing. If we can't find either
50+
// of them there is no point in going further.
51+
var bestFriendAttributeType = comp.GetTypeByMetadataName(AttributeName);
52+
if (bestFriendAttributeType == null)
5153
return;
52-
var assemblyAttrType = comp.GetTypeByMetadataName(AssemblyAttributeName);
53-
if (assemblyAttrType == null)
54+
var wantsToBeBestFriendsAttributeType = comp.GetTypeByMetadataName(AssemblyAttributeName);
55+
if (wantsToBeBestFriendsAttributeType == null)
5456
return;
5557

5658
var myAssembly = comp.Assembly;
@@ -87,12 +89,12 @@ private void Analyze(SemanticModelAnalysisContext context)
8789
// further.
8890
if (!assemblyHasAttrMap.TryGetValue(symbolAssembly, out bool assemblyWantsBestFriends))
8991
{
90-
assemblyWantsBestFriends = symbolAssembly.GetAttributes().Any(a => a.AttributeClass == assemblyAttrType);
92+
assemblyWantsBestFriends = symbolAssembly.GetAttributes().Any(a => a.AttributeClass == wantsToBeBestFriendsAttributeType);
9193
assemblyHasAttrMap[symbolAssembly] = assemblyWantsBestFriends;
9294
}
9395
if (!assemblyWantsBestFriends)
9496
continue;
95-
if (symbol.GetAttributes().Any(a => a.AttributeClass == attrType))
97+
if (symbol.GetAttributes().Any(a => a.AttributeClass == bestFriendAttributeType))
9698
{
9799
// You're not just a friend, you're my best friend!
98100
continue;

0 commit comments

Comments
 (0)