-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
APIView - Visualize when assemblies expose internals via InternalsVis…
…ibleTo (#7116)
- Loading branch information
1 parent
d52c068
commit 21045c2
Showing
15 changed files
with
189 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ public abstract class Class2 { | |
} | ||
public static class Class3 { | ||
} | ||
/*-*/internal class InternalClass { }/*-*/ | ||
} |
1 change: 1 addition & 0 deletions
1
src/dotnet/APIView/APIViewUnitTests/ExactFormatting/Delegate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
namespace A { | ||
public delegate int A(int b, bool d = false); | ||
/*-*/internal delegate int B(int b, bool d = false);/*-*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,7 @@ public enum NotFlags { | |
C = 2, | ||
D = 7, | ||
} | ||
/*-*/internal enum InternalEnum {/*-*/ | ||
/*-*/A = 1/*-*/ | ||
/*-*/}/*-*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/dotnet/APIView/APIViewUnitTests/InternalsVisibleTo/Inheritance.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/*-*/using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading.Tasks; | ||
using C; | ||
|
||
[assembly: InternalsVisibleTo("Azure.Some.Client")] | ||
[assembly: InternalsVisibleTo("Azure.Some.Client.Tests")] | ||
[assembly: InternalsVisibleTo("Azure.Some.Client.Perf")] | ||
namespace C { | ||
internal class FriendAttribute : Attribute { | ||
public FriendAttribute(string friendAssemblyName) { } | ||
} | ||
} | ||
internal interface IInternal | ||
{ | ||
void M(); | ||
void N(); | ||
}/*-*/ | ||
[Friend("TestProject")] | ||
internal interface IInternalWithFriend { | ||
void M(); | ||
void N(); | ||
} | ||
namespace A { | ||
public interface I1 { | ||
} | ||
public interface I2<G> { | ||
} | ||
public abstract class K : I1 { | ||
protected K()/*-*/{/*-*/;/*-*/}/*-*/ | ||
public abstract void M(); | ||
} | ||
public abstract class L : IDisposable, IAsyncDisposable { | ||
protected L()/*-*/{/*-*/;/*-*/}/*-*/ | ||
public abstract void Dispose(); | ||
public abstract ValueTask DisposeAsync(); | ||
} | ||
[Friend("TestProject")] | ||
internal abstract class M : IDisposable { | ||
protected M()/*-*/{/*-*/;/*-*/}/*-*/ | ||
void IDisposable.Dispose()/*-*/{/*-*/;/*-*/}/*-*/ | ||
} | ||
public class NClass : K, I1, I2<K> { | ||
public NClass()/*-*/{/*-*/;/*-*/}/*-*/ | ||
public override sealed void M()/*-*/{/*-*/;/*-*/}/*-*/ | ||
} | ||
public class OClass/*-*/ : IInternal/*-*/ { | ||
public OClass()/*-*/{/*-*/;/*-*/}/*-*/ | ||
public void M()/*-*/{/*-*/;/*-*/}/*-*//*-*/ | ||
void IInternal.N(){} | ||
/*-*/ | ||
} | ||
public class PClass : IInternalWithFriend { | ||
public PClass()/*-*/{/*-*/;/*-*/}/*-*/ | ||
void IInternalWithFriend.N()/*-*/{/*-*/;/*-*/}/*-*/ | ||
public void M()/*-*/{/*-*/;/*-*/}/*-*/ | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/dotnet/APIView/APIViewUnitTests/InternalsVisibleTo/Properties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/*-*/ | ||
using System; | ||
using System.Runtime.CompilerServices; | ||
using B; | ||
|
||
[assembly: InternalsVisibleTo("Azure.Some.Client")] | ||
[assembly: InternalsVisibleTo("Azure.Some.Client.Tests")] | ||
[assembly: InternalsVisibleTo("Azure.Some.Client.Perf")] | ||
namespace B { | ||
internal class FriendAttribute : Attribute { | ||
public FriendAttribute(string friendAssemblyName) { } | ||
} | ||
} | ||
/*-*/ | ||
namespace A { | ||
public class PublicClass { | ||
public PublicClass()/*-*/{/*-*/;/*-*/}/*-*/ | ||
/*-*/internal int InternalProperty { get; set; }/*-*/ | ||
[Friend("TestProject")] | ||
internal void InternalMethodWithFriendAttribute()/*-*/{/*-*/;/*-*/}/*-*/ | ||
[Friend("TestProject")] | ||
internal int InternalPropertyWithFriendAttribute { get; set; } | ||
/*-*/internal void InternalMethod(){ }/*-*/ | ||
public void PublicMethod()/*-*/{/*-*/;/*-*/}/*-*/ | ||
public int PublicProperty { get; set; } | ||
} | ||
} |