-
Notifications
You must be signed in to change notification settings - Fork 127
Always mark Delegate types as instantiated #454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
marek-safar
merged 1 commit into
dotnet:master
from
Unity-Technologies:master-always-mark-del-as-inst-possible
Feb 4, 2019
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
32 changes: 32 additions & 0 deletions
32
...ests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseOnTypeInAssemblyAttribute.cs
This file contains hidden or 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,32 @@ | ||
| using System; | ||
|
|
||
| namespace Mono.Linker.Tests.Cases.Expectations.Assertions { | ||
| [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] | ||
| public class KeptBaseOnTypeInAssemblyAttribute : BaseInAssemblyAttribute { | ||
| public KeptBaseOnTypeInAssemblyAttribute (string assemblyFileName, Type type, string baseAssemblyFileName, Type baseType) | ||
| { | ||
| if (type == null) | ||
| throw new ArgumentNullException (nameof (type)); | ||
| if (string.IsNullOrEmpty (assemblyFileName)) | ||
| throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName)); | ||
|
|
||
| if (string.IsNullOrEmpty (baseAssemblyFileName)) | ||
| throw new ArgumentException ("Value cannot be null or empty.", nameof (baseAssemblyFileName)); | ||
| if (baseType == null) | ||
| throw new ArgumentException ("Value cannot be null or empty.", nameof (baseType)); | ||
| } | ||
|
|
||
| public KeptBaseOnTypeInAssemblyAttribute (string assemblyFileName, string typeName, string baseAssemblyFileName, string baseTypeName) | ||
| { | ||
| if (string.IsNullOrEmpty (assemblyFileName)) | ||
| throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName)); | ||
| if (string.IsNullOrEmpty (typeName)) | ||
| throw new ArgumentException ("Value cannot be null or empty.", nameof (typeName)); | ||
|
|
||
| if (string.IsNullOrEmpty (baseAssemblyFileName)) | ||
| throw new ArgumentException ("Value cannot be null or empty.", nameof (baseAssemblyFileName)); | ||
| if (string.IsNullOrEmpty (baseTypeName)) | ||
| throw new ArgumentException ("Value cannot be null or empty.", nameof (baseTypeName)); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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
30 changes: 30 additions & 0 deletions
30
...ests/Mono.Linker.Tests.Cases/CoreLink/DelegateAndMulticastDelegateKeepInstantiatedReqs.cs
This file contains hidden or 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,30 @@ | ||
| using System; | ||
| using System.Runtime.Serialization; | ||
| using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
| using Mono.Linker.Tests.Cases.Expectations.Metadata; | ||
|
|
||
| namespace Mono.Linker.Tests.Cases.CoreLink { | ||
| /// <summary> | ||
| /// Delegate and is created from | ||
| /// </summary> | ||
| [SetupLinkerCoreAction ("link")] | ||
| [KeptBaseOnTypeInAssembly ("mscorlib.dll", typeof (MulticastDelegate), "mscorlib.dll", typeof (Delegate))] | ||
|
|
||
| // Check a couple override methods to verify they were not removed | ||
| [KeptMemberInAssembly ("mscorlib.dll", typeof (MulticastDelegate), "GetHashCode()")] | ||
| [KeptMemberInAssembly ("mscorlib.dll", typeof (MulticastDelegate), "GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")] | ||
|
|
||
| [KeptMemberInAssembly ("mscorlib.dll", typeof (Delegate), "GetHashCode()")] | ||
| [KeptMemberInAssembly ("mscorlib.dll", typeof (Delegate), "Equals(System.Object)")] | ||
| [KeptInterfaceOnTypeInAssembly("mscorlib.dll", typeof (Delegate), "mscorlib.dll", typeof (ICloneable))] | ||
| [KeptInterfaceOnTypeInAssembly("mscorlib.dll", typeof (Delegate), "mscorlib.dll", typeof (ISerializable))] | ||
|
|
||
| // Fails due to Runtime critical type System.Reflection.CustomAttributeData not found. | ||
| [SkipPeVerify(SkipPeVerifyForToolchian.Pedump)] | ||
| public class DelegateAndMulticastDelegateKeepInstantiatedReqs { | ||
| public static void Main () | ||
| { | ||
| typeof (MulticastDelegate).ToString (); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be problematic as the mscorlib will be used for execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t follow. Are you saying that it’s bad that this test is dependent on a particular mscorlib?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am saying it won't be easy to run the test