diff options
author | Marek Safar <marek.safar@gmail.com> | 2020-04-24 02:01:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-24 02:01:35 +0300 |
commit | 7263df610e2f9405fd8f49f5973f0e4182b0ad5f (patch) | |
tree | dcff6ce9465f9c829b52a1f8bb17da7a9c6b910d | |
parent | d60f4eab2982dfef19d71dfcf2d5ab2286950af2 (diff) |
Ensure consistent sources formatting (#1138)
* Apply consistent formatting based on .editorconfig
```
dotnet format -f <path>
```
* Add lint step to the CI
* Use local tool
* Suppress publish logs warning
* Fix more style errors
* Fixes bad merge
* Write something to log dir
* Move lint job to global scope
So it doesn't get the arcade publish logs/test steps injected.
* Split sources and tests reporting
* Include also src folder in the run
* Exclude cecil sources
* Remove duplicate line
* Trigger notification
* Format more code
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
864 files changed, 8537 insertions, 6326 deletions
diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 000000000..ce5ccf96b --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-format": { + "version": "3.3.111304", + "commands": [ + "dotnet-format" + ] + } + } +}
\ No newline at end of file diff --git a/.editorconfig b/.editorconfig index 848c05f89..58a51dcfd 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,11 +4,37 @@ end_of_line = "lf" [*.cs] indent_style = tab +indent_size = 4 csharp_new_line_before_open_brace = types,methods csharp_new_line_before_else = false csharp_new_line_before_catch = false csharp_new_line_before_finally = false +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true + csharp_space_after_keywords_in_control_flow_statements = true csharp_space_between_method_declaration_name_and_open_parenthesis = true csharp_space_between_method_call_name_and_opening_parenthesis = true -csharp_space_before_open_square_brackets = true
\ No newline at end of file +csharp_space_before_open_square_brackets = false +csharp_space_after_cast = true + +csharp_indent_switch_labels = false + +# Sort using and Import directives with System.* appearing first +dotnet_sort_system_directives_first = true + +# Prefer property-like constructs to have an expression-body +csharp_style_expression_bodied_properties = true:none +csharp_style_expression_bodied_indexers = true:none +csharp_style_expression_bodied_accessors = true:none + +# Suggest more modern language features when available +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion + +# Avoid redundant accessibility modifiers when they're default +dotnet_style_require_accessibility_modifiers = omit_if_default:suggestion diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index 3136b3a6a..924482253 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -120,6 +120,26 @@ stages: displayName: Build illink.sln $(_BuildConfig) - ${{ if eq(variables.officialBuild, 'false') }}: + - job: Lint + pool: + name: Hosted Ubuntu 1604 + steps: + - checkout: self + submodules: true + - task: DotNetCoreCLI@2 + displayName: 'Restore dotnet tools' + inputs: + command: 'custom' + custom: 'tool' + arguments: 'restore' + - task: DotNetCoreCLI@2 + displayName: 'Lint ILLinker' + inputs: + command: 'custom' + custom: 'tool' + arguments: 'run dotnet-format --dry-run --check --verbosity diagnostic -f . --exclude src/analyzer,src/tuner,external' + + - ${{ if eq(variables.officialBuild, 'false') }}: - job: Linux_Mono pool: name: Hosted Ubuntu 1604 diff --git a/src/ILLink.Tasks/CheckEmbeddedRootDescriptor.cs b/src/ILLink.Tasks/CheckEmbeddedRootDescriptor.cs index a3bf901b9..e64ade1e3 100644 --- a/src/ILLink.Tasks/CheckEmbeddedRootDescriptor.cs +++ b/src/ILLink.Tasks/CheckEmbeddedRootDescriptor.cs @@ -18,7 +18,7 @@ namespace ILLink.Tasks [Output] public bool HasEmbeddedRootDescriptor { get; set; } - public override bool Execute() + public override bool Execute () { ModuleDefinition module = ModuleDefinition.ReadModule (AssemblyPath.ItemSpec); string assemblyName = module.Assembly.Name.Name; diff --git a/src/ILLink.Tasks/CompareSizes.cs b/src/ILLink.Tasks/CompareSizes.cs index 5dec1dbe6..77ed932be 100644 --- a/src/ILLink.Tasks/CompareSizes.cs +++ b/src/ILLink.Tasks/CompareSizes.cs @@ -28,10 +28,10 @@ namespace ILLink.Tasks [Required] public ITaskItem[] LinkedAssemblies { get; set; } - public override bool Execute() + public override bool Execute () { - string[] unlinkedFiles = UnlinkedAssemblies.Select (i => i.ItemSpec).ToArray(); - string[] linkedFiles = LinkedAssemblies.Select (i => i.ItemSpec).ToArray(); + string[] unlinkedFiles = UnlinkedAssemblies.Select (i => i.ItemSpec).ToArray (); + string[] linkedFiles = LinkedAssemblies.Select (i => i.ItemSpec).ToArray (); Dictionary<string, AssemblySizes> sizes = new Dictionary<string, AssemblySizes> (); @@ -54,7 +54,7 @@ namespace ILLink.Tasks continue; } string fileName = Path.GetFileName (linkedFile); - if (!sizes.ContainsKey(fileName)) { + if (!sizes.ContainsKey (fileName)) { Console.WriteLine ($"{linkedFile} was specified as an assembly kept by the linker, but {fileName} was not specified as a managed publish assembly."); continue; } @@ -80,7 +80,7 @@ namespace ILLink.Tasks "Total size of assemblies", totalUnlinked, totalLinked, - ((double)totalUnlinked - (double)totalLinked) / (double)totalUnlinked); + ((double) totalUnlinked - (double) totalLinked) / (double) totalUnlinked); Console.WriteLine ("{0, -60} {1,-20:N0} {2, -20:N0} {3, -10:P}", "-----------", @@ -94,12 +94,12 @@ namespace ILLink.Tasks assembly, sizes[assembly].unlinkedSize, sizes[assembly].linkedSize, - (double)(sizes[assembly].unlinkedSize - sizes[assembly].linkedSize)/(double)sizes[assembly].unlinkedSize); + (double) (sizes[assembly].unlinkedSize - sizes[assembly].linkedSize) / (double) sizes[assembly].unlinkedSize); } return true; } - public static long DirSize(DirectoryInfo d) + public static long DirSize (DirectoryInfo d) { long size = 0; // Add file sizes. diff --git a/src/ILLink.Tasks/ComputeManagedAssemblies.cs b/src/ILLink.Tasks/ComputeManagedAssemblies.cs index dd0dcb014..befbc62a0 100644 --- a/src/ILLink.Tasks/ComputeManagedAssemblies.cs +++ b/src/ILLink.Tasks/ComputeManagedAssemblies.cs @@ -20,11 +20,11 @@ namespace ILLink.Tasks [Output] public ITaskItem[] ManagedAssemblies { get; set; } - public override bool Execute() + public override bool Execute () { ManagedAssemblies = Assemblies - .Where(f => Utils.IsManagedAssembly(f.ItemSpec)) - .ToArray(); + .Where (f => Utils.IsManagedAssembly (f.ItemSpec)) + .ToArray (); return true; } } diff --git a/src/ILLink.Tasks/ComputeRemovedAssemblies.cs b/src/ILLink.Tasks/ComputeRemovedAssemblies.cs index e45209793..5a0111f1a 100644 --- a/src/ILLink.Tasks/ComputeRemovedAssemblies.cs +++ b/src/ILLink.Tasks/ComputeRemovedAssemblies.cs @@ -30,14 +30,14 @@ namespace ILLink.Tasks [Output] public ITaskItem[] RemovedAssemblies { get; set; } - public override bool Execute() + public override bool Execute () { var keptAssemblyNames = new HashSet<string> ( - KeptAssemblies.Select(i => Path.GetFileName(i.ItemSpec)) + KeptAssemblies.Select (i => Path.GetFileName (i.ItemSpec)) ); - RemovedAssemblies = InputAssemblies.Where(i => - !keptAssemblyNames.Contains(Path.GetFileName(i.ItemSpec)) - ).ToArray(); + RemovedAssemblies = InputAssemblies.Where (i => + !keptAssemblyNames.Contains (Path.GetFileName (i.ItemSpec)) + ).ToArray (); return true; } } diff --git a/src/ILLink.Tasks/CreateRootDescriptorFile.cs b/src/ILLink.Tasks/CreateRootDescriptorFile.cs index 4b126e4da..a5b12b21d 100644 --- a/src/ILLink.Tasks/CreateRootDescriptorFile.cs +++ b/src/ILLink.Tasks/CreateRootDescriptorFile.cs @@ -20,27 +20,27 @@ namespace ILLink.Tasks [Required] public ITaskItem RootDescriptorFilePath { get; set; } - public override bool Execute() + public override bool Execute () { - var roots = new XElement("linker"); + var roots = new XElement ("linker"); foreach (var assemblyItem in AssemblyNames) { var assemblyName = assemblyItem.ItemSpec; - roots.Add(new XElement("assembly", - new XAttribute("fullname", assemblyName), - new XElement("type", - new XAttribute("fullname", "*"), - new XAttribute("required", "true")))); + roots.Add (new XElement ("assembly", + new XAttribute ("fullname", assemblyName), + new XElement ("type", + new XAttribute ("fullname", "*"), + new XAttribute ("required", "true")))); } - var xdoc = new XDocument(roots); + var xdoc = new XDocument (roots); XmlWriterSettings xws = new XmlWriterSettings { Indent = true, OmitXmlDeclaration = true }; - using (XmlWriter xw = XmlWriter.Create(RootDescriptorFilePath.ItemSpec, xws)) { - xdoc.Save(xw); + using (XmlWriter xw = XmlWriter.Create (RootDescriptorFilePath.ItemSpec, xws)) { + xdoc.Save (xw); } return true; diff --git a/src/ILLink.Tasks/CreateRuntimeRootDescriptorFile.cs b/src/ILLink.Tasks/CreateRuntimeRootDescriptorFile.cs index bb3674e00..5e67ef0cf 100644 --- a/src/ILLink.Tasks/CreateRuntimeRootDescriptorFile.cs +++ b/src/ILLink.Tasks/CreateRuntimeRootDescriptorFile.cs @@ -103,28 +103,27 @@ namespace ILLink.Tasks void ProcessNamespaces (string namespaceFile) { - string [] namespaces = File.ReadAllLines (namespaceFile); + string[] namespaces = File.ReadAllLines (namespaceFile); // Process definitions of the form // #define g_SystemNS "System" // from namespace.h foreach (string namespaceDef in namespaces) { if (namespaceDef.StartsWith ("#define")) { - char [] separators = { '"', ' ', '\t' }; - string [] namespaceDefElements = namespaceDef.Split (separators, StringSplitOptions.RemoveEmptyEntries); + char[] separators = { '"', ' ', '\t' }; + string[] namespaceDefElements = namespaceDef.Split (separators, StringSplitOptions.RemoveEmptyEntries); int startIndex = "g_".Length; // E.g., if namespaceDefElements [1] is "g_RuntimeNS", lhs is "Runtime". - string lhs = namespaceDefElements [1].Substring (startIndex, namespaceDefElements [1].LastIndexOf ('N') - startIndex); + string lhs = namespaceDefElements[1].Substring (startIndex, namespaceDefElements[1].LastIndexOf ('N') - startIndex); if (namespaceDefElements.Length == 3) { // E.G., #define g_SystemNS "System" // "System" --> "System" - namespaceDictionary [lhs] = namespaceDefElements [2]; - } - else { + namespaceDictionary[lhs] = namespaceDefElements[2]; + } else { // E.g., #define g_RuntimeNS g_SystemNS ".Runtime" // "Runtime" --> "System.Runtime" - string prefix = namespaceDefElements [2].Substring (startIndex, namespaceDefElements [2].LastIndexOf ('N') - startIndex); - namespaceDictionary [lhs] = namespaceDictionary [prefix] + namespaceDefElements [3]; + string prefix = namespaceDefElements[2].Substring (startIndex, namespaceDefElements[2].LastIndexOf ('N') - startIndex); + namespaceDictionary[lhs] = namespaceDictionary[prefix] + namespaceDefElements[3]; } } } @@ -132,56 +131,51 @@ namespace ILLink.Tasks void ProcessMscorlib (string typeFile) { - string [] types = File.ReadAllLines (typeFile); + string[] types = File.ReadAllLines (typeFile); string classId; foreach (string def in types) { - string [] defElements = null; + string[] defElements = null; if (def.StartsWith ("DEFINE_") || def.StartsWith ("// DEFINE_")) { - char [] separators = { ',', '(', ')', ' ', '\t', '/' }; + char[] separators = { ',', '(', ')', ' ', '\t', '/' }; defElements = def.Split (separators, StringSplitOptions.RemoveEmptyEntries); } if (def.StartsWith ("DEFINE_CLASS(") || def.StartsWith ("// DEFINE_CLASS(")) { // E.g., DEFINE_CLASS(APP_DOMAIN, System, AppDomain) - classId = defElements [1]; // APP_DOMAIN - string classNamespace = defElements [2]; // System - string className = defElements [3]; // AppDomain + classId = defElements[1]; // APP_DOMAIN + string classNamespace = defElements[2]; // System + string className = defElements[3]; // AppDomain AddClass (classNamespace, className, classId); - } - else if (def.StartsWith ("DEFINE_CLASS_U(")) { + } else if (def.StartsWith ("DEFINE_CLASS_U(")) { // E.g., DEFINE_CLASS_U(System, AppDomain, AppDomainBaseObject) - string classNamespace = defElements [1]; // System - string className = defElements [2]; // AppDomain - classId = defElements [3]; // AppDomainBaseObject - // For these classes the sizes of managed and unmanaged classes and field offsets - // are compared so we need to preserve all fields. + string classNamespace = defElements[1]; // System + string className = defElements[2]; // AppDomain + classId = defElements[3]; // AppDomainBaseObject + // For these classes the sizes of managed and unmanaged classes and field offsets + // are compared so we need to preserve all fields. const bool keepAllFields = true; AddClass (classNamespace, className, classId, keepAllFields); - } - else if (def.StartsWith ("DEFINE_FIELD(")) { + } else if (def.StartsWith ("DEFINE_FIELD(")) { // E.g., DEFINE_FIELD(ACCESS_VIOLATION_EXCEPTION, IP, _ip) - classId = defElements [1]; // ACCESS_VIOLATION_EXCEPTION - string fieldName = defElements [3]; // _ip + classId = defElements[1]; // ACCESS_VIOLATION_EXCEPTION + string fieldName = defElements[3]; // _ip AddField (fieldName, classId); - } - else if (def.StartsWith ("DEFINE_METHOD(")) { + } else if (def.StartsWith ("DEFINE_METHOD(")) { // E.g., DEFINE_METHOD(APP_DOMAIN, ON_ASSEMBLY_LOAD, OnAssemblyLoadEvent, IM_Assembly_RetVoid) - string methodName = defElements [3]; // OnAssemblyLoadEvent - classId = defElements [1]; // APP_DOMAIN + string methodName = defElements[3]; // OnAssemblyLoadEvent + classId = defElements[1]; // APP_DOMAIN AddMethod (methodName, classId); - } - else if (def.StartsWith ("DEFINE_PROPERTY(") || def.StartsWith ("DEFINE_STATIC_PROPERTY(")) { + } else if (def.StartsWith ("DEFINE_PROPERTY(") || def.StartsWith ("DEFINE_STATIC_PROPERTY(")) { // E.g., DEFINE_PROPERTY(ARRAY, LENGTH, Length, Int) // or DEFINE_STATIC_PROPERTY(THREAD, CURRENT_THREAD, CurrentThread, Thread) - string propertyName = defElements [3]; // Length or CurrentThread - classId = defElements [1]; // ARRAY or THREAD + string propertyName = defElements[3]; // Length or CurrentThread + classId = defElements[1]; // ARRAY or THREAD AddMethod ("get_" + propertyName, classId); - } - else if (def.StartsWith ("DEFINE_SET_PROPERTY(")) { + } else if (def.StartsWith ("DEFINE_SET_PROPERTY(")) { // E.g., DEFINE_SET_PROPERTY(THREAD, UI_CULTURE, CurrentUICulture, CultureInfo) - string propertyName = defElements [3]; // CurrentUICulture - classId = defElements [1]; // THREAD + string propertyName = defElements[3]; // CurrentUICulture + classId = defElements[1]; // THREAD AddMethod ("get_" + propertyName, classId); AddMethod ("set_" + propertyName, classId); } @@ -190,16 +184,16 @@ namespace ILLink.Tasks public void ProcessCoreTypes (string corTypeFile) { - string [] corTypes = File.ReadAllLines (corTypeFile); + string[] corTypes = File.ReadAllLines (corTypeFile); foreach (string def in corTypes) { // E.g., TYPEINFO(ELEMENT_TYPE_VOID, "System", "Void", 0, TYPE_GC_NONE, false, true, false, false, false) // 0x01 if (def.StartsWith ("TYPEINFO(")) { - char [] separators = { ',', '(', ')', '"', ' ', '\t' }; - string [] defElements = def.Split (separators, StringSplitOptions.RemoveEmptyEntries); + char[] separators = { ',', '(', ')', '"', ' ', '\t' }; + string[] defElements = def.Split (separators, StringSplitOptions.RemoveEmptyEntries); string classId = null; - string classNamespace = defElements [2]; // System - string className = defElements [3]; // Void + string classNamespace = defElements[2]; // System + string className = defElements[3]; // Void AddClass (classNamespace, className, classId); } } @@ -207,16 +201,16 @@ namespace ILLink.Tasks public void ProcessExceptionTypes (string excTypeFile) { - string [] excTypes = File.ReadAllLines (excTypeFile); + string[] excTypes = File.ReadAllLines (excTypeFile); foreach (string def in excTypes) { // E.g., DEFINE_EXCEPTION(g_InteropNS, MarshalDirectiveException, false, COR_E_MARSHALDIRECTIVE) if (def.StartsWith ("DEFINE_EXCEPTION(")) { - char [] separators = { ',', '(', ')', ' ', '\t' }; - string [] defElements = def.Split (separators, StringSplitOptions.RemoveEmptyEntries); + char[] separators = { ',', '(', ')', ' ', '\t' }; + string[] defElements = def.Split (separators, StringSplitOptions.RemoveEmptyEntries); string classId = null; - string classNamespace = defElements [1]; // g_InteropNS - string className = defElements [2]; // MarshalDirectiveException + string classNamespace = defElements[1]; // g_InteropNS + string className = defElements[2]; // MarshalDirectiveException AddClass (classNamespace, className, classId); AddMethod (".ctor", classId, classNamespace, className); } @@ -227,8 +221,8 @@ namespace ILLink.Tasks { XmlDocument doc = new XmlDocument (); doc.Load (iLLinkTrimXmlFilePath); - XmlNode linkerNode = doc ["linker"]; - XmlNode assemblyNode = linkerNode ["assembly"]; + XmlNode linkerNode = doc["linker"]; + XmlNode assemblyNode = linkerNode["assembly"]; foreach (string typeName in classNamesToClassMembers.Keys) { XmlNode typeNode = doc.CreateElement ("type"); @@ -236,7 +230,7 @@ namespace ILLink.Tasks typeFullName.Value = typeName; typeNode.Attributes.Append (typeFullName); - ClassMembers members = classNamesToClassMembers [typeName]; + ClassMembers members = classNamesToClassMembers[typeName]; // We need to keep everyting in System.Runtime.InteropServices.WindowsRuntime and // System.Threading.Volatile. @@ -246,8 +240,7 @@ namespace ILLink.Tasks XmlAttribute preserve = doc.CreateAttribute ("preserve"); preserve.Value = "fields"; typeNode.Attributes.Append (preserve); - } - else if ((members.fields == null) && (members.methods == null)) { + } else if ((members.fields == null) && (members.methods == null)) { XmlAttribute preserve = doc.CreateAttribute ("preserve"); preserve.Value = "nothing"; typeNode.Attributes.Append (preserve); @@ -283,11 +276,11 @@ namespace ILLink.Tasks string fullClassName = GetFullClassName (classNamespace, className); if (fullClassName != null) { if ((classId != null) && (classId != "NoClass")) { - classIdsToClassNames [classId] = fullClassName; + classIdsToClassNames[classId] = fullClassName; } if (!classNamesToClassMembers.TryGetValue (fullClassName, out ClassMembers members)) { members = new ClassMembers (); - classNamesToClassMembers [fullClassName] = members; + classNamesToClassMembers[fullClassName] = members; } members.keepAllFields |= keepAllFields; } @@ -295,9 +288,9 @@ namespace ILLink.Tasks void AddField (string fieldName, string classId) { - string className = classIdsToClassNames [classId]; + string className = classIdsToClassNames[classId]; - ClassMembers members = classNamesToClassMembers [className]; + ClassMembers members = classNamesToClassMembers[className]; if (members.fields == null) { members.fields = new HashSet<string> (); @@ -309,13 +302,12 @@ namespace ILLink.Tasks { string fullClassName; if (classId != null) { - fullClassName = classIdsToClassNames [classId]; - } - else { + fullClassName = classIdsToClassNames[classId]; + } else { fullClassName = GetFullClassName (classNamespace, className); } - ClassMembers members = classNamesToClassMembers [fullClassName]; + ClassMembers members = classNamesToClassMembers[fullClassName]; if (members.methods == null) { members.methods = new HashSet<string> (); @@ -342,7 +334,7 @@ namespace ILLink.Tasks Log.LogError ("Unknown namespace: " + classNamespace); } - return namespaceDictionary [classNamespace] + "." + className; + return namespaceDictionary[classNamespace] + "." + className; } } } diff --git a/src/ILLink.Tasks/FilterByMetadata.cs b/src/ILLink.Tasks/FilterByMetadata.cs index e7e21feaa..af4560930 100644 --- a/src/ILLink.Tasks/FilterByMetadata.cs +++ b/src/ILLink.Tasks/FilterByMetadata.cs @@ -34,12 +34,12 @@ namespace ILLink.Tasks [Output] public ITaskItem[] FilteredItems { get; set; } - public override bool Execute() + public override bool Execute () { - var metadataValues = new HashSet<string>(MetadataValues.Select(v => v.ItemSpec)); + var metadataValues = new HashSet<string> (MetadataValues.Select (v => v.ItemSpec)); FilteredItems = Items - .Where(i => metadataValues.Contains(i.GetMetadata(MetadataName))) - .ToArray(); + .Where (i => metadataValues.Contains (i.GetMetadata (MetadataName))) + .ToArray (); return true; } } diff --git a/src/ILLink.Tasks/FindDuplicatesByMetadata.cs b/src/ILLink.Tasks/FindDuplicatesByMetadata.cs index a784bfa27..e5b961cdb 100644 --- a/src/ILLink.Tasks/FindDuplicatesByMetadata.cs +++ b/src/ILLink.Tasks/FindDuplicatesByMetadata.cs @@ -12,7 +12,7 @@ namespace ILLink.Tasks /// Items to scan. /// </summary> [Required] - public ITaskItem [] Items { get; set; } + public ITaskItem[] Items { get; set; } /// <summary> /// Name of metadata to scan for. @@ -26,14 +26,14 @@ namespace ILLink.Tasks /// items. /// </summary> [Output] - public ITaskItem [] DuplicateItems { get; set; } + public ITaskItem[] DuplicateItems { get; set; } /// <summary> /// Duplicate representatives: includes one input /// item from each set of duplicates. /// </summary> [Output] - public ITaskItem [] DuplicateRepresentatives { get; set; } + public ITaskItem[] DuplicateRepresentatives { get; set; } public override bool Execute () { diff --git a/src/ILLink.Tasks/FindNativeDeps.cs b/src/ILLink.Tasks/FindNativeDeps.cs index 30d52847d..d832480b2 100644 --- a/src/ILLink.Tasks/FindNativeDeps.cs +++ b/src/ILLink.Tasks/FindNativeDeps.cs @@ -17,13 +17,13 @@ namespace ILLink.Tasks /// dependencies. /// </summary> [Required] - public ITaskItem [] ManagedAssemblyPaths { get; set; } + public ITaskItem[] ManagedAssemblyPaths { get; set; } /// <summary> /// The set of native dependencies to keep even if they /// aren't found to be referenced by a managed assembly. /// </summary> - public ITaskItem [] NativeDepsToKeep { get; set; } + public ITaskItem[] NativeDepsToKeep { get; set; } /// <summary> /// The paths to the available native dependencies. We @@ -31,7 +31,7 @@ namespace ILLink.Tasks /// native files. /// </summary> [Required] - public ITaskItem [] NativeDepsPaths { get; set; } + public ITaskItem[] NativeDepsPaths { get; set; } /// <summary> /// The set of native dependencies to keep, including those @@ -40,7 +40,7 @@ namespace ILLink.Tasks /// input NativeDepsToKeep. /// </summary> [Output] - public ITaskItem [] KeptNativeDepsPaths { get; set; } + public ITaskItem[] KeptNativeDepsPaths { get; set; } public override bool Execute () { @@ -53,14 +53,14 @@ namespace ILLink.Tasks var managedAssemblies = ManagedAssemblyPaths.Select (i => i.ItemSpec).ToArray (); foreach (string managedAssembly in managedAssemblies) { - using (var peReader = new PEReader(new FileStream (managedAssembly, FileMode.Open, FileAccess.Read, FileShare.Read))) { + using (var peReader = new PEReader (new FileStream (managedAssembly, FileMode.Open, FileAccess.Read, FileShare.Read))) { if (peReader.HasMetadata) { var reader = peReader.GetMetadataReader (); for (int i = 1, count = reader.GetTableRowCount (TableIndex.ModuleRef); i <= count; i++) { var moduleRef = reader.GetModuleReference (MetadataTokens.ModuleReferenceHandle (i)); var moduleName = reader.GetString (moduleRef.Name); - var moduleRefCandidates = new [] { moduleName, moduleName + ".dll", moduleName + ".so", moduleName + ".dylib" }; + var moduleRefCandidates = new[] { moduleName, moduleName + ".dll", moduleName + ".so", moduleName + ".dylib" }; bool foundModuleRef = false; foreach (string moduleRefCandidate in moduleRefCandidates) { @@ -71,7 +71,7 @@ namespace ILLink.Tasks } if (!foundModuleRef) - Log.LogMessage("unsatisfied DLLImport: " + managedAssembly + " -> " + moduleName); + Log.LogMessage ("unsatisfied DLLImport: " + managedAssembly + " -> " + moduleName); } } } diff --git a/src/ILLink.Tasks/LinkTask.cs b/src/ILLink.Tasks/LinkTask.cs index 4f0193af5..09e9ba6e0 100644 --- a/src/ILLink.Tasks/LinkTask.cs +++ b/src/ILLink.Tasks/LinkTask.cs @@ -27,14 +27,14 @@ namespace ILLink.Tasks /// Maps to '-reference', and possibly '-p', '--enable-opt', '--disable-opt' /// </summary> [Required] - public ITaskItem [] AssemblyPaths { get; set; } + public ITaskItem[] AssemblyPaths { get; set; } /// <summary> /// Paths to assembly files that are reference assemblies, /// representing the surface area for compilation. /// Maps to '-reference', with action set to 'skip' via '-p'. /// </summary> - public ITaskItem [] ReferenceAssemblyPaths { get; set; } + public ITaskItem[] ReferenceAssemblyPaths { get; set; } /// <summary> /// The names of the assemblies to root. This should contain @@ -47,7 +47,7 @@ namespace ILLink.Tasks /// files, or pass extra arguments for illink. /// </summary> [Required] - public ITaskItem [] RootAssemblyNames { get; set; } + public ITaskItem[] RootAssemblyNames { get; set; } /// <summary> /// The directory in which to place linked assemblies. @@ -62,7 +62,7 @@ namespace ILLink.Tasks /// documentation for details about the format. /// Maps to '-x'. /// </summary> - public ITaskItem [] RootDescriptorFiles { get; set; } + public ITaskItem[] RootDescriptorFiles { get; set; } /// <summary> /// Boolean specifying whether to enable beforefieldinit optimization globally. @@ -112,7 +112,7 @@ namespace ILLink.Tasks /// the feature setting. /// Maps to '--feature'. /// </summary> - public ITaskItem [] FeatureSettings { get; set; } + public ITaskItem[] FeatureSettings { get; set; } /// <summary> /// Boolean specifying whether to enable sealer optimization globally. @@ -121,7 +121,7 @@ namespace ILLink.Tasks public bool Sealer { set => _sealer = value; } bool? _sealer; - static readonly string [] _optimizationNames = new string [] { + static readonly string[] _optimizationNames = new string[] { "BeforeFieldInit", "OverrideRemoval", "UnreachableBodies", @@ -173,16 +173,14 @@ namespace ILLink.Tasks /// It is an error to specify both BeforeStep and AfterStep. /// Maps to '--custom-step'. /// </summary> - public ITaskItem [] CustomSteps { get; set; } + public ITaskItem[] CustomSteps { get; set; } private readonly static string DotNetHostPathEnvironmentName = "DOTNET_HOST_PATH"; private string _dotnetPath; - private string DotNetPath - { - get - { + private string DotNetPath { + get { if (!String.IsNullOrEmpty (_dotnetPath)) return _dotnetPath; @@ -196,7 +194,7 @@ namespace ILLink.Tasks /// ToolTask implementation - + protected override MessageImportance StandardErrorLoggingImportance => MessageImportance.High; protected override string ToolName => Path.GetFileName (DotNetPath); @@ -220,7 +218,7 @@ namespace ILLink.Tasks private static string Quote (string path) { - return $"\"{path.TrimEnd('\\')}\""; + return $"\"{path.TrimEnd ('\\')}\""; } protected override string GenerateCommandLineCommands () @@ -341,9 +339,9 @@ namespace ILLink.Tasks foreach (var featureSetting in FeatureSettings) { var feature = featureSetting.ItemSpec; var featureValue = featureSetting.GetMetadata ("Value"); - if (String.IsNullOrEmpty(featureValue)) + if (String.IsNullOrEmpty (featureValue)) throw new ArgumentException ("feature settings require \"Value\" metadata"); - args.Append ("--feature ").Append (feature).Append(" ").AppendLine (featureValue); + args.Append ("--feature ").Append (feature).Append (" ").AppendLine (featureValue); } } diff --git a/src/ILLink.Tasks/SetAssemblyActions.cs b/src/ILLink.Tasks/SetAssemblyActions.cs index a63a059ed..b8316b23b 100644 --- a/src/ILLink.Tasks/SetAssemblyActions.cs +++ b/src/ILLink.Tasks/SetAssemblyActions.cs @@ -14,19 +14,19 @@ namespace ILLink.Tasks /// input to the linker. /// </summary> [Required] - public ITaskItem [] AssemblyPaths { get; set; } + public ITaskItem[] AssemblyPaths { get; set; } /// <summary> /// Application assembly names. /// </summary> [Required] - public ITaskItem [] ApplicationAssemblyNames { get; set; } + public ITaskItem[] ApplicationAssemblyNames { get; set; } /// <summary> /// Platform assembly names. /// </summary> [Required] - public ITaskItem [] PlatformAssemblyNames { get; set; } + public ITaskItem[] PlatformAssemblyNames { get; set; } /// <summary> /// Action to perform on used application assemblies. @@ -53,7 +53,7 @@ namespace ILLink.Tasks public ITaskItem UnusedPlatformAssemblyAction { get; set; } [Output] - public ITaskItem [] AssemblyPathsWithActions { get; set; } + public ITaskItem[] AssemblyPathsWithActions { get; set; } public override bool Execute () { @@ -117,7 +117,7 @@ namespace ILLink.Tasks return true; } - void AddAssemblyActionMetadata (ITaskItem [] assemblies, string action, List<ITaskItem> resultList) + void AddAssemblyActionMetadata (ITaskItem[] assemblies, string action, List<ITaskItem> resultList) { HashSet<string> assemblyHashSet = new HashSet<string> (); foreach (var assembly in assemblies) { diff --git a/src/ILLink.Tasks/Utils.cs b/src/ILLink.Tasks/Utils.cs index 966ef5003..bbaf45613 100644 --- a/src/ILLink.Tasks/Utils.cs +++ b/src/ILLink.Tasks/Utils.cs @@ -16,8 +16,8 @@ public static class Utils private static bool IsCPPCLIAssembly (ModuleDefinition module) { - return module.Types.Any(t => - t.Namespace == "<CppImplementationDetails>" || - t.Namespace == "<CrtImplementationDetails>"); + return module.Types.Any (t => + t.Namespace == "<CppImplementationDetails>" || + t.Namespace == "<CrtImplementationDetails>"); } } diff --git a/src/linker/Linker.Dataflow/AggregateFlowAnnotationSource.cs b/src/linker/Linker.Dataflow/AggregateFlowAnnotationSource.cs index 69769a3f4..24ceeff06 100644 --- a/src/linker/Linker.Dataflow/AggregateFlowAnnotationSource.cs +++ b/src/linker/Linker.Dataflow/AggregateFlowAnnotationSource.cs @@ -12,7 +12,7 @@ namespace Mono.Linker.Dataflow { private readonly List<IFlowAnnotationSource> _sources; - public AggregateFlowAnnotationSource(IEnumerable<IFlowAnnotationSource> sources) + public AggregateFlowAnnotationSource (IEnumerable<IFlowAnnotationSource> sources) { _sources = new List<IFlowAnnotationSource> (sources); } diff --git a/src/linker/Linker.Dataflow/AttributeFlowAnnotationSource.cs b/src/linker/Linker.Dataflow/AttributeFlowAnnotationSource.cs index 43ec07826..6ebfcd499 100644 --- a/src/linker/Linker.Dataflow/AttributeFlowAnnotationSource.cs +++ b/src/linker/Linker.Dataflow/AttributeFlowAnnotationSource.cs @@ -16,7 +16,7 @@ namespace Mono.Linker.Dataflow public DynamicallyAccessedMemberKinds GetParameterAnnotation (MethodDefinition method, int index) { - return Get (method.Parameters [index]); + return Get (method.Parameters[index]); } public DynamicallyAccessedMemberKinds GetPropertyAnnotation (PropertyDefinition property) @@ -46,7 +46,7 @@ namespace Mono.Linker.Dataflow Debug.Assert (IsDynamicallyAccessedMembersAttribute (attribute)); if (attribute.HasConstructorArguments) { - return (DynamicallyAccessedMemberKinds)(int)attribute.ConstructorArguments [0].Value; + return (DynamicallyAccessedMemberKinds) (int) attribute.ConstructorArguments[0].Value; } return 0; diff --git a/src/linker/Linker.Dataflow/FlowAnnotations.cs b/src/linker/Linker.Dataflow/FlowAnnotations.cs index 1d9275993..e51e5dad6 100644 --- a/src/linker/Linker.Dataflow/FlowAnnotations.cs +++ b/src/linker/Linker.Dataflow/FlowAnnotations.cs @@ -14,7 +14,7 @@ namespace Mono.Linker.Dataflow class FlowAnnotations { readonly IFlowAnnotationSource _source; - readonly Dictionary<TypeDefinition, TypeAnnotations> _annotations = new Dictionary<TypeDefinition, TypeAnnotations>(); + readonly Dictionary<TypeDefinition, TypeAnnotations> _annotations = new Dictionary<TypeDefinition, TypeAnnotations> (); public FlowAnnotations (IFlowAnnotationSource annotationSource) { @@ -39,7 +39,7 @@ namespace Mono.Linker.Dataflow public DynamicallyAccessedMemberKinds GetParameterAnnotation (MethodDefinition method, int parameterIndex) { if (GetAnnotations (method.DeclaringType).TryGetAnnotation (method, out var annotation) && annotation.ParameterAnnotations != null) { - return annotation.ParameterAnnotations [parameterIndex]; + return annotation.ParameterAnnotations[parameterIndex]; } return 0; @@ -63,9 +63,9 @@ namespace Mono.Linker.Dataflow return 0; } - private TypeAnnotations GetAnnotations(TypeDefinition type) + private TypeAnnotations GetAnnotations (TypeDefinition type) { - if (!_annotations.TryGetValue(type, out TypeAnnotations value)) { + if (!_annotations.TryGetValue (type, out TypeAnnotations value)) { value = BuildTypeAnnotations (type); _annotations.Add (type, value); } @@ -97,7 +97,7 @@ namespace Mono.Linker.Dataflow // Next go over all methods with an explicit annotation if (type.HasMethods) { foreach (MethodDefinition method in type.Methods) { - DynamicallyAccessedMemberKinds [] paramAnnotations = null; + DynamicallyAccessedMemberKinds[] paramAnnotations = null; // We convert indices from metadata space to IL space here. // IL space assigns index 0 to the `this` parameter on instance methods. @@ -107,17 +107,16 @@ namespace Mono.Linker.Dataflow if (IsTypeInterestingForDataflow (method.DeclaringType)) { DynamicallyAccessedMemberKinds ta = _source.GetThisParameterAnnotation (method); if (ta != 0) { - paramAnnotations = new DynamicallyAccessedMemberKinds [method.Parameters.Count + offset]; - paramAnnotations [0] = ta; + paramAnnotations = new DynamicallyAccessedMemberKinds[method.Parameters.Count + offset]; + paramAnnotations[0] = ta; } } - } - else { + } else { offset = 0; } - for (int i = 0; i < method.Parameters.Count; i++) { - if (!IsTypeInterestingForDataflow (method.Parameters [i].ParameterType)) { + for (int i = 0; i < method.Parameters.Count; i++) { + if (!IsTypeInterestingForDataflow (method.Parameters[i].ParameterType)) { continue; } @@ -127,12 +126,12 @@ namespace Mono.Linker.Dataflow } if (paramAnnotations == null) { - paramAnnotations = new DynamicallyAccessedMemberKinds [method.Parameters.Count + offset]; + paramAnnotations = new DynamicallyAccessedMemberKinds[method.Parameters.Count + offset]; } - paramAnnotations [i + offset] = pa; + paramAnnotations[i + offset] = pa; } - DynamicallyAccessedMemberKinds returnAnnotation = IsTypeInterestingForDataflow(method.ReturnType) ? + DynamicallyAccessedMemberKinds returnAnnotation = IsTypeInterestingForDataflow (method.ReturnType) ? _source.GetReturnParameterAnnotation (method) : 0; if (returnAnnotation != 0 || paramAnnotations != null) { annotatedMethods.Add (new MethodAnnotations (method, paramAnnotations, returnAnnotation)); @@ -156,7 +155,7 @@ namespace Mono.Linker.Dataflow if (type.HasProperties) { foreach (PropertyDefinition property in type.Properties) { - + if (!IsTypeInterestingForDataflow (property.PropertyType)) { continue; } @@ -182,8 +181,8 @@ namespace Mono.Linker.Dataflow } else { int offset = setMethod.HasImplicitThis () ? 1 : 0; if (setMethod.Parameters.Count > 0) { - DynamicallyAccessedMemberKinds [] paramAnnotations = new DynamicallyAccessedMemberKinds [setMethod.Parameters.Count + offset]; - paramAnnotations [offset] = annotation; + DynamicallyAccessedMemberKinds[] paramAnnotations = new DynamicallyAccessedMemberKinds[setMethod.Parameters.Count + offset]; + paramAnnotations[offset] = annotation; annotatedMethods.Add (new MethodAnnotations (setMethod, paramAnnotations, 0)); } } @@ -226,7 +225,7 @@ namespace Mono.Linker.Dataflow } } - return new TypeAnnotations (annotatedMethods.ToArray(), annotatedFields.ToArray()); + return new TypeAnnotations (annotatedMethods.ToArray (), annotatedFields.ToArray ()); } private bool ScanMethodBodyForFieldAccess (MethodBody body, bool write, out FieldDefinition found) @@ -239,20 +238,20 @@ namespace Mono.Linker.Dataflow foreach (Instruction instruction in body.Instructions) { switch (instruction.OpCode.Code) { - case Code.Ldsfld when !write: - case Code.Ldfld when !write: - case Code.Stsfld when write: - case Code.Stfld when write: - - if (foundReference != null) { - // This writes/reads multiple fields - can't guess which one is the backing store. - // Return failure. - found = null; - return false; - } + case Code.Ldsfld when !write: + case Code.Ldfld when !write: + case Code.Stsfld when write: + case Code.Stfld when write: + + if (foundReference != null) { + // This writes/reads multiple fields - can't guess which one is the backing store. + // Return failure. + found = null; + return false; + } - foundReference = (FieldReference)instruction.Operand; - break; + foundReference = (FieldReference) instruction.Operand; + break; } } @@ -273,7 +272,7 @@ namespace Mono.Linker.Dataflow if (found.DeclaringType != body.Method.DeclaringType || found.IsStatic != body.Method.IsStatic || - !found.IsCompilerGenerated()) { + !found.IsCompilerGenerated ()) { // A couple heuristics to make sure we got the right field. // Return failure. found = null; @@ -283,7 +282,7 @@ namespace Mono.Linker.Dataflow return true; } - private static bool IsTypeInterestingForDataflow(TypeReference typeReference) + private static bool IsTypeInterestingForDataflow (TypeReference typeReference) { // We will accept any System.Type* as interesting to enable testing // It's necessary to be able to implement a custom "Type" type in tests to validate @@ -295,13 +294,13 @@ namespace Mono.Linker.Dataflow readonly struct TypeAnnotations { - readonly MethodAnnotations [] _annotatedMethods; - readonly FieldAnnotation [] _annotatedFields; + readonly MethodAnnotations[] _annotatedMethods; + readonly FieldAnnotation[] _annotatedFields; - public TypeAnnotations (MethodAnnotations [] annotatedMethods, FieldAnnotation [] annotatedFields) + public TypeAnnotations (MethodAnnotations[] annotatedMethods, FieldAnnotation[] annotatedFields) => (_annotatedMethods, _annotatedFields) = (annotatedMethods, annotatedFields); - public bool TryGetAnnotation(MethodDefinition method, out MethodAnnotations annotations) + public bool TryGetAnnotation (MethodDefinition method, out MethodAnnotations annotations) { annotations = default; @@ -341,10 +340,10 @@ namespace Mono.Linker.Dataflow readonly struct MethodAnnotations { public readonly MethodDefinition Method; - public readonly DynamicallyAccessedMemberKinds [] ParameterAnnotations; + public readonly DynamicallyAccessedMemberKinds[] ParameterAnnotations; public readonly DynamicallyAccessedMemberKinds ReturnParameterAnnotation; - public MethodAnnotations (MethodDefinition method, DynamicallyAccessedMemberKinds [] paramAnnotations, DynamicallyAccessedMemberKinds returnParamAnnotations) + public MethodAnnotations (MethodDefinition method, DynamicallyAccessedMemberKinds[] paramAnnotations, DynamicallyAccessedMemberKinds returnParamAnnotations) => (Method, ParameterAnnotations, ReturnParameterAnnotation) = (method, paramAnnotations, returnParamAnnotations); } diff --git a/src/linker/Linker.Dataflow/JsonFlowAnnotationSource.cs b/src/linker/Linker.Dataflow/JsonFlowAnnotationSource.cs index d34be8464..69b1b68a0 100644 --- a/src/linker/Linker.Dataflow/JsonFlowAnnotationSource.cs +++ b/src/linker/Linker.Dataflow/JsonFlowAnnotationSource.cs @@ -15,11 +15,11 @@ namespace Mono.Linker.Dataflow /// </summary> class JsonFlowAnnotationSource : IFlowAnnotationSource { - readonly Dictionary<MethodDefinition, AnnotatedMethod> _methods = new Dictionary<MethodDefinition, AnnotatedMethod>(); - readonly Dictionary<PropertyDefinition, DynamicallyAccessedMemberKinds> _properties = new Dictionary<PropertyDefinition, DynamicallyAccessedMemberKinds>(); + readonly Dictionary<MethodDefinition, AnnotatedMethod> _methods = new Dictionary<MethodDefinition, AnnotatedMethod> (); + readonly Dictionary<PropertyDefinition, DynamicallyAccessedMemberKinds> _properties = new Dictionary<PropertyDefinition, DynamicallyAccessedMemberKinds> (); readonly Dictionary<FieldDefinition, DynamicallyAccessedMemberKinds> _fields = new Dictionary<FieldDefinition, DynamicallyAccessedMemberKinds> (); - public JsonFlowAnnotationSource(LinkContext context, string jsonFile) + public JsonFlowAnnotationSource (LinkContext context, string jsonFile) { Initialize (context, jsonFile); } @@ -31,8 +31,8 @@ namespace Mono.Linker.Dataflow public DynamicallyAccessedMemberKinds GetParameterAnnotation (MethodDefinition method, int index) { - if (_methods.TryGetValue(method, out var ann) && ann.ParameterAnnotations != null) { - string paramName = method.Parameters [index].Name; + if (_methods.TryGetValue (method, out var ann) && ann.ParameterAnnotations != null) { + string paramName = method.Parameters[index].Name; foreach (var (ParamName, Annotation) in ann.ParameterAnnotations) if (ParamName == paramName) @@ -64,21 +64,21 @@ namespace Mono.Linker.Dataflow return 0; } - static DynamicallyAccessedMemberKinds ParseKinds(JsonElement attributes) + static DynamicallyAccessedMemberKinds ParseKinds (JsonElement attributes) { foreach (var attribute in attributes.EnumerateObject ()) { if (attribute.Name == "System.Runtime.CompilerServices.DynamicallyAccessedMembers") { string value = attribute.Value.GetString (); - + // Enum.Parse accepts a comma as a separator for Flags - return (DynamicallyAccessedMemberKinds)Enum.Parse (typeof (DynamicallyAccessedMemberKinds), value); + return (DynamicallyAccessedMemberKinds) Enum.Parse (typeof (DynamicallyAccessedMemberKinds), value); } } return 0; } - private void Initialize(LinkContext context, string jsonFile) + private void Initialize (LinkContext context, string jsonFile) { // Need "using" because JsonDocument won't close this as part of Dispose(). using FileStream jsonFileStream = File.OpenRead (jsonFile); @@ -116,11 +116,11 @@ namespace Mono.Linker.Dataflow // Technically, '(' is a valid character in both method and field names, // but the existing PreserveDependencyAttribute parser has a limitation in supporting // that anyway, so we will use '(' to distinguish methods from fields/properties. - if (memberName.Contains("(")) { + if (memberName.Contains ("(")) { // This is a method // Parser uses same format as PreserveDependencyAttribute - string [] signature = null; + string[] signature = null; memberName = memberName.Replace (" ", ""); var sign_start = memberName.IndexOf ('('); var sign_end = memberName.LastIndexOf (')'); @@ -141,7 +141,7 @@ namespace Mono.Linker.Dataflow bool sigMatch = true; for (int i = 0; i < candidate.Parameters.Count; i++) { - if (candidate.Parameters [i].ParameterType.FullName != signature [i].ToCecilName ()) { + if (candidate.Parameters[i].ParameterType.FullName != signature[i].ToCecilName ()) { sigMatch = false; break; } @@ -176,7 +176,7 @@ namespace Mono.Linker.Dataflow } if (returnAnnotation != 0 || parameterAnnotations.Count > 0) - _methods [method] = new AnnotatedMethod (returnAnnotation, parameterAnnotations.ToArray ()); + _methods[method] = new AnnotatedMethod (returnAnnotation, parameterAnnotations.ToArray ()); } else { // This is a field or property FieldDefinition field = null; @@ -193,7 +193,7 @@ namespace Mono.Linker.Dataflow DynamicallyAccessedMemberKinds fieldAnnotation = ParseKinds (member.Value); if (fieldAnnotation != 0) - _fields [field] = fieldAnnotation; + _fields[field] = fieldAnnotation; continue; } @@ -211,7 +211,7 @@ namespace Mono.Linker.Dataflow DynamicallyAccessedMemberKinds propertyAnnotation = ParseKinds (member.Value); if (propertyAnnotation != 0) - _properties [property] = propertyAnnotation; + _properties[property] = propertyAnnotation; } if (field == null && property == null) { @@ -227,10 +227,10 @@ namespace Mono.Linker.Dataflow private struct AnnotatedMethod { public readonly DynamicallyAccessedMemberKinds ReturnAnnotation; - public readonly (string ParamName, DynamicallyAccessedMemberKinds Annotation) [] ParameterAnnotations; + public readonly (string ParamName, DynamicallyAccessedMemberKinds Annotation)[] ParameterAnnotations; public AnnotatedMethod (DynamicallyAccessedMemberKinds returnAnnotation, - (string ParamName, DynamicallyAccessedMemberKinds Annotation) [] paramAnnotations) + (string ParamName, DynamicallyAccessedMemberKinds Annotation)[] paramAnnotations) => (ReturnAnnotation, ParameterAnnotations) = (returnAnnotation, paramAnnotations); } } diff --git a/src/linker/Linker.Dataflow/MethodBodyScanner.cs b/src/linker/Linker.Dataflow/MethodBodyScanner.cs index ddced05c7..97933598d 100644 --- a/src/linker/Linker.Dataflow/MethodBodyScanner.cs +++ b/src/linker/Linker.Dataflow/MethodBodyScanner.cs @@ -126,7 +126,7 @@ namespace Mono.Linker.Dataflow } if (knownStacks.ContainsKey (newOffset)) { - knownStacks [newOffset] = MergeStack (knownStacks [newOffset], newStack, method, newOffset); + knownStacks[newOffset] = MergeStack (knownStacks[newOffset], newStack, method, newOffset); } else { knownStacks.Add (newOffset, new Stack<StackSlot> (newStack.Reverse ())); } @@ -192,7 +192,7 @@ namespace Mono.Linker.Dataflow // old value. newValue.Value = MergePointValue.MergeValues (existingValue.Value, valueToStore); } - valueCollection [collectionKey] = newValue; + valueCollection[collectionKey] = newValue; } public void Scan (MethodBody methodBody) @@ -215,9 +215,9 @@ namespace Mono.Linker.Dataflow if (knownStacks.ContainsKey (operation.Offset)) { if (currentStack == null) { // The stack copy constructor reverses the stack - currentStack = new Stack<StackSlot> (knownStacks [operation.Offset].Reverse ()); + currentStack = new Stack<StackSlot> (knownStacks[operation.Offset].Reverse ()); } else { - currentStack = MergeStack (currentStack, knownStacks [operation.Offset], methodBody, operation.Offset); + currentStack = MergeStack (currentStack, knownStacks[operation.Offset], methodBody, operation.Offset); } } @@ -226,364 +226,364 @@ namespace Mono.Linker.Dataflow } switch (operation.OpCode.Code) { - case Code.Add: - case Code.Add_Ovf: - case Code.Add_Ovf_Un: - case Code.And: - case Code.Div: - case Code.Div_Un: - case Code.Mul: - case Code.Mul_Ovf: - case Code.Mul_Ovf_Un: - case Code.Or: - case Code.Rem: - case Code.Rem_Un: - case Code.Sub: - case Code.Sub_Ovf: - case Code.Sub_Ovf_Un: - case Code.Xor: - case Code.Cgt: - case Code.Cgt_Un: - case Code.Clt: - case Code.Clt_Un: - case Code.Ldelem_I: - case Code.Ldelem_I1: - case Code.Ldelem_I2: - case Code.Ldelem_I4: - case Code.Ldelem_I8: - case Code.Ldelem_R4: - case Code.Ldelem_R8: - case Code.Ldelem_U1: - case Code.Ldelem_U2: - case Code.Ldelem_U4: - case Code.Shl: - case Code.Shr: - case Code.Shr_Un: - case Code.Ldelem_Any: - case Code.Ldelem_Ref: - case Code.Ldelema: - case Code.Ceq: - PopUnknown (currentStack, 2, methodBody, operation.Offset); - PushUnknown (currentStack); - break; - - case Code.Dup: - currentStack.Push (currentStack.Peek ()); - break; - - case Code.Ldnull: - currentStack.Push (new StackSlot (NullValue.Instance)); - break; - - - case Code.Ldc_I4_0: - case Code.Ldc_I4_1: - case Code.Ldc_I4_2: - case Code.Ldc_I4_3: - case Code.Ldc_I4_4: - case Code.Ldc_I4_5: - case Code.Ldc_I4_6: - case Code.Ldc_I4_7: - case Code.Ldc_I4_8: { - int value = operation.OpCode.Code - Code.Ldc_I4_0; - ConstIntValue civ = new ConstIntValue (value); - StackSlot slot = new StackSlot (civ); - currentStack.Push (slot); - } - break; + case Code.Add: + case Code.Add_Ovf: + case Code.Add_Ovf_Un: + case Code.And: + case Code.Div: + case Code.Div_Un: + case Code.Mul: + case Code.Mul_Ovf: + case Code.Mul_Ovf_Un: + case Code.Or: + case Code.Rem: + case Code.Rem_Un: + case Code.Sub: + case Code.Sub_Ovf: + case Code.Sub_Ovf_Un: + case Code.Xor: + case Code.Cgt: + case Code.Cgt_Un: + case Code.Clt: + case Code.Clt_Un: + case Code.Ldelem_I: + case Code.Ldelem_I1: + case Code.Ldelem_I2: + case Code.Ldelem_I4: + case Code.Ldelem_I8: + case Code.Ldelem_R4: + case Code.Ldelem_R8: + case Code.Ldelem_U1: + case Code.Ldelem_U2: + case Code.Ldelem_U4: + case Code.Shl: + case Code.Shr: + case Code.Shr_Un: + case Code.Ldelem_Any: + case Code.Ldelem_Ref: + case Code.Ldelema: + case Code.Ceq: + PopUnknown (currentStack, 2, methodBody, operation.Offset); + PushUnknown (currentStack); + break; + + case Code.Dup: + currentStack.Push (currentStack.Peek ()); + break; + + case Code.Ldnull: + currentStack.Push (new StackSlot (NullValue.Instance)); + break; + + + case Code.Ldc_I4_0: + case Code.Ldc_I4_1: + case Code.Ldc_I4_2: + case Code.Ldc_I4_3: + case Code.Ldc_I4_4: + case Code.Ldc_I4_5: + case Code.Ldc_I4_6: + case Code.Ldc_I4_7: + case Code.Ldc_I4_8: { + int value = operation.OpCode.Code - Code.Ldc_I4_0; + ConstIntValue civ = new ConstIntValue (value); + StackSlot slot = new StackSlot (civ); + currentStack.Push (slot); + } + break; - case Code.Ldc_I4_M1: { - ConstIntValue civ = new ConstIntValue (-1); - StackSlot slot = new StackSlot (civ); - currentStack.Push (slot); - } - break; + case Code.Ldc_I4_M1: { + ConstIntValue civ = new ConstIntValue (-1); + StackSlot slot = new StackSlot (civ); + currentStack.Push (slot); + } + break; - case Code.Ldc_I4: { - int value = (int)operation.Operand; - ConstIntValue civ = new ConstIntValue (value); - StackSlot slot = new StackSlot (civ); - currentStack.Push (slot); - } - break; + case Code.Ldc_I4: { + int value = (int) operation.Operand; + ConstIntValue civ = new ConstIntValue (value); + StackSlot slot = new StackSlot (civ); + currentStack.Push (slot); + } + break; - case Code.Ldc_I4_S: { - int value = (sbyte)operation.Operand; - ConstIntValue civ = new ConstIntValue (value); - StackSlot slot = new StackSlot (civ); - currentStack.Push (slot); + case Code.Ldc_I4_S: { + int value = (sbyte) operation.Operand; + ConstIntValue civ = new ConstIntValue (value); + StackSlot slot = new StackSlot (civ); + currentStack.Push (slot); + } + break; + + case Code.Arglist: + case Code.Ldftn: + case Code.Sizeof: + case Code.Ldc_I8: + case Code.Ldc_R4: + case Code.Ldc_R8: + PushUnknown (currentStack); + break; + + case Code.Ldarg: + case Code.Ldarg_0: + case Code.Ldarg_1: + case Code.Ldarg_2: + case Code.Ldarg_3: + case Code.Ldarg_S: + case Code.Ldarga: + case Code.Ldarga_S: + ScanLdarg (operation, currentStack, thisMethod, methodBody); + break; + + case Code.Ldloc: + case Code.Ldloc_0: + case Code.Ldloc_1: + case Code.Ldloc_2: + case Code.Ldloc_3: + case Code.Ldloc_S: + case Code.Ldloca: + case Code.Ldloca_S: + ScanLdloc (operation, currentStack, thisMethod, methodBody, locals); + break; + + case Code.Ldstr: { + StackSlot slot = new StackSlot (new KnownStringValue ((string) operation.Operand)); + currentStack.Push (slot); + } + break; + + case Code.Ldtoken: + ScanLdtoken (operation, currentStack, thisMethod, methodBody); + break; + + case Code.Ldind_I: + case Code.Ldind_I1: + case Code.Ldind_I2: + case Code.Ldind_I4: + case Code.Ldind_I8: + case Code.Ldind_R4: + case Code.Ldind_R8: + case Code.Ldind_U1: + case Code.Ldind_U2: + case Code.Ldind_U4: + case Code.Ldlen: + case Code.Ldvirtftn: + case Code.Localloc: + case Code.Refanytype: + case Code.Refanyval: + case Code.Conv_I1: + case Code.Conv_I2: + case Code.Conv_I4: + case Code.Conv_Ovf_I1: + case Code.Conv_Ovf_I1_Un: + case Code.Conv_Ovf_I2: + case Code.Conv_Ovf_I2_Un: + case Code.Conv_Ovf_I4: + case Code.Conv_Ovf_I4_Un: + case Code.Conv_Ovf_U: + case Code.Conv_Ovf_U_Un: + case Code.Conv_Ovf_U1: + case Code.Conv_Ovf_U1_Un: + case Code.Conv_Ovf_U2: + case Code.Conv_Ovf_U2_Un: + case Code.Conv_Ovf_U4: + case Code.Conv_Ovf_U4_Un: + case Code.Conv_U1: + case Code.Conv_U2: + case Code.Conv_U4: + case Code.Conv_I8: + case Code.Conv_Ovf_I8: + case Code.Conv_Ovf_I8_Un: + case Code.Conv_Ovf_U8: + case Code.Conv_Ovf_U8_Un: + case Code.Conv_U8: + case Code.Conv_I: + case Code.Conv_Ovf_I: + case Code.Conv_Ovf_I_Un: + case Code.Conv_U: + case Code.Conv_R_Un: + case Code.Conv_R4: + case Code.Conv_R8: + case Code.Ldind_Ref: + case Code.Ldobj: + case Code.Mkrefany: + case Code.Unbox: + case Code.Unbox_Any: + case Code.Box: + case Code.Neg: + case Code.Not: + PopUnknown (currentStack, 1, methodBody, operation.Offset); + PushUnknown (currentStack); + break; + + case Code.Isinst: + case Code.Castclass: + // We can consider a NOP because the value doesn't change. + // It might change to NULL, but for the purposes of dataflow analysis + // it doesn't hurt much. + break; + + case Code.Ldfld: + case Code.Ldsfld: + case Code.Ldflda: + case Code.Ldsflda: + ScanLdfld (operation, currentStack, thisMethod, methodBody); + break; + + case Code.Newarr: { + StackSlot count = PopUnknown (currentStack, 1, methodBody, operation.Offset); + currentStack.Push (new StackSlot (new ArrayValue (count.Value))); + } + break; + + case Code.Cpblk: + case Code.Initblk: + case Code.Stelem_I: + case Code.Stelem_I1: + case Code.Stelem_I2: + case Code.Stelem_I4: + case Code.Stelem_I8: + case Code.Stelem_R4: + case Code.Stelem_R8: + case Code.Stelem_Any: + case Code.Stelem_Ref: + PopUnknown (currentStack, 3, methodBody, operation.Offset); + break; + + case Code.Stfld: + case Code.Stsfld: + ScanStfld (operation, currentStack, thisMethod, methodBody); + break; + + case Code.Cpobj: + PopUnknown (currentStack, 2, methodBody, operation.Offset); + break; + + case Code.Stind_I: + case Code.Stind_I1: + case Code.Stind_I2: + case Code.Stind_I4: + case Code.Stind_I8: + case Code.Stind_R4: + case Code.Stind_R8: + case Code.Stind_Ref: + case Code.Stobj: + ScanIndirectStore (operation, currentStack, methodBody); + break; + + case Code.Initobj: + case Code.Pop: + PopUnknown (currentStack, 1, methodBody, operation.Offset); + break; + + case Code.Starg: + case Code.Starg_S: + ScanStarg (operation, currentStack, thisMethod, methodBody); + break; + + case Code.Stloc: + case Code.Stloc_S: + case Code.Stloc_0: + case Code.Stloc_1: + case Code.Stloc_2: + case Code.Stloc_3: + ScanStloc (operation, currentStack, methodBody, locals, curBasicBlock); + break; + + case Code.Constrained: + case Code.No: + case Code.Readonly: + case Code.Tail: + case Code.Unaligned: + case Code.Volatile: + break; + + case Code.Brfalse: + case Code.Brfalse_S: + case Code.Brtrue: + case Code.Brtrue_S: + PopUnknown (currentStack, 1, methodBody, operation.Offset); + NewKnownStack (knownStacks, ((Instruction) operation.Operand).Offset, currentStack, methodBody); + break; + + case Code.Calli: + // TODO: currently not emitted by any mainstream compilers but we should implement + break; + + case Code.Call: + case Code.Callvirt: + case Code.Newobj: + HandleCall (methodBody, operation, currentStack); + break; + + case Code.Jmp: + // Not generated by mainstream compilers + break; + + case Code.Br: + case Code.Br_S: + NewKnownStack (knownStacks, ((Instruction) operation.Operand).Offset, currentStack, methodBody); + ClearStack (ref currentStack); + break; + + case Code.Leave: + case Code.Leave_S: + ClearStack (ref currentStack); + NewKnownStack (knownStacks, ((Instruction) operation.Operand).Offset, new Stack<StackSlot> (methodBody.MaxStackSize), methodBody); + break; + + case Code.Endfilter: + case Code.Endfinally: + case Code.Rethrow: + case Code.Throw: + ClearStack (ref currentStack); + break; + + case Code.Ret: { + bool hasReturnValue = methodBody.Method.ReturnType.MetadataType != MetadataType.Void; + if (currentStack.Count != (hasReturnValue ? 1 : 0)) { + WarnAboutInvalidILInMethod (methodBody, operation.Offset); } - break; - - case Code.Arglist: - case Code.Ldftn: - case Code.Sizeof: - case Code.Ldc_I8: - case Code.Ldc_R4: - case Code.Ldc_R8: - PushUnknown (currentStack); - break; - - case Code.Ldarg: - case Code.Ldarg_0: - case Code.Ldarg_1: - case Code.Ldarg_2: - case Code.Ldarg_3: - case Code.Ldarg_S: - case Code.Ldarga: - case Code.Ldarga_S: - ScanLdarg (operation, currentStack, thisMethod, methodBody); - break; - - case Code.Ldloc: - case Code.Ldloc_0: - case Code.Ldloc_1: - case Code.Ldloc_2: - case Code.Ldloc_3: - case Code.Ldloc_S: - case Code.Ldloca: - case Code.Ldloca_S: - ScanLdloc (operation, currentStack, thisMethod, methodBody, locals); - break; - - case Code.Ldstr: { - StackSlot slot = new StackSlot (new KnownStringValue ((string)operation.Operand)); - currentStack.Push (slot); + if (hasReturnValue) { + StackSlot retValue = PopUnknown (currentStack, 1, methodBody, operation.Offset); + MethodReturnValue = MergePointValue.MergeValues (MethodReturnValue, retValue.Value); } + ClearStack (ref currentStack); break; + } - case Code.Ldtoken: - ScanLdtoken (operation, currentStack, thisMethod, methodBody); - break; - - case Code.Ldind_I: - case Code.Ldind_I1: - case Code.Ldind_I2: - case Code.Ldind_I4: - case Code.Ldind_I8: - case Code.Ldind_R4: - case Code.Ldind_R8: - case Code.Ldind_U1: - case Code.Ldind_U2: - case Code.Ldind_U4: - case Code.Ldlen: - case Code.Ldvirtftn: - case Code.Localloc: - case Code.Refanytype: - case Code.Refanyval: - case Code.Conv_I1: - case Code.Conv_I2: - case Code.Conv_I4: - case Code.Conv_Ovf_I1: - case Code.Conv_Ovf_I1_Un: - case Code.Conv_Ovf_I2: - case Code.Conv_Ovf_I2_Un: - case Code.Conv_Ovf_I4: - case Code.Conv_Ovf_I4_Un: - case Code.Conv_Ovf_U: - case Code.Conv_Ovf_U_Un: - case Code.Conv_Ovf_U1: - case Code.Conv_Ovf_U1_Un: - case Code.Conv_Ovf_U2: - case Code.Conv_Ovf_U2_Un: - case Code.Conv_Ovf_U4: - case Code.Conv_Ovf_U4_Un: - case Code.Conv_U1: - case Code.Conv_U2: - case Code.Conv_U4: - case Code.Conv_I8: - case Code.Conv_Ovf_I8: - case Code.Conv_Ovf_I8_Un: - case Code.Conv_Ovf_U8: - case Code.Conv_Ovf_U8_Un: - case Code.Conv_U8: - case Code.Conv_I: - case Code.Conv_Ovf_I: - case Code.Conv_Ovf_I_Un: - case Code.Conv_U: - case Code.Conv_R_Un: - case Code.Conv_R4: - case Code.Conv_R8: - case Code.Ldind_Ref: - case Code.Ldobj: - case Code.Mkrefany: - case Code.Unbox: - case Code.Unbox_Any: - case Code.Box: - case Code.Neg: - case Code.Not: + case Code.Switch: { PopUnknown (currentStack, 1, methodBody, operation.Offset); - PushUnknown (currentStack); - break; - - case Code.Isinst: - case Code.Castclass: - // We can consider a NOP because the value doesn't change. - // It might change to NULL, but for the purposes of dataflow analysis - // it doesn't hurt much. - break; - - case Code.Ldfld: - case Code.Ldsfld: - case Code.Ldflda: - case Code.Ldsflda: - ScanLdfld (operation, currentStack, thisMethod, methodBody); - break; - - case Code.Newarr: { - StackSlot count = PopUnknown (currentStack, 1, methodBody, operation.Offset); - currentStack.Push (new StackSlot (new ArrayValue (count.Value))); + Instruction[] targets = (Instruction[]) operation.Operand; + foreach (Instruction target in targets) { + NewKnownStack (knownStacks, target.Offset, currentStack, methodBody); } break; + } - case Code.Cpblk: - case Code.Initblk: - case Code.Stelem_I: - case Code.Stelem_I1: - case Code.Stelem_I2: - case Code.Stelem_I4: - case Code.Stelem_I8: - case Code.Stelem_R4: - case Code.Stelem_R8: - case Code.Stelem_Any: - case Code.Stelem_Ref: - PopUnknown (currentStack, 3, methodBody, operation.Offset); - break; - - case Code.Stfld: - case Code.Stsfld: - ScanStfld (operation, currentStack, thisMethod, methodBody); - break; - - case Code.Cpobj: - PopUnknown (currentStack, 2, methodBody, operation.Offset); - break; - - case Code.Stind_I: - case Code.Stind_I1: - case Code.Stind_I2: - case Code.Stind_I4: - case Code.Stind_I8: - case Code.Stind_R4: - case Code.Stind_R8: - case Code.Stind_Ref: - case Code.Stobj: - ScanIndirectStore (operation, currentStack, methodBody); - break; - - case Code.Initobj: - case Code.Pop: - PopUnknown (currentStack, 1, methodBody, operation.Offset); - break; - - case Code.Starg: - case Code.Starg_S: - ScanStarg (operation, currentStack, thisMethod, methodBody); - break; - - case Code.Stloc: - case Code.Stloc_S: - case Code.Stloc_0: - case Code.Stloc_1: - case Code.Stloc_2: - case Code.Stloc_3: - ScanStloc (operation, currentStack, methodBody, locals, curBasicBlock); - break; - - case Code.Constrained: - case Code.No: - case Code.Readonly: - case Code.Tail: - case Code.Unaligned: - case Code.Volatile: - break; - - case Code.Brfalse: - case Code.Brfalse_S: - case Code.Brtrue: - case Code.Brtrue_S: - PopUnknown (currentStack, 1, methodBody, operation.Offset); - NewKnownStack (knownStacks, ((Instruction)operation.Operand).Offset, currentStack, methodBody); - break; - - case Code.Calli: - // TODO: currently not emitted by any mainstream compilers but we should implement - break; - - case Code.Call: - case Code.Callvirt: - case Code.Newobj: - HandleCall (methodBody, operation, currentStack); - break; - - case Code.Jmp: - // Not generated by mainstream compilers - break; - - case Code.Br: - case Code.Br_S: - NewKnownStack (knownStacks, ((Instruction)operation.Operand).Offset, currentStack, methodBody); - ClearStack (ref currentStack); - break; - - case Code.Leave: - case Code.Leave_S: - ClearStack (ref currentStack); - NewKnownStack (knownStacks, ((Instruction)operation.Operand).Offset, new Stack<StackSlot> (methodBody.MaxStackSize), methodBody); - break; - - case Code.Endfilter: - case Code.Endfinally: - case Code.Rethrow: - case Code.Throw: - ClearStack (ref currentStack); - break; - - case Code.Ret: { - bool hasReturnValue = methodBody.Method.ReturnType.MetadataType != MetadataType.Void; - if (currentStack.Count != (hasReturnValue ? 1 : 0)) { - WarnAboutInvalidILInMethod (methodBody, operation.Offset); - } - if (hasReturnValue) { - StackSlot retValue = PopUnknown (currentStack, 1, methodBody, operation.Offset); - MethodReturnValue = MergePointValue.MergeValues (MethodReturnValue, retValue.Value); - } - ClearStack (ref currentStack); - break; - } - - case Code.Switch: { - PopUnknown (currentStack, 1, methodBody, operation.Offset); - Instruction [] targets = (Instruction [])operation.Operand; - foreach (Instruction target in targets) { - NewKnownStack (knownStacks, target.Offset, currentStack, methodBody); - } - break; - } - - case Code.Beq: - case Code.Beq_S: - case Code.Bne_Un: - case Code.Bne_Un_S: - case Code.Bge: - case Code.Bge_S: - case Code.Bge_Un: - case Code.Bge_Un_S: - case Code.Bgt: - case Code.Bgt_S: - case Code.Bgt_Un: - case Code.Bgt_Un_S: - case Code.Ble: - case Code.Ble_S: - case Code.Ble_Un: - case Code.Ble_Un_S: - case Code.Blt: - case Code.Blt_S: - case Code.Blt_Un: - case Code.Blt_Un_S: - PopUnknown (currentStack, 2, methodBody, operation.Offset); - NewKnownStack (knownStacks, ((Instruction)operation.Operand).Offset, currentStack, methodBody); - break; + case Code.Beq: + case Code.Beq_S: + case Code.Bne_Un: + case Code.Bne_Un_S: + case Code.Bge: + case Code.Bge_S: + case Code.Bge_Un: + case Code.Bge_Un_S: + case Code.Bgt: + case Code.Bgt_S: + case Code.Bgt_Un: + case Code.Bgt_Un_S: + case Code.Ble: + case Code.Ble_S: + case Code.Ble_Un: + case Code.Ble_Un_S: + case Code.Blt: + case Code.Blt_S: + case Code.Blt_Un: + case Code.Blt_Un_S: + PopUnknown (currentStack, 2, methodBody, operation.Offset); + NewKnownStack (knownStacks, ((Instruction) operation.Operand).Offset, currentStack, methodBody); + break; } } } @@ -623,28 +623,25 @@ namespace Mono.Linker.Dataflow if (thisMethod.HasImplicitThis ()) { if (paramNum == 0) { isByRef = thisMethod.DeclaringType.IsValueType; - } - else { - isByRef = thisMethod.Parameters [paramNum - 1].ParameterType.IsByRefOrPointer(); + } else { + isByRef = thisMethod.Parameters[paramNum - 1].ParameterType.IsByRefOrPointer (); } } else { - isByRef = thisMethod.Parameters [paramNum].ParameterType.IsByRefOrPointer(); + isByRef = thisMethod.Parameters[paramNum].ParameterType.IsByRefOrPointer (); } } else { - var paramDefinition = (ParameterDefinition)operation.Operand; - if (thisMethod.HasImplicitThis()) { + var paramDefinition = (ParameterDefinition) operation.Operand; + if (thisMethod.HasImplicitThis ()) { if (paramDefinition == methodBody.ThisParameter) { paramNum = 0; - } - else { + } else { paramNum = paramDefinition.Index + 1; } - } - else { + } else { paramNum = paramDefinition.Index; } - isByRef = paramDefinition.ParameterType.IsByRefOrPointer(); + isByRef = paramDefinition.ParameterType.IsByRefOrPointer (); } isByRef |= code == Code.Ldarga || code == Code.Ldarga_S; @@ -653,13 +650,13 @@ namespace Mono.Linker.Dataflow currentStack.Push (slot); } - private void ScanStarg( + private void ScanStarg ( Instruction operation, Stack<StackSlot> currentStack, MethodDefinition thisMethod, MethodBody methodBody) { - ParameterDefinition param = (ParameterDefinition)operation.Operand; + ParameterDefinition param = (ParameterDefinition) operation.Operand; var valueToStore = PopUnknown (currentStack, 1, methodBody, operation.Offset); HandleStoreParameter (thisMethod, param.Sequence, operation, valueToStore.Value); } @@ -678,7 +675,7 @@ namespace Mono.Linker.Dataflow } bool isByRef = operation.OpCode.Code == Code.Ldloca || operation.OpCode.Code == Code.Ldloca_S - || localDef.VariableType.IsByRefOrPointer(); + || localDef.VariableType.IsByRefOrPointer (); ValueBasicBlockPair localValue; locals.TryGetValue (localDef, out localValue); @@ -735,9 +732,9 @@ namespace Mono.Linker.Dataflow foreach (var uniqueDestination in destination.Value.UniqueValues ()) { if (uniqueDestination.Kind == ValueNodeKind.LoadField) { - HandleStoreField (methodBody.Method, ((LoadFieldValue)uniqueDestination).Field, operation, valueToStore.Value); + HandleStoreField (methodBody.Method, ((LoadFieldValue) uniqueDestination).Field, operation, valueToStore.Value); } else if (uniqueDestination.Kind == ValueNodeKind.MethodParameter) { - HandleStoreParameter (methodBody.Method, ((MethodParameterValue)uniqueDestination).ParameterIndex, operation, valueToStore.Value); + HandleStoreParameter (methodBody.Method, ((MethodParameterValue) uniqueDestination).ParameterIndex, operation, valueToStore.Value); } } @@ -795,11 +792,11 @@ namespace Mono.Linker.Dataflow { Code code = operation.OpCode.Code; if (code >= Code.Ldloc_0 && code <= Code.Ldloc_3) - return localVariables [code - Code.Ldloc_0]; + return localVariables[code - Code.Ldloc_0]; if (code >= Code.Stloc_0 && code <= Code.Stloc_3) - return localVariables [code - Code.Stloc_0]; + return localVariables[code - Code.Stloc_0]; - return (VariableDefinition)operation.Operand; + return (VariableDefinition) operation.Operand; } private ValueNodeList PopCallArguments ( @@ -835,7 +832,7 @@ namespace Mono.Linker.Dataflow Instruction operation, Stack<StackSlot> currentStack) { - MethodReference calledMethod = (MethodReference)operation.Operand; + MethodReference calledMethod = (MethodReference) operation.Operand; bool isNewObj = (operation.OpCode.Code == Code.Newobj); @@ -866,7 +863,7 @@ namespace Mono.Linker.Dataflow } if (methodReturnValue != null) - currentStack.Push (new StackSlot (methodReturnValue, calledMethod.ReturnType.IsByRefOrPointer())); + currentStack.Push (new StackSlot (methodReturnValue, calledMethod.ReturnType.IsByRefOrPointer ())); } public abstract bool HandleCall ( diff --git a/src/linker/Linker.Dataflow/ReflectionMethodBodyScanner.cs b/src/linker/Linker.Dataflow/ReflectionMethodBodyScanner.cs index 2d4848fa6..75d833fe5 100644 --- a/src/linker/Linker.Dataflow/ReflectionMethodBodyScanner.cs +++ b/src/linker/Linker.Dataflow/ReflectionMethodBodyScanner.cs @@ -65,7 +65,7 @@ namespace Mono.Linker.Dataflow for (int i = 0; i < method.Parameters.Count; i++) { var annotation = _flowAnnotations.GetParameterAnnotation (method, i + paramOffset); if (annotation != 0) { - ValueNode valueNode = GetValueNodeForCustomAttributeArgument (arguments [i]); + ValueNode valueNode = GetValueNodeForCustomAttributeArgument (arguments[i]); if (valueNode != null) { // TODO: There's no way to represent attribute dataflow in current ReflectionPatternContext (and the underlying IReflectionPatterRecorder) ReflectionPatternContext context = new ReflectionPatternContext (_context, method, method, 0); @@ -84,7 +84,7 @@ namespace Mono.Linker.Dataflow ValueNode valueNode = GetValueNodeForCustomAttributeArgument (value); if (valueNode != null) { // TODO: There's no way to represent store to a field given current ReflectionPatternContext (and the underlying IReflectionPatterRecorder) - var reflectionContext = new ReflectionPatternContext (_context, field.DeclaringType.Methods [0], field.DeclaringType.Methods [0], 0); + var reflectionContext = new ReflectionPatternContext (_context, field.DeclaringType.Methods[0], field.DeclaringType.Methods[0], 0); reflectionContext.AnalyzingPattern (); RequireDynamicallyAccessedMembers (ref reflectionContext, annotation, valueNode, field); } @@ -94,10 +94,10 @@ namespace Mono.Linker.Dataflow { ValueNode valueNode; if (argument.Type.Name == "Type") { - TypeDefinition referencedType = ((TypeReference)argument.Value).Resolve (); + TypeDefinition referencedType = ((TypeReference) argument.Value).Resolve (); valueNode = referencedType == null ? null : new SystemTypeValue (referencedType); } else if (argument.Type.MetadataType == MetadataType.String) { - valueNode = new KnownStringValue ((string)argument.Value); + valueNode = new KnownStringValue ((string) argument.Value); } else { // We shouldn't have gotten a non-null annotation for this from GetParameterAnnotation throw new InvalidOperationException (); @@ -147,7 +147,7 @@ namespace Mono.Linker.Dataflow // TODO: There's no way to represent store to a parameter given current ReflectionPatternContext (and the underlying IReflectionPatterRecorder) var reflectionContext = new ReflectionPatternContext (_context, method, method, operation.Offset); reflectionContext.AnalyzingPattern (); - RequireDynamicallyAccessedMembers (ref reflectionContext, requiredMemberKinds, valueToStore, method.Parameters [index - (method.HasImplicitThis () ? 1 : 0)]); + RequireDynamicallyAccessedMembers (ref reflectionContext, requiredMemberKinds, valueToStore, method.Parameters[index - (method.HasImplicitThis () ? 1 : 0)]); } } @@ -413,597 +413,597 @@ namespace Mono.Linker.Dataflow _flowAnnotations.GetReturnParameterAnnotation (calledMethodDefinition) : 0; switch (GetIntrinsicIdForMethod (calledMethodDefinition)) { - case IntrinsicId.IntrospectionExtensions_GetTypeInfo: { - // typeof(Foo).GetTypeInfo()... will be commonly present in code targeting - // the dead-end reflection refactoring. The call doesn't do anything and we - // don't want to lose the annotation. - methodReturnValue = methodParams [0]; - } - break; + case IntrinsicId.IntrospectionExtensions_GetTypeInfo: { + // typeof(Foo).GetTypeInfo()... will be commonly present in code targeting + // the dead-end reflection refactoring. The call doesn't do anything and we + // don't want to lose the annotation. + methodReturnValue = methodParams[0]; + } + break; - case IntrinsicId.Type_GetTypeFromHandle: { - // Infrastructure piece to support "typeof(Foo)" - if (methodParams [0] is RuntimeTypeHandleValue typeHandle) - methodReturnValue = new SystemTypeValue (typeHandle.TypeRepresented); - } - break; - - case IntrinsicId.Type_get_TypeHandle: { - foreach (var value in methodParams [0].UniqueValues()) { - if (value is SystemTypeValue typeValue) - methodReturnValue = MergePointValue.MergeValues (methodReturnValue, new RuntimeTypeHandleValue (typeValue.TypeRepresented)); - else if (value == NullValue.Instance) - methodReturnValue = MergePointValue.MergeValues (methodReturnValue, value); - else - methodReturnValue = MergePointValue.MergeValues (methodReturnValue, UnknownValue.Instance); - } + case IntrinsicId.Type_GetTypeFromHandle: { + // Infrastructure piece to support "typeof(Foo)" + if (methodParams[0] is RuntimeTypeHandleValue typeHandle) + methodReturnValue = new SystemTypeValue (typeHandle.TypeRepresented); + } + break; + + case IntrinsicId.Type_get_TypeHandle: { + foreach (var value in methodParams[0].UniqueValues ()) { + if (value is SystemTypeValue typeValue) + methodReturnValue = MergePointValue.MergeValues (methodReturnValue, new RuntimeTypeHandleValue (typeValue.TypeRepresented)); + else if (value == NullValue.Instance) + methodReturnValue = MergePointValue.MergeValues (methodReturnValue, value); + else + methodReturnValue = MergePointValue.MergeValues (methodReturnValue, UnknownValue.Instance); } - break; + } + break; - case IntrinsicId.Type_MakeGenericType: { - // Don't care about the actual arguments, but we don't want to lose track of the type - // in case this is e.g. Activator.CreateInstance(typeof(Foo<>).MakeGenericType(...)); - methodReturnValue = methodParams [0]; - } - break; + case IntrinsicId.Type_MakeGenericType: { + // Don't care about the actual arguments, but we don't want to lose track of the type + // in case this is e.g. Activator.CreateInstance(typeof(Foo<>).MakeGenericType(...)); + methodReturnValue = methodParams[0]; + } + break; + + // + // System.Reflection.RuntimeReflectionExtensions + // + // static GetRuntimeEvent (this Type type, string name) + // static GetRuntimeField (this Type type, string name) + // static GetRuntimeMethod (this Type type, string name, Type[] parameters) + // static GetRuntimeProperty (this Type type, string name) + // + case var getRuntimeMember when getRuntimeMember == IntrinsicId.RuntimeReflectionExtensions_GetRuntimeEvent + || getRuntimeMember == IntrinsicId.RuntimeReflectionExtensions_GetRuntimeField + || getRuntimeMember == IntrinsicId.RuntimeReflectionExtensions_GetRuntimeMethod + || getRuntimeMember == IntrinsicId.RuntimeReflectionExtensions_GetRuntimeProperty: { - // - // System.Reflection.RuntimeReflectionExtensions - // - // static GetRuntimeEvent (this Type type, string name) - // static GetRuntimeField (this Type type, string name) - // static GetRuntimeMethod (this Type type, string name, Type[] parameters) - // static GetRuntimeProperty (this Type type, string name) - // - case var getRuntimeMember when getRuntimeMember == IntrinsicId.RuntimeReflectionExtensions_GetRuntimeEvent - || getRuntimeMember == IntrinsicId.RuntimeReflectionExtensions_GetRuntimeField - || getRuntimeMember == IntrinsicId.RuntimeReflectionExtensions_GetRuntimeMethod - || getRuntimeMember == IntrinsicId.RuntimeReflectionExtensions_GetRuntimeProperty: { - - reflectionContext.AnalyzingPattern (); - DynamicallyAccessedMemberKinds? memberKind = null; - BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public; - - switch (getRuntimeMember) { - case IntrinsicId.RuntimeReflectionExtensions_GetRuntimeEvent: - memberKind = DynamicallyAccessedMemberKinds.PublicEvents; - break; - - case IntrinsicId.RuntimeReflectionExtensions_GetRuntimeField: - memberKind = DynamicallyAccessedMemberKinds.PublicFields; - break; - - case IntrinsicId.RuntimeReflectionExtensions_GetRuntimeMethod: - memberKind = DynamicallyAccessedMemberKinds.PublicMethods; - break; - - case IntrinsicId.RuntimeReflectionExtensions_GetRuntimeProperty: - memberKind = DynamicallyAccessedMemberKinds.PublicProperties; - break; - - default: - Debug.Fail ("Unsupported member type"); - reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{calledMethod.FullName}' inside '{callingMethodBody.Method.FullName}' is of unexpected member type."); - break; - } + reflectionContext.AnalyzingPattern (); + DynamicallyAccessedMemberKinds? memberKind = null; + BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public; + + switch (getRuntimeMember) { + case IntrinsicId.RuntimeReflectionExtensions_GetRuntimeEvent: + memberKind = DynamicallyAccessedMemberKinds.PublicEvents; + break; + + case IntrinsicId.RuntimeReflectionExtensions_GetRuntimeField: + memberKind = DynamicallyAccessedMemberKinds.PublicFields; + break; + + case IntrinsicId.RuntimeReflectionExtensions_GetRuntimeMethod: + memberKind = DynamicallyAccessedMemberKinds.PublicMethods; + break; + + case IntrinsicId.RuntimeReflectionExtensions_GetRuntimeProperty: + memberKind = DynamicallyAccessedMemberKinds.PublicProperties; + break; + + default: + Debug.Fail ("Unsupported member type"); + reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{calledMethod.FullName}' inside '{callingMethodBody.Method.FullName}' is of unexpected member type."); + break; + } - if (memberKind == null) - break; + if (memberKind == null) + break; - foreach (var value in methodParams [0].UniqueValues ()) { - if (value is SystemTypeValue systemTypeValue) { - foreach (var stringParam in methodParams [1].UniqueValues ()) { - if (stringParam is KnownStringValue stringValue) { - switch (memberKind) { - case DynamicallyAccessedMemberKinds.PublicEvents: - MarkEventsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, e => e.Name == stringValue.Contents, bindingFlags); - reflectionContext.RecordHandledPattern (); - break; - case DynamicallyAccessedMemberKinds.PublicFields: - MarkFieldsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, f => f.Name == stringValue.Contents, bindingFlags); - reflectionContext.RecordHandledPattern (); - break; - case DynamicallyAccessedMemberKinds.PublicMethods: - MarkMethodsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, m => m.Name == stringValue.Contents, bindingFlags); - reflectionContext.RecordHandledPattern (); - break; - case DynamicallyAccessedMemberKinds.PublicProperties: - MarkPropertiesOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, p => p.Name == stringValue.Contents, bindingFlags); - reflectionContext.RecordHandledPattern (); - break; - default: - throw new MarkException (string.Format ("Error processing reflection call: '{0}' inside {1}. Unexpected member kind.", calledMethod.FullName, callingMethodBody.Method.FullName)); - } - } else { - RequireDynamicallyAccessedMembers (ref reflectionContext, (DynamicallyAccessedMemberKinds)memberKind, value, calledMethod.Parameters [0]); + foreach (var value in methodParams[0].UniqueValues ()) { + if (value is SystemTypeValue systemTypeValue) { + foreach (var stringParam in methodParams[1].UniqueValues ()) { + if (stringParam is KnownStringValue stringValue) { + switch (memberKind) { + case DynamicallyAccessedMemberKinds.PublicEvents: + MarkEventsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, e => e.Name == stringValue.Contents, bindingFlags); + reflectionContext.RecordHandledPattern (); + break; + case DynamicallyAccessedMemberKinds.PublicFields: + MarkFieldsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, f => f.Name == stringValue.Contents, bindingFlags); + reflectionContext.RecordHandledPattern (); + break; + case DynamicallyAccessedMemberKinds.PublicMethods: + MarkMethodsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, m => m.Name == stringValue.Contents, bindingFlags); + reflectionContext.RecordHandledPattern (); + break; + case DynamicallyAccessedMemberKinds.PublicProperties: + MarkPropertiesOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, p => p.Name == stringValue.Contents, bindingFlags); + reflectionContext.RecordHandledPattern (); + break; + default: + throw new MarkException (string.Format ("Error processing reflection call: '{0}' inside {1}. Unexpected member kind.", calledMethod.FullName, callingMethodBody.Method.FullName)); } + } else { + RequireDynamicallyAccessedMembers (ref reflectionContext, (DynamicallyAccessedMemberKinds) memberKind, value, calledMethod.Parameters[0]); } - } else { - RequireDynamicallyAccessedMembers (ref reflectionContext, (DynamicallyAccessedMemberKinds)memberKind, value, calledMethod.Parameters [0]); } + } else { + RequireDynamicallyAccessedMembers (ref reflectionContext, (DynamicallyAccessedMemberKinds) memberKind, value, calledMethod.Parameters[0]); } } - break; - - // - // System.Linq.Expressions.Expression - // - // static Call (Type, String, Type[], Expression[]) - // - case IntrinsicId.Expression_Call: { - reflectionContext.AnalyzingPattern (); - BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy; - - foreach (var value in methodParams [0].UniqueValues ()) { - if (value is SystemTypeValue systemTypeValue) { - foreach (var stringParam in methodParams [1].UniqueValues ()) { - // TODO: Change this as needed after deciding whether or not we are to keep - // all methods on a type that was accessed via reflection. - if (stringParam is KnownStringValue stringValue) { - MarkMethodsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, m => m.Name == stringValue.Contents, bindingFlags); - reflectionContext.RecordHandledPattern (); - } else { - RequireDynamicallyAccessedMembers (ref reflectionContext, DynamicallyAccessedMemberKinds.Methods, value, calledMethod.Parameters [0]); - } + } + break; + + // + // System.Linq.Expressions.Expression + // + // static Call (Type, String, Type[], Expression[]) + // + case IntrinsicId.Expression_Call: { + reflectionContext.AnalyzingPattern (); + BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy; + + foreach (var value in methodParams[0].UniqueValues ()) { + if (value is SystemTypeValue systemTypeValue) { + foreach (var stringParam in methodParams[1].UniqueValues ()) { + // TODO: Change this as needed after deciding whether or not we are to keep + // all methods on a type that was accessed via reflection. + if (stringParam is KnownStringValue stringValue) { + MarkMethodsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, m => m.Name == stringValue.Contents, bindingFlags); + reflectionContext.RecordHandledPattern (); + } else { + RequireDynamicallyAccessedMembers (ref reflectionContext, DynamicallyAccessedMemberKinds.Methods, value, calledMethod.Parameters[0]); } - } else { - RequireDynamicallyAccessedMembers (ref reflectionContext, DynamicallyAccessedMemberKinds.Methods, value, calledMethod.Parameters [0]); } + } else { + RequireDynamicallyAccessedMembers (ref reflectionContext, DynamicallyAccessedMemberKinds.Methods, value, calledMethod.Parameters[0]); } } - break; - - // - // System.Linq.Expressions.Expression - // - // static Field (Expression, Type, String) - // static Property (Expression, Type, String) - // - case var fieldOrPropertyInstrinsic when fieldOrPropertyInstrinsic == IntrinsicId.Expression_Field || fieldOrPropertyInstrinsic == IntrinsicId.Expression_Property: { - reflectionContext.AnalyzingPattern (); - DynamicallyAccessedMemberKinds memberKind = fieldOrPropertyInstrinsic == IntrinsicId.Expression_Property ? DynamicallyAccessedMemberKinds.Properties : DynamicallyAccessedMemberKinds.Fields; - - foreach (var value in methodParams [1].UniqueValues ()) { - if (value is SystemTypeValue systemTypeValue) { - foreach (var stringParam in methodParams [2].UniqueValues ()) { - if (stringParam is KnownStringValue stringValue) { - BindingFlags bindingFlags = methodParams [0].Kind == ValueNodeKind.Null ? BindingFlags.Static : BindingFlags.Default; - // TODO: Change this as needed after deciding if we are to keep all fields/properties on a type - // that is accessed via reflection. For now, let's only keep the field/property that is retrieved. - if (memberKind is DynamicallyAccessedMemberKinds.Properties) { - MarkPropertiesOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, filter: p => p.Name == stringValue.Contents, bindingFlags); - } else { - MarkFieldsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, filter: f => f.Name == stringValue.Contents, bindingFlags); - } - - reflectionContext.RecordHandledPattern (); + } + break; + + // + // System.Linq.Expressions.Expression + // + // static Field (Expression, Type, String) + // static Property (Expression, Type, String) + // + case var fieldOrPropertyInstrinsic when fieldOrPropertyInstrinsic == IntrinsicId.Expression_Field || fieldOrPropertyInstrinsic == IntrinsicId.Expression_Property: { + reflectionContext.AnalyzingPattern (); + DynamicallyAccessedMemberKinds memberKind = fieldOrPropertyInstrinsic == IntrinsicId.Expression_Property ? DynamicallyAccessedMemberKinds.Properties : DynamicallyAccessedMemberKinds.Fields; + + foreach (var value in methodParams[1].UniqueValues ()) { + if (value is SystemTypeValue systemTypeValue) { + foreach (var stringParam in methodParams[2].UniqueValues ()) { + if (stringParam is KnownStringValue stringValue) { + BindingFlags bindingFlags = methodParams[0].Kind == ValueNodeKind.Null ? BindingFlags.Static : BindingFlags.Default; + // TODO: Change this as needed after deciding if we are to keep all fields/properties on a type + // that is accessed via reflection. For now, let's only keep the field/property that is retrieved. + if (memberKind is DynamicallyAccessedMemberKinds.Properties) { + MarkPropertiesOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, filter: p => p.Name == stringValue.Contents, bindingFlags); } else { - RequireDynamicallyAccessedMembers (ref reflectionContext, memberKind, value, calledMethod.Parameters [2]); + MarkFieldsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, filter: f => f.Name == stringValue.Contents, bindingFlags); } + + reflectionContext.RecordHandledPattern (); + } else { + RequireDynamicallyAccessedMembers (ref reflectionContext, memberKind, value, calledMethod.Parameters[2]); } - } else { - RequireDynamicallyAccessedMembers (ref reflectionContext, memberKind, value, calledMethod.Parameters [1]); } + } else { + RequireDynamicallyAccessedMembers (ref reflectionContext, memberKind, value, calledMethod.Parameters[1]); } } - break; - - // - // System.Linq.Expressions.Expression - // - // static New (Type) - // - case IntrinsicId.Expression_New: { - reflectionContext.AnalyzingPattern (); + } + break; + + // + // System.Linq.Expressions.Expression + // + // static New (Type) + // + case IntrinsicId.Expression_New: { + reflectionContext.AnalyzingPattern (); - foreach (var value in methodParams [0].UniqueValues ()) { - if (value is SystemTypeValue systemTypeValue) { - MarkConstructorsOnType (ref reflectionContext, systemTypeValue.TypeRepresented, null, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - reflectionContext.RecordHandledPattern (); - } else { - RequireDynamicallyAccessedMembers (ref reflectionContext, DynamicallyAccessedMemberKinds.DefaultConstructor, value, calledMethod.Parameters [0]); - } + foreach (var value in methodParams[0].UniqueValues ()) { + if (value is SystemTypeValue systemTypeValue) { + MarkConstructorsOnType (ref reflectionContext, systemTypeValue.TypeRepresented, null, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + reflectionContext.RecordHandledPattern (); + } else { + RequireDynamicallyAccessedMembers (ref reflectionContext, DynamicallyAccessedMemberKinds.DefaultConstructor, value, calledMethod.Parameters[0]); } } - break; + } + break; + + // + // System.Type + // + // GetType (string) + // GetType (string, Boolean) + // GetType (string, Boolean, Boolean) + // GetType (string, Func<AssemblyName, Assembly>, Func<Assembly, String, Boolean, Type>) + // GetType (string, Func<AssemblyName, Assembly>, Func<Assembly, String, Boolean, Type>, Boolean) + // GetType (string, Func<AssemblyName, Assembly>, Func<Assembly, String, Boolean, Type>, Boolean, Boolean) + // + case IntrinsicId.Type_GetType: { + reflectionContext.AnalyzingPattern (); - // - // System.Type - // - // GetType (string) - // GetType (string, Boolean) - // GetType (string, Boolean, Boolean) - // GetType (string, Func<AssemblyName, Assembly>, Func<Assembly, String, Boolean, Type>) - // GetType (string, Func<AssemblyName, Assembly>, Func<Assembly, String, Boolean, Type>, Boolean) - // GetType (string, Func<AssemblyName, Assembly>, Func<Assembly, String, Boolean, Type>, Boolean, Boolean) - // - case IntrinsicId.Type_GetType: { - reflectionContext.AnalyzingPattern (); - - foreach (var typeNameValue in methodParams [0].UniqueValues ()) { - if (typeNameValue is KnownStringValue knownStringValue) { - TypeDefinition foundType = AssemblyUtilities.ResolveFullyQualifiedTypeName (_context, knownStringValue.Contents); - if (foundType == null) { - // Intentionally ignore - it's not wrong for code to call Type.GetType on non-existing name, the code might expect null/exception back. - reflectionContext.RecordHandledPattern (); - } else { - var methodCalling = reflectionContext.MethodCalling; - reflectionContext.RecordRecognizedPattern (foundType, () => _markStep.MarkType (foundType, new DependencyInfo (DependencyKind.AccessedViaReflection, methodCalling))); - methodReturnValue = MergePointValue.MergeValues (methodReturnValue, new SystemTypeValue (foundType)); - } - } else if (typeNameValue == NullValue.Instance) { - reflectionContext.RecordHandledPattern (); - } else if (typeNameValue is LeafValueWithDynamicallyAccessedMemberNode valueWithDynamicallyAccessedMember && valueWithDynamicallyAccessedMember.DynamicallyAccessedMemberKinds != 0) { - // Propagate the annotation from the type name to the return value. Annotation on a string value will be fullfilled whenever a value is assigned to the string with annotation. - // So while we don't know which type it is, we can guarantee that it will fullfill the annotation. + foreach (var typeNameValue in methodParams[0].UniqueValues ()) { + if (typeNameValue is KnownStringValue knownStringValue) { + TypeDefinition foundType = AssemblyUtilities.ResolveFullyQualifiedTypeName (_context, knownStringValue.Contents); + if (foundType == null) { + // Intentionally ignore - it's not wrong for code to call Type.GetType on non-existing name, the code might expect null/exception back. reflectionContext.RecordHandledPattern (); - methodReturnValue = MergePointValue.MergeValues (methodReturnValue, new MethodReturnValue (valueWithDynamicallyAccessedMember.DynamicallyAccessedMemberKinds) { - SourceContext = calledMethod.Parameters [0] - }); } else { - reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{calledMethod.FullName}' inside '{reflectionContext.MethodCalling.FullName}' was detected with unknown value for the type name."); + var methodCalling = reflectionContext.MethodCalling; + reflectionContext.RecordRecognizedPattern (foundType, () => _markStep.MarkType (foundType, new DependencyInfo (DependencyKind.AccessedViaReflection, methodCalling))); + methodReturnValue = MergePointValue.MergeValues (methodReturnValue, new SystemTypeValue (foundType)); } + } else if (typeNameValue == NullValue.Instance) { + reflectionContext.RecordHandledPattern (); + } else if (typeNameValue is LeafValueWithDynamicallyAccessedMemberNode valueWithDynamicallyAccessedMember && valueWithDynamicallyAccessedMember.DynamicallyAccessedMemberKinds != 0) { + // Propagate the annotation from the type name to the return value. Annotation on a string value will be fullfilled whenever a value is assigned to the string with annotation. + // So while we don't know which type it is, we can guarantee that it will fullfill the annotation. + reflectionContext.RecordHandledPattern (); + methodReturnValue = MergePointValue.MergeValues (methodReturnValue, new MethodReturnValue (valueWithDynamicallyAccessedMember.DynamicallyAccessedMemberKinds) { + SourceContext = calledMethod.Parameters[0] + }); + } else { + reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{calledMethod.FullName}' inside '{reflectionContext.MethodCalling.FullName}' was detected with unknown value for the type name."); } - } - break; - // - // GetConstructor (Type[]) - // GetConstructor (BindingFlags, Binder, Type[], ParameterModifier []) - // GetConstructor (BindingFlags, Binder, CallingConventions, Type[], ParameterModifier []) - // - case IntrinsicId.Type_GetConstructor: { - reflectionContext.AnalyzingPattern (); - - var parameters = calledMethod.Parameters; - BindingFlags bindingFlags = BindingFlags.Default; - if (parameters.Count > 1) { - if (methodParams [1].AsConstInt () != null) - bindingFlags |= (BindingFlags)methodParams [1].AsConstInt (); - } - // Go over all types we've seen - foreach (var value in methodParams [0].UniqueValues ()) { - if (value is SystemTypeValue systemTypeValue) { - MarkConstructorsOnType (ref reflectionContext, systemTypeValue.TypeRepresented, (Func<MethodDefinition, bool>)null, bindingFlags); - reflectionContext.RecordHandledPattern (); - } else { - // Otherwise fall back to the bitfield requirements - var requiredMemberKinds = ((bindingFlags & BindingFlags.NonPublic) == 0) - ? DynamicallyAccessedMemberKinds.PublicConstructors - : DynamicallyAccessedMemberKinds.Constructors; - RequireDynamicallyAccessedMembers (ref reflectionContext, requiredMemberKinds, value, calledMethod.Parameters [0]); - } + } + break; + + // + // GetConstructor (Type[]) + // GetConstructor (BindingFlags, Binder, Type[], ParameterModifier []) + // GetConstructor (BindingFlags, Binder, CallingConventions, Type[], ParameterModifier []) + // + case IntrinsicId.Type_GetConstructor: { + reflectionContext.AnalyzingPattern (); + + var parameters = calledMethod.Parameters; + BindingFlags bindingFlags = BindingFlags.Default; + if (parameters.Count > 1) { + if (methodParams[1].AsConstInt () != null) + bindingFlags |= (BindingFlags) methodParams[1].AsConstInt (); + } + // Go over all types we've seen + foreach (var value in methodParams[0].UniqueValues ()) { + if (value is SystemTypeValue systemTypeValue) { + MarkConstructorsOnType (ref reflectionContext, systemTypeValue.TypeRepresented, (Func<MethodDefinition, bool>) null, bindingFlags); + reflectionContext.RecordHandledPattern (); + } else { + // Otherwise fall back to the bitfield requirements + var requiredMemberKinds = ((bindingFlags & BindingFlags.NonPublic) == 0) + ? DynamicallyAccessedMemberKinds.PublicConstructors + : DynamicallyAccessedMemberKinds.Constructors; + RequireDynamicallyAccessedMembers (ref reflectionContext, requiredMemberKinds, value, calledMethod.Parameters[0]); } } - break; + } + break; + + // + // GetMethod (string) + // GetMethod (string, BindingFlags) + // GetMethod (string, Type[]) + // GetMethod (string, Type[], ParameterModifier[]) + // GetMethod (string, BindingFlags, Binder, Type[], ParameterModifier[]) 6 + // GetMethod (string, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 7 + // GetMethod (string, int, Type[]) + // GetMethod (string, int, Type[], ParameterModifier[]?) + // GetMethod (string, int, BindingFlags, Binder?, Type[], ParameterModifier[]?) + // GetMethod (string, int, BindingFlags, Binder?, CallingConventions, Type[], ParameterModifier[]?) + // + case IntrinsicId.Type_GetMethod: { + reflectionContext.AnalyzingPattern (); - // - // GetMethod (string) - // GetMethod (string, BindingFlags) - // GetMethod (string, Type[]) - // GetMethod (string, Type[], ParameterModifier[]) - // GetMethod (string, BindingFlags, Binder, Type[], ParameterModifier[]) 6 - // GetMethod (string, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 7 - // GetMethod (string, int, Type[]) - // GetMethod (string, int, Type[], ParameterModifier[]?) - // GetMethod (string, int, BindingFlags, Binder?, Type[], ParameterModifier[]?) - // GetMethod (string, int, BindingFlags, Binder?, CallingConventions, Type[], ParameterModifier[]?) - // - case IntrinsicId.Type_GetMethod: { - reflectionContext.AnalyzingPattern (); - - BindingFlags bindingFlags = BindingFlags.Default; - if (calledMethod.Parameters.Count > 1 && calledMethod.Parameters [1].ParameterType.Name == "BindingFlags" && methodParams [2].AsConstInt () != null) { - bindingFlags |= (BindingFlags)methodParams [2].AsConstInt (); - } else if (calledMethod.Parameters.Count > 2 && calledMethod.Parameters [2].ParameterType.Name == "BindingFlags" && methodParams [3].AsConstInt () != null) { - bindingFlags |= (BindingFlags)methodParams [3].AsConstInt (); - } + BindingFlags bindingFlags = BindingFlags.Default; + if (calledMethod.Parameters.Count > 1 && calledMethod.Parameters[1].ParameterType.Name == "BindingFlags" && methodParams[2].AsConstInt () != null) { + bindingFlags |= (BindingFlags) methodParams[2].AsConstInt (); + } else if (calledMethod.Parameters.Count > 2 && calledMethod.Parameters[2].ParameterType.Name == "BindingFlags" && methodParams[3].AsConstInt () != null) { + bindingFlags |= (BindingFlags) methodParams[3].AsConstInt (); + } - foreach (var value in methodParams [0].UniqueValues ()) { - if (value is SystemTypeValue systemTypeValue) { - foreach (var stringParam in methodParams [1].UniqueValues ()) { - if (stringParam is KnownStringValue stringValue) { - MarkMethodsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, m => m.Name == stringValue.Contents, bindingFlags); - reflectionContext.RecordHandledPattern (); - } else { - // Otherwise fall back to the bitfield requirements - var requiredMemberKinds = ((bindingFlags & BindingFlags.NonPublic) == 0) - ? DynamicallyAccessedMemberKinds.PublicMethods - : DynamicallyAccessedMemberKinds.Methods; - RequireDynamicallyAccessedMembers (ref reflectionContext, requiredMemberKinds, value, calledMethod.Parameters [0]); - } + foreach (var value in methodParams[0].UniqueValues ()) { + if (value is SystemTypeValue systemTypeValue) { + foreach (var stringParam in methodParams[1].UniqueValues ()) { + if (stringParam is KnownStringValue stringValue) { + MarkMethodsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, m => m.Name == stringValue.Contents, bindingFlags); + reflectionContext.RecordHandledPattern (); + } else { + // Otherwise fall back to the bitfield requirements + var requiredMemberKinds = ((bindingFlags & BindingFlags.NonPublic) == 0) + ? DynamicallyAccessedMemberKinds.PublicMethods + : DynamicallyAccessedMemberKinds.Methods; + RequireDynamicallyAccessedMembers (ref reflectionContext, requiredMemberKinds, value, calledMethod.Parameters[0]); } - } else { - // Otherwise fall back to the bitfield requirements - var requiredMemberKinds = ((bindingFlags & BindingFlags.NonPublic) == 0) - ? DynamicallyAccessedMemberKinds.PublicMethods - : DynamicallyAccessedMemberKinds.Methods; - RequireDynamicallyAccessedMembers (ref reflectionContext, requiredMemberKinds, value, calledMethod.Parameters [0]); } + } else { + // Otherwise fall back to the bitfield requirements + var requiredMemberKinds = ((bindingFlags & BindingFlags.NonPublic) == 0) + ? DynamicallyAccessedMemberKinds.PublicMethods + : DynamicallyAccessedMemberKinds.Methods; + RequireDynamicallyAccessedMembers (ref reflectionContext, requiredMemberKinds, value, calledMethod.Parameters[0]); } } - break; + } + break; + + // + // GetField (string) + // GetField (string, BindingFlags) + // GetEvent (string) + // GetEvent (string, BindingFlags) + // GetProperty (string) + // GetProperty (string, BindingFlags) + // GetProperty (string, Type) + // GetProperty (string, Type[]) + // GetProperty (string, Type, Type[]) + // GetProperty (string, Type, Type[], ParameterModifier[]) + // GetProperty (string, BindingFlags, Binder, Type, Type[], ParameterModifier[]) + // + case var fieldPropertyOrEvent when ((fieldPropertyOrEvent == IntrinsicId.Type_GetField || fieldPropertyOrEvent == IntrinsicId.Type_GetProperty || fieldPropertyOrEvent == IntrinsicId.Type_GetEvent) + && calledMethod.DeclaringType.Namespace == "System" + && calledMethod.DeclaringType.Name == "Type" + && calledMethod.Parameters[0].ParameterType.FullName == "System.String") + && calledMethod.HasThis: { - // - // GetField (string) - // GetField (string, BindingFlags) - // GetEvent (string) - // GetEvent (string, BindingFlags) - // GetProperty (string) - // GetProperty (string, BindingFlags) - // GetProperty (string, Type) - // GetProperty (string, Type[]) - // GetProperty (string, Type, Type[]) - // GetProperty (string, Type, Type[], ParameterModifier[]) - // GetProperty (string, BindingFlags, Binder, Type, Type[], ParameterModifier[]) - // - case var fieldPropertyOrEvent when ((fieldPropertyOrEvent == IntrinsicId.Type_GetField || fieldPropertyOrEvent == IntrinsicId.Type_GetProperty || fieldPropertyOrEvent == IntrinsicId.Type_GetEvent) - && calledMethod.DeclaringType.Namespace == "System" - && calledMethod.DeclaringType.Name == "Type" - && calledMethod.Parameters [0].ParameterType.FullName == "System.String") - && calledMethod.HasThis: { - - reflectionContext.AnalyzingPattern (); - DynamicallyAccessedMemberKinds memberKind = fieldPropertyOrEvent switch - { - IntrinsicId.Type_GetEvent => DynamicallyAccessedMemberKinds.Events, - IntrinsicId.Type_GetField => DynamicallyAccessedMemberKinds.Fields, - IntrinsicId.Type_GetProperty => DynamicallyAccessedMemberKinds.Properties, - _ => throw new ArgumentException ($"Reflection call '{calledMethod.FullName}' inside '{callingMethodBody.Method.FullName}' is of unexpected member type."), - }; - - BindingFlags bindingFlags = BindingFlags.Default; - if (calledMethod.Parameters.Count > 1 && calledMethod.Parameters [1].ParameterType.Name == "BindingFlags" && methodParams [2].AsConstInt () != null) { - bindingFlags |= (BindingFlags)methodParams [2].AsConstInt (); - } + reflectionContext.AnalyzingPattern (); + DynamicallyAccessedMemberKinds memberKind = fieldPropertyOrEvent switch + { + IntrinsicId.Type_GetEvent => DynamicallyAccessedMemberKinds.Events, + IntrinsicId.Type_GetField => DynamicallyAccessedMemberKinds.Fields, + IntrinsicId.Type_GetProperty => DynamicallyAccessedMemberKinds.Properties, + _ => throw new ArgumentException ($"Reflection call '{calledMethod.FullName}' inside '{callingMethodBody.Method.FullName}' is of unexpected member type."), + }; + + BindingFlags bindingFlags = BindingFlags.Default; + if (calledMethod.Parameters.Count > 1 && calledMethod.Parameters[1].ParameterType.Name == "BindingFlags" && methodParams[2].AsConstInt () != null) { + bindingFlags |= (BindingFlags) methodParams[2].AsConstInt (); + } - foreach (var value in methodParams [0].UniqueValues ()) { - if (value is SystemTypeValue systemTypeValue) { - foreach (var stringParam in methodParams [1].UniqueValues ()) { - if (stringParam is KnownStringValue stringValue) { - switch (memberKind) { - case DynamicallyAccessedMemberKinds.Events: - MarkEventsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, filter: e => e.Name == stringValue.Contents, bindingFlags); - break; - case DynamicallyAccessedMemberKinds.Fields: - MarkFieldsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, filter: f => f.Name == stringValue.Contents, bindingFlags); - break; - case DynamicallyAccessedMemberKinds.Properties: - MarkPropertiesOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, filter: p => p.Name == stringValue.Contents, bindingFlags); - break; - default: - Debug.Fail ("Unreachable."); - break; - } - reflectionContext.RecordHandledPattern (); - } else { - RequireDynamicallyAccessedMembers (ref reflectionContext, memberKind, value, calledMethod.Parameters [0]); + foreach (var value in methodParams[0].UniqueValues ()) { + if (value is SystemTypeValue systemTypeValue) { + foreach (var stringParam in methodParams[1].UniqueValues ()) { + if (stringParam is KnownStringValue stringValue) { + switch (memberKind) { + case DynamicallyAccessedMemberKinds.Events: + MarkEventsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, filter: e => e.Name == stringValue.Contents, bindingFlags); + break; + case DynamicallyAccessedMemberKinds.Fields: + MarkFieldsOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, filter: f => f.Name == stringValue.Contents, bindingFlags); + break; + case DynamicallyAccessedMemberKinds.Properties: + MarkPropertiesOnTypeHierarchy (ref reflectionContext, systemTypeValue.TypeRepresented, filter: p => p.Name == stringValue.Contents, bindingFlags); + break; + default: + Debug.Fail ("Unreachable."); + break; } + reflectionContext.RecordHandledPattern (); + } else { + RequireDynamicallyAccessedMembers (ref reflectionContext, memberKind, value, calledMethod.Parameters[0]); } - } else { - RequireDynamicallyAccessedMembers (ref reflectionContext, memberKind, value, calledMethod.Parameters [0]); } + } else { + RequireDynamicallyAccessedMembers (ref reflectionContext, memberKind, value, calledMethod.Parameters[0]); } } - break; + } + break; + + // + // System.Activator + // + // static CreateInstance (System.Type type) + // static CreateInstance (System.Type type, bool nonPublic) + // static CreateInstance (System.Type type, params object?[]? args) + // static CreateInstance (System.Type type, object?[]? args, object?[]? activationAttributes) + // static CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture) + // static CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; } + // + case IntrinsicId.Activator_CreateInstance_Type: { + var parameters = calledMethod.Parameters; - // - // System.Activator - // - // static CreateInstance (System.Type type) - // static CreateInstance (System.Type type, bool nonPublic) - // static CreateInstance (System.Type type, params object?[]? args) - // static CreateInstance (System.Type type, object?[]? args, object?[]? activationAttributes) - // static CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture) - // static CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; } - // - case IntrinsicId.Activator_CreateInstance_Type: { - var parameters = calledMethod.Parameters; - - reflectionContext.AnalyzingPattern (); - - int? ctorParameterCount = null; - BindingFlags bindingFlags = BindingFlags.Instance; - if (parameters.Count > 1) { - if (parameters [1].ParameterType.MetadataType == MetadataType.Boolean) { - // The overload that takes a "nonPublic" bool - bool nonPublic = true; - if (methodParams [1] is ConstIntValue constInt) { - nonPublic = constInt.Value != 0; - } + reflectionContext.AnalyzingPattern (); - if (nonPublic) - bindingFlags |= BindingFlags.NonPublic | BindingFlags.Public; - else - bindingFlags |= BindingFlags.Public; - ctorParameterCount = 0; - } else { - // Overload that has the parameters as the second or fourth argument - int argsParam = parameters.Count == 2 || parameters.Count == 3 ? 1 : 3; + int? ctorParameterCount = null; + BindingFlags bindingFlags = BindingFlags.Instance; + if (parameters.Count > 1) { + if (parameters[1].ParameterType.MetadataType == MetadataType.Boolean) { + // The overload that takes a "nonPublic" bool + bool nonPublic = true; + if (methodParams[1] is ConstIntValue constInt) { + nonPublic = constInt.Value != 0; + } - if (methodParams.Count > argsParam && - methodParams [argsParam] is ArrayValue arrayValue && - arrayValue.Size.AsConstInt () != null) { - ctorParameterCount = arrayValue.Size.AsConstInt (); - } + if (nonPublic) + bindingFlags |= BindingFlags.NonPublic | BindingFlags.Public; + else + bindingFlags |= BindingFlags.Public; + ctorParameterCount = 0; + } else { + // Overload that has the parameters as the second or fourth argument + int argsParam = parameters.Count == 2 || parameters.Count == 3 ? 1 : 3; - if (parameters.Count > 3) { - if (methodParams [1].AsConstInt () != null) - bindingFlags |= (BindingFlags)methodParams [1].AsConstInt (); - else - bindingFlags |= BindingFlags.NonPublic | BindingFlags.Public; - } else { - bindingFlags |= BindingFlags.Public; - } + if (methodParams.Count > argsParam && + methodParams[argsParam] is ArrayValue arrayValue && + arrayValue.Size.AsConstInt () != null) { + ctorParameterCount = arrayValue.Size.AsConstInt (); } - } else { - // The overload with a single System.Type argument - ctorParameterCount = 0; - bindingFlags |= BindingFlags.Public; - } - // Go over all types we've seen - foreach (var value in methodParams [0].UniqueValues ()) { - if (value is SystemTypeValue systemTypeValue) { - // Special case known type values as we can do better by applying exact binding flags and parameter count. - MarkConstructorsOnType (ref reflectionContext, systemTypeValue.TypeRepresented, - ctorParameterCount == null ? (Func<MethodDefinition, bool>)null : m => m.Parameters.Count == ctorParameterCount, bindingFlags); - reflectionContext.RecordHandledPattern (); + if (parameters.Count > 3) { + if (methodParams[1].AsConstInt () != null) + bindingFlags |= (BindingFlags) methodParams[1].AsConstInt (); + else + bindingFlags |= BindingFlags.NonPublic | BindingFlags.Public; } else { - // Otherwise fall back to the bitfield requirements - var requiredMemberKinds = ctorParameterCount == 0 - ? DynamicallyAccessedMemberKinds.DefaultConstructor - : ((bindingFlags & BindingFlags.NonPublic) == 0) - ? DynamicallyAccessedMemberKinds.PublicConstructors - : DynamicallyAccessedMemberKinds.Constructors; - RequireDynamicallyAccessedMembers (ref reflectionContext, requiredMemberKinds, value, calledMethod.Parameters [0]); + bindingFlags |= BindingFlags.Public; } } + } else { + // The overload with a single System.Type argument + ctorParameterCount = 0; + bindingFlags |= BindingFlags.Public; } - break; - - // - // System.Activator - // - // static CreateInstance (string assemblyName, string typeName) - // static CreateInstance (string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) - // static CreateInstance (string assemblyName, string typeName, object?[]? activationAttributes) - // - case IntrinsicId.Activator_CreateInstance_AssemblyName_TypeName: - ProcessCreateInstanceByName (ref reflectionContext, calledMethodDefinition, methodParams); - break; - // - // System.Activator - // - // static CreateInstanceFrom (string assemblyFile, string typeName) - // static CreateInstanceFrom (string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) - // static CreateInstanceFrom (string assemblyFile, string typeName, object? []? activationAttributes) - // - case IntrinsicId.Activator_CreateInstanceFrom: - ProcessCreateInstanceByName (ref reflectionContext, calledMethodDefinition, methodParams); - break; - - // - // System.Activator - // - // static T CreateInstance<T> () - // - case IntrinsicId.Activator_CreateInstanceOfT: { - reflectionContext.AnalyzingPattern (); - - if (calledMethod is GenericInstanceMethod genericCalledMethod && genericCalledMethod.GenericArguments.Count == 1 - && genericCalledMethod.GenericArguments [0] is GenericParameter genericParameter) { - if (genericParameter.HasDefaultConstructorConstraint) { - // This is safe, the linker would have marked the default .ctor already - reflectionContext.RecordHandledPattern (); - break; - } + // Go over all types we've seen + foreach (var value in methodParams[0].UniqueValues ()) { + if (value is SystemTypeValue systemTypeValue) { + // Special case known type values as we can do better by applying exact binding flags and parameter count. + MarkConstructorsOnType (ref reflectionContext, systemTypeValue.TypeRepresented, + ctorParameterCount == null ? (Func<MethodDefinition, bool>) null : m => m.Parameters.Count == ctorParameterCount, bindingFlags); + reflectionContext.RecordHandledPattern (); + } else { + // Otherwise fall back to the bitfield requirements + var requiredMemberKinds = ctorParameterCount == 0 + ? DynamicallyAccessedMemberKinds.DefaultConstructor + : ((bindingFlags & BindingFlags.NonPublic) == 0) + ? DynamicallyAccessedMemberKinds.PublicConstructors + : DynamicallyAccessedMemberKinds.Constructors; + RequireDynamicallyAccessedMembers (ref reflectionContext, requiredMemberKinds, value, calledMethod.Parameters[0]); } + } + } + break; + + // + // System.Activator + // + // static CreateInstance (string assemblyName, string typeName) + // static CreateInstance (string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) + // static CreateInstance (string assemblyName, string typeName, object?[]? activationAttributes) + // + case IntrinsicId.Activator_CreateInstance_AssemblyName_TypeName: + ProcessCreateInstanceByName (ref reflectionContext, calledMethodDefinition, methodParams); + break; + + // + // System.Activator + // + // static CreateInstanceFrom (string assemblyFile, string typeName) + // static CreateInstanceFrom (string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) + // static CreateInstanceFrom (string assemblyFile, string typeName, object? []? activationAttributes) + // + case IntrinsicId.Activator_CreateInstanceFrom: + ProcessCreateInstanceByName (ref reflectionContext, calledMethodDefinition, methodParams); + break; + + // + // System.Activator + // + // static T CreateInstance<T> () + // + case IntrinsicId.Activator_CreateInstanceOfT: { + reflectionContext.AnalyzingPattern (); - // Not yet supported in any combination - reflectionContext.RecordUnrecognizedPattern ($"Activator call '{reflectionContext.MethodCalled.FullName}' inside '{reflectionContext.MethodCalling.FullName}' is not supported"); + if (calledMethod is GenericInstanceMethod genericCalledMethod && genericCalledMethod.GenericArguments.Count == 1 + && genericCalledMethod.GenericArguments[0] is GenericParameter genericParameter) { + if (genericParameter.HasDefaultConstructorConstraint) { + // This is safe, the linker would have marked the default .ctor already + reflectionContext.RecordHandledPattern (); + break; + } } - break; - // - // System.AppDomain - // - // CreateInstance (string assemblyName, string typeName) - // CreateInstance (string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) - // CreateInstance (string assemblyName, string typeName, object? []? activationAttributes) - // - // CreateInstanceAndUnwrap (string assemblyName, string typeName) - // CreateInstanceAndUnwrap (string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) - // CreateInstanceAndUnwrap (string assemblyName, string typeName, object? []? activationAttributes) - // - // CreateInstanceFrom (string assemblyFile, string typeName) - // CreateInstanceFrom (string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) - // CreateInstanceFrom (string assemblyFile, string typeName, object? []? activationAttributes) - // - // CreateInstanceFromAndUnwrap (string assemblyFile, string typeName) - // CreateInstanceFromAndUnwrap (string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) - // CreateInstanceFromAndUnwrap (string assemblyFile, string typeName, object? []? activationAttributes) - // - case var appDomainCreateInstance when appDomainCreateInstance == IntrinsicId.AppDomain_CreateInstance + // Not yet supported in any combination + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{reflectionContext.MethodCalled.FullName}' inside '{reflectionContext.MethodCalling.FullName}' is not supported"); + } + break; + + // + // System.AppDomain + // + // CreateInstance (string assemblyName, string typeName) + // CreateInstance (string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) + // CreateInstance (string assemblyName, string typeName, object? []? activationAttributes) + // + // CreateInstanceAndUnwrap (string assemblyName, string typeName) + // CreateInstanceAndUnwrap (string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) + // CreateInstanceAndUnwrap (string assemblyName, string typeName, object? []? activationAttributes) + // + // CreateInstanceFrom (string assemblyFile, string typeName) + // CreateInstanceFrom (string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) + // CreateInstanceFrom (string assemblyFile, string typeName, object? []? activationAttributes) + // + // CreateInstanceFromAndUnwrap (string assemblyFile, string typeName) + // CreateInstanceFromAndUnwrap (string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) + // CreateInstanceFromAndUnwrap (string assemblyFile, string typeName, object? []? activationAttributes) + // + case var appDomainCreateInstance when appDomainCreateInstance == IntrinsicId.AppDomain_CreateInstance || appDomainCreateInstance == IntrinsicId.AppDomain_CreateInstanceAndUnwrap || appDomainCreateInstance == IntrinsicId.AppDomain_CreateInstanceFrom || appDomainCreateInstance == IntrinsicId.AppDomain_CreateInstanceFromAndUnwrap: - ProcessCreateInstanceByName (ref reflectionContext, calledMethodDefinition, methodParams); - break; - + ProcessCreateInstanceByName (ref reflectionContext, calledMethodDefinition, methodParams); + break; + + // + // System.Reflection.Assembly + // + // CreateInstance (string typeName) + // CreateInstance (string typeName, bool ignoreCase) + // CreateInstance (string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder? binder, object []? args, CultureInfo? culture, object []? activationAttributes) + // + case IntrinsicId.Assembly_CreateInstance: // - // System.Reflection.Assembly + // TODO: This could be supported for `this` only calls // - // CreateInstance (string typeName) - // CreateInstance (string typeName, bool ignoreCase) - // CreateInstance (string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder? binder, object []? args, CultureInfo? culture, object []? activationAttributes) - // - case IntrinsicId.Assembly_CreateInstance: - // - // TODO: This could be supported for `this` only calls - // + reflectionContext.AnalyzingPattern (); + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{reflectionContext.MethodCalled.FullName}' inside '{reflectionContext.MethodCalling.FullName}' is not yet supported"); + break; + + // + // System.Runtime.CompilerServices.RuntimeHelpers + // + // RunClassConstructor (RuntimeTypeHandle type) + // + case IntrinsicId.RuntimeHelpers_RunClassConstructor: { reflectionContext.AnalyzingPattern (); - reflectionContext.RecordUnrecognizedPattern ($"Activator call '{reflectionContext.MethodCalled.FullName}' inside '{reflectionContext.MethodCalling.FullName}' is not yet supported"); - break; - - // - // System.Runtime.CompilerServices.RuntimeHelpers - // - // RunClassConstructor (RuntimeTypeHandle type) - // - case IntrinsicId.RuntimeHelpers_RunClassConstructor: { - reflectionContext.AnalyzingPattern (); - foreach (var typeHandleValue in methodParams [0].UniqueValues ()) { - if (typeHandleValue is RuntimeTypeHandleValue runtimeTypeHandleValue) { - _markStep.MarkStaticConstructor (runtimeTypeHandleValue.TypeRepresented, new DependencyInfo (DependencyKind.AccessedViaReflection, reflectionContext.MethodCalling)); - reflectionContext.RecordHandledPattern (); - } else if (typeHandleValue == NullValue.Instance) - reflectionContext.RecordHandledPattern (); - else { - reflectionContext.RecordUnrecognizedPattern ($"A {GetValueDescriptionForErrorMessage (typeHandleValue)} " + - $"is passed into the {GetMetadataTokenDescriptionForErrorMessage (reflectionContext.MethodCalled.Parameters[0])}. " + - $"It's not possible to guarantee availability of the target static constructor."); - } + foreach (var typeHandleValue in methodParams[0].UniqueValues ()) { + if (typeHandleValue is RuntimeTypeHandleValue runtimeTypeHandleValue) { + _markStep.MarkStaticConstructor (runtimeTypeHandleValue.TypeRepresented, new DependencyInfo (DependencyKind.AccessedViaReflection, reflectionContext.MethodCalling)); + reflectionContext.RecordHandledPattern (); + } else if (typeHandleValue == NullValue.Instance) + reflectionContext.RecordHandledPattern (); + else { + reflectionContext.RecordUnrecognizedPattern ($"A {GetValueDescriptionForErrorMessage (typeHandleValue)} " + + $"is passed into the {GetMetadataTokenDescriptionForErrorMessage (reflectionContext.MethodCalled.Parameters[0])}. " + + $"It's not possible to guarantee availability of the target static constructor."); } } - break; - - default: - if (requiresDataFlowAnalysis) { - reflectionContext.AnalyzingPattern (); - for (int parameterIndex = 0; parameterIndex < methodParams.Count; parameterIndex++) { - var requiredMemberKinds = _flowAnnotations.GetParameterAnnotation (calledMethodDefinition, parameterIndex); - if (requiredMemberKinds != 0) { - IMetadataTokenProvider targetContext; - if (calledMethodDefinition.HasImplicitThis ()) { - if (parameterIndex == 0) - targetContext = calledMethodDefinition; - else - targetContext = calledMethodDefinition.Parameters [parameterIndex - 1]; - } else { - targetContext = calledMethodDefinition.Parameters [parameterIndex]; - } + } + break; - RequireDynamicallyAccessedMembers (ref reflectionContext, requiredMemberKinds, methodParams [parameterIndex], targetContext); + default: + if (requiresDataFlowAnalysis) { + reflectionContext.AnalyzingPattern (); + for (int parameterIndex = 0; parameterIndex < methodParams.Count; parameterIndex++) { + var requiredMemberKinds = _flowAnnotations.GetParameterAnnotation (calledMethodDefinition, parameterIndex); + if (requiredMemberKinds != 0) { + IMetadataTokenProvider targetContext; + if (calledMethodDefinition.HasImplicitThis ()) { + if (parameterIndex == 0) + targetContext = calledMethodDefinition; + else + targetContext = calledMethodDefinition.Parameters[parameterIndex - 1]; + } else { + targetContext = calledMethodDefinition.Parameters[parameterIndex]; } - } - reflectionContext.RecordHandledPattern (); + RequireDynamicallyAccessedMembers (ref reflectionContext, requiredMemberKinds, methodParams[parameterIndex], targetContext); + } } - // To get good reporting of errors we need to track the origin of the value for all method calls - // but except Newobj as those are special. - if (calledMethodDefinition.ReturnType.MetadataType != MetadataType.Void) { - methodReturnValue = new MethodReturnValue (returnValueDynamicallyAccessedMemberKinds) { - SourceContext = calledMethodDefinition - }; + reflectionContext.RecordHandledPattern (); + } + + // To get good reporting of errors we need to track the origin of the value for all method calls + // but except Newobj as those are special. + if (calledMethodDefinition.ReturnType.MetadataType != MetadataType.Void) { + methodReturnValue = new MethodReturnValue (returnValueDynamicallyAccessedMemberKinds) { + SourceContext = calledMethodDefinition + }; - return true; - } + return true; + } - return false; + return false; } } finally { reflectionContext.Dispose (); @@ -1042,17 +1042,17 @@ namespace Mono.Linker.Dataflow BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public; bool parameterlessConstructor = true; - if (calledMethod.Parameters.Count == 8 && calledMethod.Parameters [2].ParameterType.MetadataType == MetadataType.Boolean && - methodParams [3].AsConstInt () != null) { + if (calledMethod.Parameters.Count == 8 && calledMethod.Parameters[2].ParameterType.MetadataType == MetadataType.Boolean && + methodParams[3].AsConstInt () != null) { parameterlessConstructor = false; - bindingFlags = BindingFlags.Instance | (BindingFlags)methodParams [3].AsConstInt (); + bindingFlags = BindingFlags.Instance | (BindingFlags) methodParams[3].AsConstInt (); } int methodParamsOffset = calledMethod.HasImplicitThis () ? 1 : 0; - foreach (var assemblyNameValue in methodParams [methodParamsOffset].UniqueValues ()) { + foreach (var assemblyNameValue in methodParams[methodParamsOffset].UniqueValues ()) { if (assemblyNameValue is KnownStringValue assemblyNameStringValue) { - foreach (var typeNameValue in methodParams [methodParamsOffset + 1].UniqueValues ()) { + foreach (var typeNameValue in methodParams[methodParamsOffset + 1].UniqueValues ()) { if (typeNameValue is KnownStringValue typeNameStringValue) { var resolvedAssembly = _context.GetLoadedAssembly (assemblyNameStringValue.Contents); if (resolvedAssembly == null) { @@ -1067,7 +1067,7 @@ namespace Mono.Linker.Dataflow } MarkConstructorsOnType (ref reflectionContext, resolvedType, - parameterlessConstructor ? m => m.Parameters.Count == 0 : (Func<MethodDefinition, bool>)null, bindingFlags); + parameterlessConstructor ? m => m.Parameters.Count == 0 : (Func<MethodDefinition, bool>) null, bindingFlags); } else { reflectionContext.RecordUnrecognizedPattern ($"Activator call '{reflectionContext.MethodCalled.FullName}' inside '{reflectionContext.MethodCalling.FullName}' has unrecognized value for the 'typeName' parameter."); } @@ -1380,37 +1380,37 @@ namespace Mono.Linker.Dataflow string GetValueDescriptionForErrorMessage (ValueNode value) { switch (value) { - case MethodParameterValue methodParameterValue: { - if (methodParameterValue.SourceContext is MethodDefinition method) { - int declaredParameterIndex; - if (method.HasImplicitThis ()) { - if (methodParameterValue.ParameterIndex == 0) - return GetMetadataTokenDescriptionForErrorMessage (method); - - declaredParameterIndex = methodParameterValue.ParameterIndex - 1; - } else - declaredParameterIndex = methodParameterValue.ParameterIndex; - - if (declaredParameterIndex >= 0 && declaredParameterIndex < method.Parameters.Count) - return GetMetadataTokenDescriptionForErrorMessage (method.Parameters [declaredParameterIndex]); - } - - return $"parameter #{methodParameterValue.ParameterIndex} of method '{methodParameterValue.SourceContext}'"; + case MethodParameterValue methodParameterValue: { + if (methodParameterValue.SourceContext is MethodDefinition method) { + int declaredParameterIndex; + if (method.HasImplicitThis ()) { + if (methodParameterValue.ParameterIndex == 0) + return GetMetadataTokenDescriptionForErrorMessage (method); + + declaredParameterIndex = methodParameterValue.ParameterIndex - 1; + } else + declaredParameterIndex = methodParameterValue.ParameterIndex; + + if (declaredParameterIndex >= 0 && declaredParameterIndex < method.Parameters.Count) + return GetMetadataTokenDescriptionForErrorMessage (method.Parameters[declaredParameterIndex]); } - case MethodReturnValue methodReturnValue: { - if (methodReturnValue.SourceContext is MethodDefinition method) { - return GetMetadataTokenDescriptionForErrorMessage (method.MethodReturnType); - } + return $"parameter #{methodParameterValue.ParameterIndex} of method '{methodParameterValue.SourceContext}'"; + } - return "method return value"; + case MethodReturnValue methodReturnValue: { + if (methodReturnValue.SourceContext is MethodDefinition method) { + return GetMetadataTokenDescriptionForErrorMessage (method.MethodReturnType); } - case LoadFieldValue loadFieldValue: - return GetMetadataTokenDescriptionForErrorMessage (loadFieldValue.Field); + return "method return value"; + } - default: - return $"value from unknown source"; + case LoadFieldValue loadFieldValue: + return GetMetadataTokenDescriptionForErrorMessage (loadFieldValue.Field); + + default: + return $"value from unknown source"; } } @@ -1469,4 +1469,4 @@ namespace Mono.Linker.Dataflow return string.Join (" | ", results.Select (r => r.ToString ())); } } -} +}
\ No newline at end of file diff --git a/src/linker/Linker.Dataflow/ScannerExtensions.cs b/src/linker/Linker.Dataflow/ScannerExtensions.cs index 0fa3a5da3..5210a5578 100644 --- a/src/linker/Linker.Dataflow/ScannerExtensions.cs +++ b/src/linker/Linker.Dataflow/ScannerExtensions.cs @@ -27,7 +27,7 @@ namespace Mono.Linker.Dataflow Object value = operation.Operand; if (value is Instruction inst) { branchTargets.Add (inst.Offset); - } else if (value is Instruction [] instructions) { + } else if (value is Instruction[] instructions) { foreach (Instruction switchLabel in instructions) { branchTargets.Add (switchLabel.Offset); } @@ -42,7 +42,7 @@ namespace Mono.Linker.Dataflow return branchTargets; } - public static bool IsByRefOrPointer(this TypeReference typeRef) + public static bool IsByRefOrPointer (this TypeReference typeRef) { return typeRef.IsByReference || typeRef.IsPointer; } diff --git a/src/linker/Linker.Dataflow/ValueNode.cs b/src/linker/Linker.Dataflow/ValueNode.cs index f8ca921a5..aeca364ce 100644 --- a/src/linker/Linker.Dataflow/ValueNode.cs +++ b/src/linker/Linker.Dataflow/ValueNode.cs @@ -129,7 +129,7 @@ namespace Mono.Linker.Dataflow if (!(other is ValueNode)) return false; - return this.Equals ((ValueNode)other); + return this.Equals ((ValueNode) other); } #region Specialized Collection Nested Types @@ -188,12 +188,12 @@ namespace Mono.Linker.Dataflow IEnumerator<ValueNode> IEnumerable<ValueNode>.GetEnumerator () { // note the boxing! - return (IEnumerator<ValueNode>)new Enumerator (_parentNode); + return (IEnumerator<ValueNode>) new Enumerator (_parentNode); } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () { // note the boxing! - return (System.Collections.IEnumerator)new Enumerator (_parentNode); + return (System.Collections.IEnumerator) new Enumerator (_parentNode); } public int Count { get { return (_parentNode != null) ? _parentNode.NumChildren : 0; } } @@ -235,7 +235,7 @@ namespace Mono.Linker.Dataflow } // note the boxing! - return (IEnumerator<ValueNode>)GetEnumerator (); + return (IEnumerator<ValueNode>) GetEnumerator (); } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () @@ -245,7 +245,7 @@ namespace Mono.Linker.Dataflow } // note the boxing! - return (System.Collections.IEnumerator)GetEnumerator (); + return (System.Collections.IEnumerator) GetEnumerator (); } @@ -357,50 +357,50 @@ namespace Mono.Linker.Dataflow bool foundCycle = false; switch (node.Kind) { - // - // Leaf nodes - // - case ValueNodeKind.Unknown: - case ValueNodeKind.Null: - case ValueNodeKind.SystemType: - case ValueNodeKind.RuntimeTypeHandle: - case ValueNodeKind.KnownString: - case ValueNodeKind.ConstInt: - case ValueNodeKind.MethodParameter: - case ValueNodeKind.LoadField: - break; - - // - // Nodes with children - // - case ValueNodeKind.MergePoint: - foreach (ValueNode val in ((MergePointValue)node).Values) { - if (val.DetectCycle (seenNodes, allNodesSeen)) { - foundCycle = true; - } + // + // Leaf nodes + // + case ValueNodeKind.Unknown: + case ValueNodeKind.Null: + case ValueNodeKind.SystemType: + case ValueNodeKind.RuntimeTypeHandle: + case ValueNodeKind.KnownString: + case ValueNodeKind.ConstInt: + case ValueNodeKind.MethodParameter: + case ValueNodeKind.LoadField: + break; + + // + // Nodes with children + // + case ValueNodeKind.MergePoint: + foreach (ValueNode val in ((MergePointValue) node).Values) { + if (val.DetectCycle (seenNodes, allNodesSeen)) { + foundCycle = true; } - break; + } + break; - case ValueNodeKind.GetTypeFromString: - GetTypeFromStringValue gtfsv = (GetTypeFromStringValue)node; - foundCycle = gtfsv.AssemblyIdentity.DetectCycle (seenNodes, allNodesSeen); - foundCycle |= gtfsv.NameString.DetectCycle (seenNodes, allNodesSeen); - break; + case ValueNodeKind.GetTypeFromString: + GetTypeFromStringValue gtfsv = (GetTypeFromStringValue) node; + foundCycle = gtfsv.AssemblyIdentity.DetectCycle (seenNodes, allNodesSeen); + foundCycle |= gtfsv.NameString.DetectCycle (seenNodes, allNodesSeen); + break; - case ValueNodeKind.Array: - ArrayValue av = (ArrayValue)node; - foundCycle = av.Size.DetectCycle (seenNodes, allNodesSeen); - break; + case ValueNodeKind.Array: + ArrayValue av = (ArrayValue) node; + foundCycle = av.Size.DetectCycle (seenNodes, allNodesSeen); + break; - default: - throw new Exception (String.Format ("Unknown node kind: {0}", node.Kind)); + default: + throw new Exception (String.Format ("Unknown node kind: {0}", node.Kind)); } seenNodes.Remove (node); return foundCycle; } - public static ValueNode.UniqueValueCollection UniqueValues(this ValueNode node) + public static ValueNode.UniqueValueCollection UniqueValues (this ValueNode node) { if (node == null) return new ValueNode.UniqueValueCollection (UnknownValue.Instance); @@ -408,7 +408,7 @@ namespace Mono.Linker.Dataflow return node.UniqueValues; } - public static int? AsConstInt(this ValueNode node) + public static int? AsConstInt (this ValueNode node) { if (node is ConstIntValue constInt) return constInt.Value; @@ -418,7 +418,7 @@ namespace Mono.Linker.Dataflow static internal class ValueNodeDump { - internal static string ValueNodeToString (ValueNode node, params object [] args) + internal static string ValueNodeToString (ValueNode node, params object[] args) { if (node == null) return "<null>"; @@ -430,7 +430,7 @@ namespace Mono.Linker.Dataflow for (int i = 0; i < args.Length; i++) { if (i > 0) sb.Append (","); - sb.Append (args [i] == null ? "<null>" : args [i].ToString ()); + sb.Append (args[i] == null ? "<null>" : args[i].ToString ()); } } sb.Append (")"); @@ -550,7 +550,7 @@ namespace Mono.Linker.Dataflow if (this.Kind != other.Kind) return false; - return Equals(this.TypeRepresented, ((SystemTypeValue)other).TypeRepresented); + return Equals (this.TypeRepresented, ((SystemTypeValue) other).TypeRepresented); } public override int GetHashCode () @@ -584,7 +584,7 @@ namespace Mono.Linker.Dataflow if (this.Kind != other.Kind) return false; - return Equals(this.TypeRepresented, ((RuntimeTypeHandleValue)other).TypeRepresented); + return Equals (this.TypeRepresented, ((RuntimeTypeHandleValue) other).TypeRepresented); } public override int GetHashCode () @@ -618,7 +618,7 @@ namespace Mono.Linker.Dataflow if (this.Kind != other.Kind) return false; - return this.Contents == ((KnownStringValue)other).Contents; + return this.Contents == ((KnownStringValue) other).Contents; } public override int GetHashCode () @@ -666,7 +666,7 @@ namespace Mono.Linker.Dataflow if (this.Kind != other.Kind) return false; - var otherValue = (MethodParameterValue)other; + var otherValue = (MethodParameterValue) other; return this.ParameterIndex == otherValue.ParameterIndex && this.DynamicallyAccessedMemberKinds == otherValue.DynamicallyAccessedMemberKinds; } @@ -699,7 +699,7 @@ namespace Mono.Linker.Dataflow if (this.Kind != other.Kind) return false; - var otherValue = (MethodReturnValue)other; + var otherValue = (MethodReturnValue) other; return this.DynamicallyAccessedMemberKinds == otherValue.DynamicallyAccessedMemberKinds; } @@ -728,14 +728,14 @@ namespace Mono.Linker.Dataflow m_values = new ValueNodeHashSet (); if (one.Kind == ValueNodeKind.MergePoint) { - MergePointValue mpvOne = (MergePointValue)one; + MergePointValue mpvOne = (MergePointValue) one; foreach (ValueNode value in mpvOne.Values) m_values.Add (value); } else m_values.Add (one); if (two.Kind == ValueNodeKind.MergePoint) { - MergePointValue mpvTwo = (MergePointValue)two; + MergePointValue mpvTwo = (MergePointValue) two; foreach (ValueNode value in mpvTwo.Values) m_values.Add (value); } else @@ -754,7 +754,7 @@ namespace Mono.Linker.Dataflow //InvalidateIsOpen (); if (node.Kind == ValueNodeKind.MergePoint) { - foreach (ValueNode value in ((MergePointValue)node).Values) + foreach (ValueNode value in ((MergePointValue) node).Values) m_values.Add (value); } else m_values.Add (node); @@ -807,7 +807,7 @@ namespace Mono.Linker.Dataflow if (this.Kind != other.Kind) return false; - MergePointValue otherMpv = (MergePointValue)other; + MergePointValue otherMpv = (MergePointValue) other; if (this.Values.Count != otherMpv.Values.Count) return false; @@ -869,7 +869,7 @@ namespace Mono.Linker.Dataflow names = new HashSet<string> (); } - string typeName = ((KnownStringValue)nameStringValue).Contents; + string typeName = ((KnownStringValue) nameStringValue).Contents; names.Add (typeName); } } @@ -879,7 +879,7 @@ namespace Mono.Linker.Dataflow if (names != null) { foreach (ValueNode assemblyValue in AssemblyIdentity.UniqueValues) { if (assemblyValue.Kind == ValueNodeKind.KnownString) { - string assemblyName = ((KnownStringValue)assemblyValue).Contents; + string assemblyName = ((KnownStringValue) assemblyValue).Contents; foreach (string name in names) { TypeDefinition typeDefinition = _resolver (assemblyName, name); @@ -903,7 +903,7 @@ namespace Mono.Linker.Dataflow if (this.Kind != other.Kind) return false; - GetTypeFromStringValue otherGtfs = (GetTypeFromStringValue)other; + GetTypeFromStringValue otherGtfs = (GetTypeFromStringValue) other; return this.AssemblyIdentity.Equals (otherGtfs.AssemblyIdentity) && this.NameString.Equals (otherGtfs.NameString); @@ -942,10 +942,10 @@ namespace Mono.Linker.Dataflow if (this.Kind != other.Kind) return false; - LoadFieldValue otherLfv = (LoadFieldValue)other; + LoadFieldValue otherLfv = (LoadFieldValue) other; if (!Equals (this.Field, otherLfv.Field)) return false; - + return this.DynamicallyAccessedMemberKinds == otherLfv.DynamicallyAccessedMemberKinds; } @@ -985,7 +985,7 @@ namespace Mono.Linker.Dataflow if (this.Kind != other.Kind) return false; - ConstIntValue otherCiv = (ConstIntValue)other; + ConstIntValue otherCiv = (ConstIntValue) other; return Value == otherCiv.Value; } @@ -1022,7 +1022,7 @@ namespace Mono.Linker.Dataflow if (this.Kind != other.Kind) return false; - ArrayValue otherArr = (ArrayValue)other; + ArrayValue otherArr = (ArrayValue) other; return Size.Equals (otherArr.Size); } @@ -1076,7 +1076,7 @@ namespace Mono.Linker.Dataflow return false; for (int i = 0; i < Count; i++) { - if (!otherList [i].Equals (this [i])) + if (!otherList[i].Equals (this[i])) return false; } return true; diff --git a/src/linker/Linker.Steps/AddBypassNGenStep.cs b/src/linker/Linker.Steps/AddBypassNGenStep.cs index dccf6e336..71b6ae2f0 100644 --- a/src/linker/Linker.Steps/AddBypassNGenStep.cs +++ b/src/linker/Linker.Steps/AddBypassNGenStep.cs @@ -10,13 +10,15 @@ using Mono.Cecil; using Mono.Collections.Generic; using Mono.Cecil.Cil; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public class AddBypassNGenStep : BaseStep{ + public class AddBypassNGenStep : BaseStep + { AssemblyDefinition coreLibAssembly; CustomAttribute bypassNGenAttribute; - + protected override void ProcessAssembly (AssemblyDefinition assembly) { if (Annotations.GetAction (assembly) == AssemblyAction.AddBypassNGen) { @@ -52,7 +54,7 @@ namespace Mono.Linker.Steps { void ProcessNestedTypes (TypeDefinition type) { for (int i = 0; i < type.NestedTypes.Count; i++) { - var nested = type.NestedTypes [i]; + var nested = type.NestedTypes[i]; ProcessType (nested); } } @@ -99,8 +101,7 @@ namespace Mono.Linker.Steps { instructions.Add (Instruction.Create (OpCodes.Ret)); bypassNGenAttributeDef.Methods.Add (bypassNGenAttributeDefaultConstructor); - } - else { + } else { foreach (MethodDefinition method in bypassNGenAttributeDef.Methods) { if (method.IsConstructor && !method.IsStatic && !method.HasParameters) { bypassNGenAttributeDefaultConstructor = method; diff --git a/src/linker/Linker.Steps/BaseStep.cs b/src/linker/Linker.Steps/BaseStep.cs index 39210adc9..763ea8d7a 100644 --- a/src/linker/Linker.Steps/BaseStep.cs +++ b/src/linker/Linker.Steps/BaseStep.cs @@ -28,9 +28,11 @@ using Mono.Cecil; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public abstract class BaseStep : IStep { + public abstract class BaseStep : IStep + { private LinkContext _context; diff --git a/src/linker/Linker.Steps/BlacklistStep.cs b/src/linker/Linker.Steps/BlacklistStep.cs index daa3d81c2..dc8332933 100644 --- a/src/linker/Linker.Steps/BlacklistStep.cs +++ b/src/linker/Linker.Steps/BlacklistStep.cs @@ -36,9 +36,11 @@ using System.Xml.XPath; using Mono.Cecil; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public class BlacklistStep : BaseStep { + public class BlacklistStep : BaseStep + { protected override void Process () { diff --git a/src/linker/Linker.Steps/BodySubstituterStep.cs b/src/linker/Linker.Steps/BodySubstituterStep.cs index 4f00fc177..85b2ad949 100644 --- a/src/linker/Linker.Steps/BodySubstituterStep.cs +++ b/src/linker/Linker.Steps/BodySubstituterStep.cs @@ -54,7 +54,7 @@ namespace Mono.Linker.Steps } if (!bool.TryParse (value, out bool bValue)) { - Context.LogMessage(MessageContainer.CreateErrorMessage ($"Unsupported non-boolean feature definition {feature}", 1002)); + Context.LogMessage (MessageContainer.CreateErrorMessage ($"Unsupported non-boolean feature definition {feature}", 1002)); return false; } @@ -277,7 +277,7 @@ namespace Mono.Linker.Steps if (!uint.TryParse (value, NumberStyles.Integer, CultureInfo.InvariantCulture, out uint uresult)) break; - result = (int)uresult; + result = (int) uresult; return true; case MetadataType.Double: @@ -305,7 +305,7 @@ namespace Mono.Linker.Steps if (!ulong.TryParse (value, NumberStyles.Integer, CultureInfo.InvariantCulture, out ulong ulresult)) break; - result = (long)ulresult; + result = (long) ulresult; return true; case MetadataType.Char: diff --git a/src/linker/Linker.Steps/CleanStep.cs b/src/linker/Linker.Steps/CleanStep.cs index 02713d874..7285b7e5d 100644 --- a/src/linker/Linker.Steps/CleanStep.cs +++ b/src/linker/Linker.Steps/CleanStep.cs @@ -28,9 +28,11 @@ using Mono.Cecil; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public class CleanStep : BaseStep { + public class CleanStep : BaseStep + { protected override void ProcessAssembly (AssemblyDefinition assembly) { @@ -69,7 +71,7 @@ namespace Mono.Linker.Steps { var events = type.Events; for (int i = 0; i < events.Count; i++) { - var evt = events [i]; + var evt = events[i]; evt.AddMethod = CheckMethod (type, evt.AddMethod); evt.InvokeMethod = CheckMethod (type, evt.InvokeMethod); evt.RemoveMethod = CheckMethod (type, evt.RemoveMethod); @@ -89,7 +91,7 @@ namespace Mono.Linker.Steps { var properties = type.Properties; for (int i = 0; i < properties.Count; i++) { - var prop = properties [i]; + var prop = properties[i]; prop.GetMethod = CheckMethod (type, prop.GetMethod); prop.SetMethod = CheckMethod (type, prop.SetMethod); diff --git a/src/linker/Linker.Steps/ClearInitLocals.cs b/src/linker/Linker.Steps/ClearInitLocals.cs index aa14e7ec9..c5d505edc 100644 --- a/src/linker/Linker.Steps/ClearInitLocals.cs +++ b/src/linker/Linker.Steps/ClearInitLocals.cs @@ -10,9 +10,8 @@ namespace Mono.Linker.Steps protected override void Process () { - if (Context.TryGetCustomData ("ClearInitLocalsAssemblies", out string parameter)) { - _assemblies = new HashSet<string> (parameter.Split(','), StringComparer.OrdinalIgnoreCase); + _assemblies = new HashSet<string> (parameter.Split (','), StringComparer.OrdinalIgnoreCase); } } diff --git a/src/linker/Linker.Steps/CodeRewriterStep.cs b/src/linker/Linker.Steps/CodeRewriterStep.cs index 422edf460..14adc6b31 100644 --- a/src/linker/Linker.Steps/CodeRewriterStep.cs +++ b/src/linker/Linker.Steps/CodeRewriterStep.cs @@ -4,7 +4,8 @@ using System.Linq; using Mono.Cecil; using Mono.Cecil.Cil; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ public class CodeRewriterStep : BaseStep { AssemblyDefinition assembly; @@ -59,11 +60,11 @@ namespace Mono.Linker.Steps { processor = cctor.Body.GetILProcessor (); for (int i = 0; i < body.Instructions.Count; ++i) { - var instr = body.Instructions [i]; + var instr = body.Instructions[i]; if (instr.OpCode.Code != Code.Stsfld) continue; - var field = (FieldReference)instr.Operand; + var field = (FieldReference) instr.Operand; if (!Annotations.HasSubstitutedInit (field.Resolve ())) continue; @@ -105,7 +106,7 @@ namespace Mono.Linker.Steps { method.Body = CreateThrowLinkedAwayBody (method); - method.ClearDebugInformation(); + method.ClearDebugInformation (); } protected virtual void RewriteBodyToStub (MethodDefinition method) @@ -115,7 +116,7 @@ namespace Mono.Linker.Steps { method.Body = CreateStubBody (method); - method.ClearDebugInformation(); + method.ClearDebugInformation (); } MethodBody CreateThrowLinkedAwayBody (MethodDefinition method) @@ -152,7 +153,7 @@ namespace Mono.Linker.Steps { var il = body.GetILProcessor (); if (method.IsInstanceConstructor () && !method.DeclaringType.IsValueType) { - var base_ctor = method.DeclaringType.BaseType.GetDefaultInstanceConstructor(); + var base_ctor = method.DeclaringType.BaseType.GetDefaultInstanceConstructor (); if (base_ctor == null) throw new NotSupportedException ($"Cannot replace constructor for '{method.DeclaringType}' when no base default constructor exists"); diff --git a/src/linker/Linker.Steps/IStep.cs b/src/linker/Linker.Steps/IStep.cs index c01ef1e6b..fb43a893e 100644 --- a/src/linker/Linker.Steps/IStep.cs +++ b/src/linker/Linker.Steps/IStep.cs @@ -26,9 +26,11 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public interface IStep { + public interface IStep + { void Process (LinkContext context); } } diff --git a/src/linker/Linker.Steps/LoadI18nAssemblies.cs b/src/linker/Linker.Steps/LoadI18nAssemblies.cs index cd336a663..03b0763b9 100644 --- a/src/linker/Linker.Steps/LoadI18nAssemblies.cs +++ b/src/linker/Linker.Steps/LoadI18nAssemblies.cs @@ -30,11 +30,13 @@ using System; using System.Linq; using Mono.Cecil; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public class LoadI18nAssemblies : BaseStep { + public class LoadI18nAssemblies : BaseStep + { - static readonly byte [] _pktoken = new byte [] {0x07, 0x38, 0xeb, 0x9f, 0x13, 0x2e, 0xd7, 0x56}; + static readonly byte[] _pktoken = new byte[] { 0x07, 0x38, 0xeb, 0x9f, 0x13, 0x2e, 0xd7, 0x56 }; I18nAssemblies _assemblies; @@ -49,7 +51,7 @@ namespace Mono.Linker.Steps { Context.GetAssemblies ().FirstOrDefault (a => a.Name.Name == "mscorlib")?.MainModule.GetType ("System.MonoType") != null; } - protected override void Process() + protected override void Process () { LoadAssembly (GetAssemblyName (I18nAssemblies.Base)); diff --git a/src/linker/Linker.Steps/LoadReferencesStep.cs b/src/linker/Linker.Steps/LoadReferencesStep.cs index 5cd56d379..35c5cc016 100644 --- a/src/linker/Linker.Steps/LoadReferencesStep.cs +++ b/src/linker/Linker.Steps/LoadReferencesStep.cs @@ -31,9 +31,11 @@ using System.Collections.Generic; using Mono.Cecil; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public class LoadReferencesStep : BaseStep { + public class LoadReferencesStep : BaseStep + { readonly HashSet<AssemblyNameDefinition> references = new HashSet<AssemblyNameDefinition> (); diff --git a/src/linker/Linker.Steps/MarkStep.cs b/src/linker/Linker.Steps/MarkStep.cs index 3caf171ce..9e4caaf34 100644 --- a/src/linker/Linker.Steps/MarkStep.cs +++ b/src/linker/Linker.Steps/MarkStep.cs @@ -37,9 +37,11 @@ using Mono.Cecil.Cil; using Mono.Collections.Generic; using Mono.Linker.Dataflow; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public partial class MarkStep : IStep { + public partial class MarkStep : IStep + { protected LinkContext _context; protected Queue<(MethodDefinition, DependencyInfo)> _methods; @@ -315,29 +317,29 @@ namespace Mono.Linker.Steps { { while (ProcessPrimaryQueue () || ProcessLazyAttributes () || ProcessLateMarkedAttributes ()) - // deal with [TypeForwardedTo] pseudo-attributes - foreach (AssemblyDefinition assembly in _context.GetAssemblies ()) { - if (!assembly.MainModule.HasExportedTypes) - continue; + // deal with [TypeForwardedTo] pseudo-attributes + foreach (AssemblyDefinition assembly in _context.GetAssemblies ()) { + if (!assembly.MainModule.HasExportedTypes) + continue; - foreach (var exported in assembly.MainModule.ExportedTypes) { - bool isForwarder = exported.IsForwarder; - var declaringType = exported.DeclaringType; - while (!isForwarder && (declaringType != null)) { - isForwarder = declaringType.IsForwarder; - declaringType = declaringType.DeclaringType; - } + foreach (var exported in assembly.MainModule.ExportedTypes) { + bool isForwarder = exported.IsForwarder; + var declaringType = exported.DeclaringType; + while (!isForwarder && (declaringType != null)) { + isForwarder = declaringType.IsForwarder; + declaringType = declaringType.DeclaringType; + } - if (!isForwarder) - continue; - TypeDefinition type = exported.Resolve (); - if (type == null) - continue; - if (!Annotations.IsMarked (type)) - continue; - _context.MarkingHelpers.MarkExportedType (exported, assembly.MainModule, new DependencyInfo (DependencyKind.ExportedType, type)); + if (!isForwarder) + continue; + TypeDefinition type = exported.Resolve (); + if (type == null) + continue; + if (!Annotations.IsMarked (type)) + continue; + _context.MarkingHelpers.MarkExportedType (exported, assembly.MainModule, new DependencyInfo (DependencyKind.ExportedType, type)); + } } - } } bool ProcessPrimaryQueue () @@ -406,7 +408,7 @@ namespace Mono.Linker.Steps { void ProcessPendingBodies () { for (int i = 0; i < _unreachableBodies.Count; i++) { - var body = _unreachableBodies [i]; + var body = _unreachableBodies[i]; if (Annotations.IsInstantiated (body.Method.DeclaringType)) { MarkMethodBody (body); _unreachableBodies.RemoveAt (i--); @@ -543,7 +545,8 @@ namespace Mono.Linker.Steps { protected static AssemblyDefinition GetAssemblyFromCustomAttributeProvider (ICustomAttributeProvider provider) { - return provider switch { + return provider switch + { MemberReference mr => mr.Module.Assembly, AssemblyDefinition ad => ad, ModuleDefinition md => md.Assembly, @@ -562,8 +565,8 @@ namespace Mono.Linker.Steps { protected virtual void MarkUserDependency (MemberReference context, CustomAttribute ca) { - if (ca.HasProperties && ca.Properties [0].Name == "Condition") { - var condition = ca.Properties [0].Argument.Value as string; + if (ca.HasProperties && ca.Properties[0].Name == "Condition") { + var condition = ca.Properties[0].Argument.Value as string; switch (condition) { case "": case null: @@ -581,7 +584,7 @@ namespace Mono.Linker.Steps { AssemblyDefinition assembly; var args = ca.ConstructorArguments; - if (args.Count >= 3 && args [2].Value is string assemblyName) { + if (args.Count >= 3 && args[2].Value is string assemblyName) { assembly = _context.GetLoadedAssembly (assemblyName); if (assembly == null) { _context.LogMessage (MessageImportance.Low, $"Could not resolve '{assemblyName}' assembly dependency"); @@ -592,7 +595,7 @@ namespace Mono.Linker.Steps { } TypeDefinition td; - if (args.Count >= 2 && args [1].Value is string typeName) { + if (args.Count >= 2 && args[1].Value is string typeName) { td = (assembly ?? context.Module.Assembly).FindType (typeName); if (td == null) { @@ -605,7 +608,7 @@ namespace Mono.Linker.Steps { string member = null; string[] signature = null; - if (args.Count >= 1 && args [0].Value is string memberSignature) { + if (args.Count >= 1 && args[0].Value is string memberSignature) { memberSignature = memberSignature.Replace (" ", ""); var sign_start = memberSignature.IndexOf ('('); var sign_end = memberSignature.LastIndexOf (')'); @@ -642,7 +645,7 @@ namespace Mono.Linker.Steps { } else { name = name.Substring (0, arity_marker); } - + foreach (var m in type.Methods) { if (m.Name != name) continue; @@ -662,7 +665,7 @@ namespace Mono.Linker.Steps { int i = 0; for (; i < signature.Length; ++i) { - if (mp [i].ParameterType.FullName != signature [i].Trim ().ToCecilName ()) { + if (mp[i].ParameterType.FullName != signature[i].Trim ().ToCecilName ()) { i = -1; break; } @@ -737,7 +740,7 @@ namespace Mono.Linker.Steps { case "System.Runtime.CompilerServices.InternalsVisibleToAttribute": return true; } - + if (!Annotations.IsMarked (attr_type.Resolve ())) return false; } @@ -749,7 +752,7 @@ namespace Mono.Linker.Steps { { if (Annotations.HasPreservedStaticCtor (type)) return false; - + if (type.IsBeforeFieldInit && _context.IsOptimizationEnabled (CodeOptimizations.BeforeFieldInit, type)) return false; @@ -784,7 +787,7 @@ namespace Mono.Linker.Steps { return false; } } - + return true; } @@ -803,7 +806,7 @@ namespace Mono.Linker.Steps { { if (!sd.HasSecurityAttributes) return; - + foreach (var sa in sd.SecurityAttributes) MarkSecurityAttribute (sa, reason); } @@ -943,7 +946,7 @@ namespace Mono.Linker.Steps { // Array arguments are modeled as a CustomAttributeArgument [], and will mark the // Type once for each element in the array. - foreach (var caa in (CustomAttributeArgument [])argument.Value) + foreach (var caa in (CustomAttributeArgument[]) argument.Value) MarkCustomAttributeArgument (caa, ca); return; @@ -953,11 +956,11 @@ namespace Mono.Linker.Steps { switch (at.Name) { case "Type": MarkType (argument.Type, new DependencyInfo (DependencyKind.CustomAttributeArgumentType, ca)); - MarkType ((TypeReference)argument.Value, new DependencyInfo (DependencyKind.CustomAttributeArgumentValue, ca)); + MarkType ((TypeReference) argument.Value, new DependencyInfo (DependencyKind.CustomAttributeArgumentValue, ca)); return; case "Object": - var boxed_value = (CustomAttributeArgument)argument.Value; + var boxed_value = (CustomAttributeArgument) argument.Value; MarkType (boxed_value.Type, new DependencyInfo (DependencyKind.CustomAttributeArgumentType, ca)); MarkCustomAttributeArgument (boxed_value, ca); return; @@ -1006,10 +1009,8 @@ namespace Mono.Linker.Steps { { // Pre-mark <Module> if there is any methods as they need to be executed // at assembly load time - foreach (TypeDefinition type in assembly.MainModule.Types) - { - if (type.Name == "<Module>" && type.HasMethods) - { + foreach (TypeDefinition type in assembly.MainModule.Types) { + if (type.Name == "<Module>" && type.HasMethods) { MarkType (type, new DependencyInfo (DependencyKind.TypeInAssembly, assembly)); break; } @@ -1142,7 +1143,8 @@ namespace Mono.Linker.Steps { var parent = field.DeclaringType; if (!Annotations.HasPreservedStaticCtor (parent)) { - var cctorReason = reason.Kind switch { + var cctorReason = reason.Kind switch + { // Report an edge directly from the method accessing the field to the static ctor it triggers DependencyKind.FieldAccess => new DependencyInfo (DependencyKind.TriggersCctorThroughFieldAccess, reason.Source), _ => new DependencyInfo (DependencyKind.CctorForField, field) @@ -1202,8 +1204,8 @@ namespace Mono.Linker.Steps { if (reference is GenericParameter) return null; -// if (IgnoreScope (reference.Scope)) -// return null; + // if (IgnoreScope (reference.Scope)) + // return null; TypeDefinition type = reference.Resolve (); @@ -1322,7 +1324,7 @@ namespace Mono.Linker.Steps { protected virtual void DoAdditionalTypeProcessing (TypeDefinition type) { } - + // Allow subclassers to mark additional things protected virtual void DoAdditionalFieldProcessing (FieldDefinition field) { @@ -1374,7 +1376,7 @@ namespace Mono.Linker.Steps { return targetTypeReference?.Resolve (); } - + void MarkTypeSpecialCustomAttributes (TypeDefinition type) { if (!type.HasCustomAttributes) @@ -1412,7 +1414,7 @@ namespace Mono.Linker.Steps { if (dt.Name == "TypeConverterAttribute" && dt.Namespace == "System.ComponentModel") { MarkTypeConverterLikeDependency (ca, l => l.IsDefaultConstructor () || - l.Parameters.Count == 1 && l.Parameters [0].ParameterType.IsTypeOf ("System", "Type"), + l.Parameters.Count == 1 && l.Parameters[0].ParameterType.IsTypeOf ("System", "Type"), provider); return true; } @@ -1449,7 +1451,7 @@ namespace Mono.Linker.Steps { return; TypeDefinition tdef = null; - switch (attribute.ConstructorArguments [0].Value) { + switch (attribute.ConstructorArguments[0].Value) { case string s: tdef = AssemblyUtilities.ResolveFullyQualifiedTypeName (_context, s); break; @@ -1483,7 +1485,7 @@ namespace Mono.Linker.Steps { // Remove ",nq" suffix if present // (it asks the expression evaluator to remove the quotes when displaying the final value) - if (Regex.IsMatch(realMatch, @".+,\s*nq")) { + if (Regex.IsMatch (realMatch, @".+,\s*nq")) { realMatch = realMatch.Substring (0, realMatch.LastIndexOf (',')); } @@ -1559,7 +1561,7 @@ namespace Mono.Linker.Steps { if (attribute.ConstructorArguments.Count < 1) return false; - argument = attribute.ConstructorArguments [0].Value as string; + argument = attribute.ConstructorArguments[0].Value as string; return argument != null; } @@ -1632,7 +1634,7 @@ namespace Mono.Linker.Steps { HandleUnresolvedType (iface.InterfaceType); continue; } - + if (ShouldMarkInterfaceImplementation (type, iface, resolvedInterfaceType)) MarkInterfaceImplementation (iface, type); } @@ -1673,7 +1675,7 @@ namespace Mono.Linker.Steps { // if the type is never instantiated, interfaces will be removed if (@base.DeclaringType.IsInterface) continue; - + // If the type is marked, we need to keep overrides of abstract members defined in assemblies // that are copied. However, if the base method is virtual, then we don't need to keep the override // until the type could be instantiated @@ -1689,7 +1691,7 @@ namespace Mono.Linker.Steps { return false; } - + bool IsVirtualNeededByInstantiatedTypeDueToPreservedScope (MethodDefinition method) { if (!method.IsVirtual) @@ -1719,8 +1721,8 @@ namespace Mono.Linker.Steps { if (parameters.Count != 2) return false; - return parameters [0].ParameterType.Name == "SerializationInfo" && - parameters [1].ParameterType.Name == "StreamingContext"; + return parameters[0].ParameterType.Name == "SerializationInfo" && + parameters[1].ParameterType.Name == "StreamingContext"; } internal protected bool MarkMethodsIf (Collection<MethodDefinition> methods, Func<MethodDefinition, bool> predicate, in DependencyInfo reason) @@ -1765,7 +1767,7 @@ namespace Mono.Linker.Steps { if (method.Body.CodeSize != 1) return true; - return method.Body.Instructions [0].OpCode.Code != Code.Ret; + return method.Body.Instructions[0].OpCode.Code != Code.Ret; } static bool HasOnSerializeAttribute (MethodDefinition method) @@ -1807,14 +1809,14 @@ namespace Mono.Linker.Steps { protected virtual bool AlwaysMarkTypeAsInstantiated (TypeDefinition td) { switch (td.Name) { - // These types are created from native code which means we are unable to track when they are instantiated - // Since these are such foundational types, let's take the easy route and just always assume an instance of one of these - // could exist - case "Delegate": - case "MulticastDelegate": - case "ValueType": - case "Enum": - return td.Namespace == "System"; + // These types are created from native code which means we are unable to track when they are instantiated + // Since these are such foundational types, let's take the easy route and just always assume an instance of one of these + // could exist + case "Delegate": + case "MulticastDelegate": + case "ValueType": + case "Enum": + return td.Namespace == "System"; } return false; @@ -1864,8 +1866,7 @@ namespace Mono.Linker.Steps { if (!fnptr.HasParameters) return; - for (int i = 0; i < fnptr.Parameters.Count; i++) - { + for (int i = 0; i < fnptr.Parameters.Count; i++) { MarkType (fnptr.Parameters[i].ParameterType, new DependencyInfo (DependencyKind.ParameterType, fnptr)); } } @@ -1897,8 +1898,8 @@ namespace Mono.Linker.Steps { return; for (int i = 0; i < arguments.Count; i++) { - var argument = arguments [i]; - var parameter = parameters [i]; + var argument = arguments[i]; + var parameter = parameters[i]; if (!parameter.HasDefaultConstructorConstraint) continue; @@ -2052,8 +2053,8 @@ namespace Mono.Linker.Steps { reason = new DependencyInfo (DependencyKind.MethodOnGenericInstance, reference); } -// if (IgnoreScope (reference.DeclaringType.Scope)) -// return; + // if (IgnoreScope (reference.DeclaringType.Scope)) + // return; MethodDefinition method = reference.Resolve (); @@ -2223,7 +2224,7 @@ namespace Mono.Linker.Steps { void MarkExplicitInterfaceImplementation (MethodDefinition method, MethodReference ov) { var resolvedOverride = ov.Resolve (); - + if (resolvedOverride == null) { HandleUnresolvedMethod (ov); return; @@ -2319,11 +2320,11 @@ namespace Mono.Linker.Steps { } } - void ProcessInteropMethod(MethodDefinition method) + void ProcessInteropMethod (MethodDefinition method) { TypeDefinition returnTypeDefinition = method.ReturnType.Resolve (); - if (!string.IsNullOrEmpty(_context.PInvokesListFile) && method.IsPInvokeImpl) { + if (!string.IsNullOrEmpty (_context.PInvokesListFile) && method.IsPInvokeImpl) { _context.PInvokes.Add (new PInvokeInfo { AssemblyName = method.DeclaringType.Module.Name, EntryPoint = method.PInvokeInfo.EntryPoint, @@ -2441,7 +2442,7 @@ namespace Mono.Linker.Steps { && !Annotations.IsInstantiated (body.Method.DeclaringType) && MethodBodyScanner.IsWorthConvertingToThrow (body); } - + partial void PostMarkMethodBody (MethodBody body); @@ -2461,56 +2462,56 @@ namespace Mono.Linker.Steps { protected virtual void MarkInstruction (Instruction instruction, MethodDefinition method, ref bool requiresReflectionMethodBodyScanner) { switch (instruction.OpCode.OperandType) { - case OperandType.InlineField: - switch (instruction.OpCode.Code) { - case Code.Stfld: // Field stores (Storing value to annotated field must be checked) - case Code.Stsfld: - case Code.Ldflda: // Field address loads (as those can be used to store values to annotated field and thus must be checked) - case Code.Ldsflda: - requiresReflectionMethodBodyScanner |= ReflectionMethodBodyScanner.RequiresReflectionMethodBodyScanner (_flowAnnotations, (FieldReference)instruction.Operand); - break; - - default: // Other field operations are not interesting as they don't need to be checked - break; - } - MarkField ((FieldReference)instruction.Operand, new DependencyInfo (DependencyKind.FieldAccess, method)); + case OperandType.InlineField: + switch (instruction.OpCode.Code) { + case Code.Stfld: // Field stores (Storing value to annotated field must be checked) + case Code.Stsfld: + case Code.Ldflda: // Field address loads (as those can be used to store values to annotated field and thus must be checked) + case Code.Ldsflda: + requiresReflectionMethodBodyScanner |= ReflectionMethodBodyScanner.RequiresReflectionMethodBodyScanner (_flowAnnotations, (FieldReference) instruction.Operand); break; - case OperandType.InlineMethod: { - DependencyKind dependencyKind = instruction.OpCode.Code switch - { - Code.Jmp => DependencyKind.DirectCall, - Code.Call => DependencyKind.DirectCall, - Code.Callvirt => DependencyKind.VirtualCall, - Code.Newobj => DependencyKind.Newobj, - Code.Ldvirtftn => DependencyKind.Ldvirtftn, - Code.Ldftn => DependencyKind.Ldftn, - _ => throw new Exception ($"unexpected opcode {instruction.OpCode}") - }; - requiresReflectionMethodBodyScanner |= ReflectionMethodBodyScanner.RequiresReflectionMethodBodyScanner (_flowAnnotations, (MethodReference)instruction.Operand); - MarkMethod ((MethodReference)instruction.Operand, new DependencyInfo (dependencyKind, method)); - break; - } - - case OperandType.InlineTok: { - object token = instruction.Operand; - Debug.Assert (instruction.OpCode.Code == Code.Ldtoken); - var reason = new DependencyInfo (DependencyKind.Ldtoken, method); - if (token is TypeReference typeReference) { - MarkType (typeReference, reason); - } else if (token is MethodReference methodReference) { - MarkMethod (methodReference, reason); - } else { - MarkField ((FieldReference)token, reason); - } - break; - } + default: // Other field operations are not interesting as they don't need to be checked + break; + } + MarkField ((FieldReference) instruction.Operand, new DependencyInfo (DependencyKind.FieldAccess, method)); + break; - case OperandType.InlineType: - MarkType ((TypeReference)instruction.Operand, new DependencyInfo (DependencyKind.InstructionTypeRef, method)); + case OperandType.InlineMethod: { + DependencyKind dependencyKind = instruction.OpCode.Code switch + { + Code.Jmp => DependencyKind.DirectCall, + Code.Call => DependencyKind.DirectCall, + Code.Callvirt => DependencyKind.VirtualCall, + Code.Newobj => DependencyKind.Newobj, + Code.Ldvirtftn => DependencyKind.Ldvirtftn, + Code.Ldftn => DependencyKind.Ldftn, + _ => throw new Exception ($"unexpected opcode {instruction.OpCode}") + }; + requiresReflectionMethodBodyScanner |= ReflectionMethodBodyScanner.RequiresReflectionMethodBodyScanner (_flowAnnotations, (MethodReference) instruction.Operand); + MarkMethod ((MethodReference) instruction.Operand, new DependencyInfo (dependencyKind, method)); break; - default: + } + + case OperandType.InlineTok: { + object token = instruction.Operand; + Debug.Assert (instruction.OpCode.Code == Code.Ldtoken); + var reason = new DependencyInfo (DependencyKind.Ldtoken, method); + if (token is TypeReference typeReference) { + MarkType (typeReference, reason); + } else if (token is MethodReference methodReference) { + MarkMethod (methodReference, reason); + } else { + MarkField ((FieldReference) token, reason); + } break; + } + + case OperandType.InlineType: + MarkType ((TypeReference) instruction.Operand, new DependencyInfo (DependencyKind.InstructionTypeRef, method)); + break; + default: + break; } } @@ -2595,7 +2596,7 @@ namespace Mono.Linker.Steps { // Starting at 1 because all patterns require at least 1 instruction backward lookup // for (var i = 1; i < instructions.Count; i++) { - var instruction = instructions [i]; + var instruction = instructions[i]; if (instruction.OpCode != OpCodes.Call && instruction.OpCode != OpCodes.Callvirt) continue; @@ -2605,7 +2606,8 @@ namespace Mono.Linker.Steps { } } - protected class AttributeProviderPair { + protected class AttributeProviderPair + { public AttributeProviderPair (CustomAttribute attribute, ICustomAttributeProvider provider) { Attribute = attribute; diff --git a/src/linker/Linker.Steps/OutputStep.cs b/src/linker/Linker.Steps/OutputStep.cs index 22b31be66..8ade14a28 100644 --- a/src/linker/Linker.Steps/OutputStep.cs +++ b/src/linker/Linker.Steps/OutputStep.cs @@ -35,12 +35,15 @@ using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Cecil.PE; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public class OutputStep : BaseStep { + public class OutputStep : BaseStep + { private static Dictionary<UInt16, TargetArchitecture> architectureMap; - private enum NativeOSOverride { + private enum NativeOSOverride + { Apple = 0x4644, FreeBSD = 0xadc4, Linux = 0x7b79, @@ -50,7 +53,8 @@ namespace Mono.Linker.Steps { readonly List<string> assembliesWritten; - public OutputStep () { + public OutputStep () + { assembliesWritten = new List<string> (); } @@ -61,7 +65,7 @@ namespace Mono.Linker.Steps { foreach (var os in Enum.GetValues (typeof (NativeOSOverride))) { ushort osVal = (ushort) (NativeOSOverride) os; foreach (var arch in Enum.GetValues (typeof (TargetArchitecture))) { - ushort archVal = (ushort) (TargetArchitecture)arch; + ushort archVal = (ushort) (TargetArchitecture) arch; architectureMap.Add ((ushort) (archVal ^ osVal), (TargetArchitecture) arch); } } @@ -163,7 +167,7 @@ namespace Mono.Linker.Steps { { if (Context.PInvokesListFile == null) return; - + using (var fs = File.Open (Path.Combine (Context.OutputDirectory, Context.PInvokesListFile), FileMode.Create)) { Context.PInvokes.Distinct (); Context.PInvokes.Sort (); @@ -172,7 +176,7 @@ namespace Mono.Linker.Steps { } } - protected virtual void DeleteAssembly(AssemblyDefinition assembly, string directory) + protected virtual void DeleteAssembly (AssemblyDefinition assembly, string directory) { var target = GetAssemblyFileName (assembly, directory); if (File.Exists (target)) { @@ -292,7 +296,8 @@ namespace Mono.Linker.Steps { CopyFileAndRemoveReadOnly (pdb, Path.ChangeExtension (target, "pdb")); } - static void CopyFileAndRemoveReadOnly (string src, string dest) { + static void CopyFileAndRemoveReadOnly (string src, string dest) + { File.Copy (src, dest, true); System.IO.FileAttributes attrs = File.GetAttributes (dest); diff --git a/src/linker/Linker.Steps/PreserveCalendarsStep.cs b/src/linker/Linker.Steps/PreserveCalendarsStep.cs index 41c360d04..329429def 100644 --- a/src/linker/Linker.Steps/PreserveCalendarsStep.cs +++ b/src/linker/Linker.Steps/PreserveCalendarsStep.cs @@ -1,7 +1,9 @@ using Mono.Cecil; -namespace Mono.Linker.Steps { - public class PreserveCalendarsStep : IStep { +namespace Mono.Linker.Steps +{ + public class PreserveCalendarsStep : IStep + { readonly I18nAssemblies I18n; LinkContext context; diff --git a/src/linker/Linker.Steps/PreserveDependencyLookupStep.cs b/src/linker/Linker.Steps/PreserveDependencyLookupStep.cs index d3a12b29a..9d3eb8d8d 100644 --- a/src/linker/Linker.Steps/PreserveDependencyLookupStep.cs +++ b/src/linker/Linker.Steps/PreserveDependencyLookupStep.cs @@ -30,8 +30,10 @@ using System; using Mono.Cecil; using Mono.Collections.Generic; -namespace Mono.Linker.Steps { - public class PreserveDependencyLookupStep : LoadReferencesStep { +namespace Mono.Linker.Steps +{ + public class PreserveDependencyLookupStep : LoadReferencesStep + { protected override void ProcessAssembly (AssemblyDefinition assembly) { var module = assembly.MainModule; @@ -86,7 +88,7 @@ namespace Mono.Linker.Steps { if (ca.ConstructorArguments.Count != 3) continue; - if (!(ca.ConstructorArguments [2].Value is string assemblyName)) + if (!(ca.ConstructorArguments[2].Value is string assemblyName)) continue; var newDependency = Context.Resolve (new AssemblyNameReference (assemblyName, new Version ())); diff --git a/src/linker/Linker.Steps/RegenerateGuidStep.cs b/src/linker/Linker.Steps/RegenerateGuidStep.cs index 6b2558e83..e5af8a0f8 100644 --- a/src/linker/Linker.Steps/RegenerateGuidStep.cs +++ b/src/linker/Linker.Steps/RegenerateGuidStep.cs @@ -30,9 +30,11 @@ using System; using Mono.Cecil; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public class RegenerateGuidStep : BaseStep { + public class RegenerateGuidStep : BaseStep + { protected override void ProcessAssembly (AssemblyDefinition assembly) { diff --git a/src/linker/Linker.Steps/RemoveFeaturesStep.cs b/src/linker/Linker.Steps/RemoveFeaturesStep.cs index d5967a9d5..ce21ac5b7 100644 --- a/src/linker/Linker.Steps/RemoveFeaturesStep.cs +++ b/src/linker/Linker.Steps/RemoveFeaturesStep.cs @@ -20,7 +20,7 @@ namespace Mono.Linker.Steps // public bool FeatureGlobalization { get; set; } - readonly static string[] MonoCollationResources = new [] { + readonly static string[] MonoCollationResources = new[] { "collation.cjkCHS.bin", "collation.cjkCHT.bin", "collation.cjkJA.bin", @@ -87,7 +87,7 @@ namespace Mono.Linker.Steps foreach (var field in type.Fields) RemoveCustomAttributes (field); - + foreach (var method in type.Methods) RemoveCustomAttributes (method); @@ -239,33 +239,27 @@ namespace Mono.Linker.Steps var annotations = Context.Annotations; - switch (type.Name) - { - case "SimpleCollator": - if (type.Namespace == "Mono.Globalization.Unicode") - { - foreach (var method in type.Methods) - { - if (MethodBodyScanner.IsWorthConvertingToThrow (method.Body)) - annotations.SetAction(method, MethodAction.ConvertToThrow); - } + switch (type.Name) { + case "SimpleCollator": + if (type.Namespace == "Mono.Globalization.Unicode") { + foreach (var method in type.Methods) { + if (MethodBodyScanner.IsWorthConvertingToThrow (method.Body)) + annotations.SetAction (method, MethodAction.ConvertToThrow); } + } - break; - case "CompareInfo": - if (type.Namespace == "System.Globalization") - { - foreach (var method in type.Methods) - { - if (method.Name == "get_UseManagedCollation") - { - annotations.SetAction(method, MethodAction.ConvertToStub); - break; - } + break; + case "CompareInfo": + if (type.Namespace == "System.Globalization") { + foreach (var method in type.Methods) { + if (method.Name == "get_UseManagedCollation") { + annotations.SetAction (method, MethodAction.ConvertToStub); + break; } } + } - break; + break; } } @@ -277,7 +271,7 @@ namespace Mono.Linker.Steps var attrsToRemove = provider.CustomAttributes.Where (IsCustomAttributeExcluded).ToArray (); foreach (var remove in attrsToRemove) provider.CustomAttributes.Remove (remove); - + return attrsToRemove.Length > 0; } diff --git a/src/linker/Linker.Steps/RemoveSecurityStep.cs b/src/linker/Linker.Steps/RemoveSecurityStep.cs index 20870f659..21cc61cbc 100644 --- a/src/linker/Linker.Steps/RemoveSecurityStep.cs +++ b/src/linker/Linker.Steps/RemoveSecurityStep.cs @@ -1,8 +1,10 @@ using System.Linq; using Mono.Cecil; -namespace Mono.Linker.Steps { - public class RemoveSecurityStep : BaseStep { +namespace Mono.Linker.Steps +{ + public class RemoveSecurityStep : BaseStep + { protected override void ProcessAssembly (AssemblyDefinition assembly) { if (Annotations.GetAction (assembly) == AssemblyAction.Link) { diff --git a/src/linker/Linker.Steps/RemoveUnreachableBlocksStep.cs b/src/linker/Linker.Steps/RemoveUnreachableBlocksStep.cs index 93bad9631..f53776c72 100644 --- a/src/linker/Linker.Steps/RemoveUnreachableBlocksStep.cs +++ b/src/linker/Linker.Steps/RemoveUnreachableBlocksStep.cs @@ -69,7 +69,7 @@ namespace Mono.Linker.Steps case MethodAction.ConvertToStub: var instruction = CodeRewriterStep.CreateConstantResultInstruction (Context, method); if (instruction != null) - constExprMethods [method] = instruction; + constExprMethods[method] = instruction; continue; } @@ -85,7 +85,7 @@ namespace Mono.Linker.Steps var analyzer = new ConstantExpressionMethodAnalyzer (method); if (analyzer.Analyze ()) { - constExprMethods [method] = analyzer.Result; + constExprMethods[method] = analyzer.Result; } } @@ -152,7 +152,7 @@ namespace Mono.Linker.Steps // var analyzer = new ConstantExpressionMethodAnalyzer (method, reducer.FoldedInstructions); if (analyzer.Analyze ()) { - constExprMethods [method] = analyzer.Result; + constExprMethods[method] = analyzer.Result; } } @@ -163,11 +163,11 @@ namespace Mono.Linker.Steps Instruction targetResult; for (int i = 0; i < instructions.Count; ++i) { - var instr = instructions [i]; + var instr = instructions[i]; switch (instr.OpCode.Code) { case Code.Call: - var target = (MethodReference)instr.Operand; + var target = (MethodReference) instr.Operand; var md = target.Resolve (); if (md == null) break; @@ -186,7 +186,7 @@ namespace Mono.Linker.Steps break; case Code.Ldsfld: - var ftarget = (FieldReference)instr.Operand; + var ftarget = (FieldReference) instr.Operand; var field = ftarget.Resolve (); if (field == null) break; @@ -274,9 +274,9 @@ namespace Mono.Linker.Steps // Tracks mapping for replaced instructions for easier // branch targets resolution later - mapping [Body.Instructions [index]] = index; + mapping[Body.Instructions[index]] = index; - FoldedInstructions [index] = newInstruction; + FoldedInstructions[index] = newInstruction; } void RewriteConditionToNop (int index) @@ -336,7 +336,7 @@ namespace Mono.Linker.Steps int removed = 0; for (int i = 0; i < reachable.Count; ++i) { - if (reachable [i]) + if (reachable[i]) continue; processor.RemoveAt (i - removed); @@ -357,7 +357,7 @@ namespace Mono.Linker.Steps // easier processing later (makes the mapping straigh-forward). // for (int i = 0; i < FoldedInstructions.Count; ++i) { - var instr = FoldedInstructions [i]; + var instr = FoldedInstructions[i]; var opcode = instr.OpCode; if (opcode.FlowControl == FlowControl.Cond_Branch) { @@ -373,7 +373,7 @@ namespace Mono.Linker.Steps RewriteToNop (i - 1); if (IsComparisonAlwaysTrue (opcode, lint, rint)) { - Rewrite (i, Instruction.Create (OpCodes.Br, (Instruction)instr.Operand)); + Rewrite (i, Instruction.Create (OpCodes.Br, (Instruction) instr.Operand)); } else { RewriteConditionToNop (i); } @@ -386,7 +386,7 @@ namespace Mono.Linker.Steps } if (opcode.StackBehaviourPop == StackBehaviour.Popi) { - if (i > 0 && GetConstantValue (FoldedInstructions [i - 1], out var operand)) { + if (i > 0 && GetConstantValue (FoldedInstructions[i - 1], out var operand)) { if (operand is int opint) { if (IsJumpTargetRange (i, i)) continue; @@ -394,7 +394,7 @@ namespace Mono.Linker.Steps RewriteToNop (i - 1); if (IsConstantBranch (opcode, opint)) { - Rewrite (i, Instruction.Create (OpCodes.Br, (Instruction)instr.Operand)); + Rewrite (i, Instruction.Create (OpCodes.Br, (Instruction) instr.Operand)); } else { RewriteConditionToNop (i); } @@ -408,14 +408,14 @@ namespace Mono.Linker.Steps continue; RewriteToNop (i - 1); - Rewrite (i, Instruction.Create (OpCodes.Br, (Instruction)instr.Operand)); + Rewrite (i, Instruction.Create (OpCodes.Br, (Instruction) instr.Operand)); changed = true; continue; } } // Common pattern generated by C# compiler in debug mode - if (i > 3 && GetConstantValue (FoldedInstructions [i - 3], out operand) && operand is int opint2 && IsPairedStlocLdloc (FoldedInstructions [i - 2], FoldedInstructions [i - 1])) { + if (i > 3 && GetConstantValue (FoldedInstructions[i - 3], out operand) && operand is int opint2 && IsPairedStlocLdloc (FoldedInstructions[i - 2], FoldedInstructions[i - 1])) { if (IsJumpTargetRange (i - 2, i)) continue; @@ -424,7 +424,7 @@ namespace Mono.Linker.Steps RewriteToNop (i - 1); if (IsConstantBranch (opcode, opint2)) { - Rewrite (i, Instruction.Create (OpCodes.Br, (Instruction)instr.Operand)); + Rewrite (i, Instruction.Create (OpCodes.Br, (Instruction) instr.Operand)); } else { RewriteConditionToNop (i); } @@ -495,15 +495,15 @@ namespace Mono.Linker.Steps int i = 0; while (true) { while (i < FoldedInstructions.Count) { - if (reachable [i]) + if (reachable[i]) break; - reachable [i] = true; - var instr = FoldedInstructions [i++]; + reachable[i] = true; + var instr = FoldedInstructions[i++]; switch (instr.OpCode.FlowControl) { case FlowControl.Branch: - target = (Instruction)instr.Operand; + target = (Instruction) instr.Operand; i = GetInstructionIndex (target); continue; @@ -579,7 +579,7 @@ namespace Mono.Linker.Steps static bool HasAnyBitSet (BitArray bitArray, int startIndex, int endIndex) { for (int i = startIndex; i <= endIndex; ++i) { - if (bitArray [i]) + if (bitArray[i]) return true; } @@ -607,8 +607,8 @@ namespace Mono.Linker.Steps if (index < 2) return false; - return GetConstantValue (FoldedInstructions [index - 2], out left) && - GetConstantValue (FoldedInstructions [index - 1], out right); + return GetConstantValue (FoldedInstructions[index - 2], out left) && + GetConstantValue (FoldedInstructions[index - 1], out right); } static bool GetConstantValue (Instruction instruction, out object value) @@ -645,13 +645,13 @@ namespace Mono.Linker.Steps value = -1; return true; case Code.Ldc_I4: - value = (int)instruction.Operand; + value = (int) instruction.Operand; return true; case Code.Ldc_I4_S: - value = (int)(sbyte)instruction.Operand; + value = (int) (sbyte) instruction.Operand; return true; case Code.Ldc_I8: - value = (long)instruction.Operand; + value = (long) instruction.Operand; return true; case Code.Ldnull: value = null; @@ -676,7 +676,7 @@ namespace Mono.Linker.Steps case Code.Stloc_S: case Code.Stloc: if (second.OpCode.Code == Code.Ldloc_S || second.OpCode.Code == Code.Ldloc) - return ((VariableDefinition)first.Operand).Index == ((VariableDefinition)second.Operand).Index; + return ((VariableDefinition) first.Operand).Index == ((VariableDefinition) second.Operand).Index; break; } @@ -746,7 +746,7 @@ namespace Mono.Linker.Steps if (index >= firstInstr && index <= lastInstr) return true; } else { - foreach (var rtarget in (Instruction [])instr.Operand) { + foreach (var rtarget in (Instruction[]) instr.Operand) { var index = GetInstructionIndex (rtarget); if (index >= firstInstr && index <= lastInstr) return true; @@ -801,7 +801,7 @@ namespace Mono.Linker.Steps // Keep original leave to correctly mark handler exit // int index = instrs.IndexOf (handlerEnd); - reachable [index] = true; + reachable[index] = true; break; default: Debug.Fail ("Exception handler without leave instruction"); @@ -815,18 +815,18 @@ namespace Mono.Linker.Steps // which will remain same during replacement processing // for (int i = 0; i < instrs.Count; ++i) { - if (reachable [i]) + if (reachable[i]) continue; - var instr = instrs [i]; + var instr = instrs[i]; switch (instr.OpCode.Code) { case Code.Nop: - reachable [i] = true; + reachable[i] = true; continue; case Code.Ret: if (i == instrs.Count - 1) - reachable [i] = true; + reachable[i] = true; break; } @@ -846,10 +846,10 @@ namespace Mono.Linker.Steps // var instrs = body.Instructions; for (int i = 0; i < instrs.Count; ++i) { - if (reachable [i]) + if (reachable[i]) continue; - var instr = instrs [i]; + var instr = instrs[i]; Instruction newInstr; if (i == instrs.Count - 1) { @@ -883,7 +883,7 @@ namespace Mono.Linker.Steps foreach (int instrIndex in conditionInstrsToRemove) { var index = instrIndex + bodyExpansion; - var instr = instrs [index]; + var instr = instrs[index]; switch (instr.OpCode.StackBehaviourPop) { case StackBehaviour.Pop1_pop1: @@ -893,7 +893,7 @@ namespace Mono.Linker.Steps // // One of the operands is most likely constant and could just be removed instead of additional pop // - if (index > 0 && IsSideEffectFreeLoad (instrs [index - 1])) { + if (index > 0 && IsSideEffectFreeLoad (instrs[index - 1])) { var nop = Instruction.Create (OpCodes.Nop); if (sentinelNops == null) @@ -960,7 +960,7 @@ namespace Mono.Linker.Steps body_variables.RemoveAt (index); } else { var objectType = BCL.FindPredefinedType ("System", "Object", context); - body_variables [index].VariableType = objectType ?? throw new NotSupportedException ("Missing predefined 'System.Object' type"); + body_variables[index].VariableType = objectType ?? throw new NotSupportedException ("Missing predefined 'System.Object' type"); } } } @@ -979,16 +979,16 @@ namespace Mono.Linker.Steps switch (instruction.OpCode.Code) { case Code.Stloc_0: case Code.Ldloc_0: - return body.Variables [0]; + return body.Variables[0]; case Code.Stloc_1: case Code.Ldloc_1: - return body.Variables [1]; + return body.Variables[1]; case Code.Stloc_2: case Code.Ldloc_2: - return body.Variables [2]; + return body.Variables[2]; case Code.Stloc_3: case Code.Ldloc_3: - return body.Variables [3]; + return body.Variables[3]; } if (instruction.Operand is VariableReference vr) @@ -1086,7 +1086,7 @@ namespace Mono.Linker.Steps case Code.Br_S: case Code.Br: - jmpTarget = (Instruction)instr.Operand; + jmpTarget = (Instruction) instr.Operand; continue; case Code.Ldc_I4: @@ -1138,7 +1138,7 @@ namespace Mono.Linker.Steps continue; case Code.Ldloc: case Code.Ldloc_S: - vr = (VariableReference)instr.Operand; + vr = (VariableReference) instr.Operand; linstr = GetLocalsValue (vr.Index, body); if (linstr == null) return false; @@ -1159,7 +1159,7 @@ namespace Mono.Linker.Steps continue; case Code.Stloc_S: case Code.Stloc: - vr = (VariableReference)instr.Operand; + vr = (VariableReference) instr.Operand; StoreToLocals (vr.Index); continue; @@ -1214,7 +1214,7 @@ namespace Mono.Linker.Steps Instruction GetLocalsValue (int index, MethodBody body) { - var instr = locals? [index]; + var instr = locals?[index]; if (instr != null) return instr; @@ -1222,7 +1222,7 @@ namespace Mono.Linker.Steps return null; // local variables don't need to be explicitly initialized - return CodeRewriterStep.CreateConstantResultInstruction (body.Variables [index].VariableType); + return CodeRewriterStep.CreateConstantResultInstruction (body.Variables[index].VariableType); } void PushOnStack (Instruction instruction) @@ -1238,7 +1238,7 @@ namespace Mono.Linker.Steps if (locals == null) locals = new Dictionary<int, Instruction> (); - locals [index] = stack_instr.Pop (); + locals[index] = stack_instr.Pop (); } } } diff --git a/src/linker/Linker.Steps/ResolveFromAssemblyStep.cs b/src/linker/Linker.Steps/ResolveFromAssemblyStep.cs index 08868fa3f..8a1dde773 100644 --- a/src/linker/Linker.Steps/ResolveFromAssemblyStep.cs +++ b/src/linker/Linker.Steps/ResolveFromAssemblyStep.cs @@ -137,7 +137,8 @@ namespace Mono.Linker.Steps static void MarkType (LinkContext context, TypeDefinition type, RootVisibility rootVisibility) { - bool markType = rootVisibility switch { + bool markType = rootVisibility switch + { RootVisibility.PublicAndFamilyAndAssembly => !type.IsNestedPrivate, RootVisibility.PublicAndFamily => type.IsPublic || type.IsNestedPublic || type.IsNestedFamily || type.IsNestedFamilyOrAssembly, _ => true @@ -171,7 +172,8 @@ namespace Mono.Linker.Steps static void MarkFields (LinkContext context, Collection<FieldDefinition> fields, RootVisibility rootVisibility) { foreach (FieldDefinition field in fields) { - bool markField = rootVisibility switch { + bool markField = rootVisibility switch + { RootVisibility.PublicAndFamily => field.IsPublic || field.IsFamily || field.IsFamilyOrAssembly, RootVisibility.PublicAndFamilyAndAssembly => field.IsPublic || field.IsFamily || field.IsFamilyOrAssembly || field.IsAssembly || field.IsFamilyAndAssembly, _ => true @@ -190,7 +192,8 @@ namespace Mono.Linker.Steps static void MarkMethod (LinkContext context, MethodDefinition method, MethodAction action, RootVisibility rootVisibility) { - bool markMethod = rootVisibility switch { + bool markMethod = rootVisibility switch + { RootVisibility.PublicAndFamily => method.IsPublic || method.IsFamily || method.IsFamilyOrAssembly, RootVisibility.PublicAndFamilyAndAssembly => method.IsPublic || method.IsFamily || method.IsFamilyOrAssembly || method.IsAssembly || method.IsFamilyAndAssembly, _ => true diff --git a/src/linker/Linker.Steps/ResolveFromXmlStep.cs b/src/linker/Linker.Steps/ResolveFromXmlStep.cs index 529d48f72..9e88fadfb 100644 --- a/src/linker/Linker.Steps/ResolveFromXmlStep.cs +++ b/src/linker/Linker.Steps/ResolveFromXmlStep.cs @@ -36,16 +36,19 @@ using System.Xml.XPath; using Mono.Cecil; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public class XmlResolutionException : Exception { + public class XmlResolutionException : Exception + { public XmlResolutionException (string message, Exception innerException) : base (message, innerException) { } } - public class ResolveFromXmlStep : ResolveStep { + public class ResolveFromXmlStep : ResolveStep + { static readonly string _signature = "signature"; static readonly string _fullname = "fullname"; @@ -84,7 +87,7 @@ namespace Mono.Linker.Steps { // This step can be created with XML files that aren't necessarily // linker descriptor files. So bail if we don't have a <linker> element. - if (!nav.MoveToChild("linker", _ns)) + if (!nav.MoveToChild ("linker", _ns)) return; try { @@ -238,7 +241,7 @@ namespace Mono.Linker.Steps { if (IsExcluded (nav)) return; #endif - + TypePreserve preserve = GetTypePreserve (nav); if (preserve != TypePreserve.Nothing) Annotations.SetPreserve (type, preserve); @@ -249,11 +252,11 @@ namespace Mono.Linker.Steps { if (!required) return; - if (Annotations.IsMarked (type)) { - var existingLevel = Annotations.TryGetPreserve (type, out TypePreserve existingPreserve) ? existingPreserve : TypePreserve.Nothing; - var duplicateLevel = preserve != TypePreserve.Nothing ? preserve : nav.HasChildren ? TypePreserve.Nothing : TypePreserve.All; - Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {type.FullName} ({existingLevel}). Duplicate uses ({duplicateLevel})"); - } + if (Annotations.IsMarked (type)) { + var existingLevel = Annotations.TryGetPreserve (type, out TypePreserve existingPreserve) ? existingPreserve : TypePreserve.Nothing; + var duplicateLevel = preserve != TypePreserve.Nothing ? preserve : nav.HasChildren ? TypePreserve.Nothing : TypePreserve.All; + Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {type.FullName} ({existingLevel}). Duplicate uses ({duplicateLevel})"); + } Annotations.Mark (type, new DependencyInfo (DependencyKind.XmlDescriptor, _xmlDocumentLocation)); @@ -336,7 +339,7 @@ namespace Mono.Linker.Steps { if (IsExcluded (iterator.Current)) return; #endif - + string value = GetSignature (iterator.Current); if (!String.IsNullOrEmpty (value)) ProcessFieldSignature (type, value); @@ -361,7 +364,7 @@ namespace Mono.Linker.Steps { { if (Annotations.IsMarked (field)) Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {field.FullName}"); - + Context.Annotations.Mark (field, new DependencyInfo (DependencyKind.XmlDescriptor, _xmlDocumentLocation)); } @@ -404,7 +407,7 @@ namespace Mono.Linker.Steps { if (IsExcluded (iterator.Current)) return; #endif - + string value = GetSignature (iterator.Current); if (!String.IsNullOrEmpty (value)) ProcessMethodSignature (type, value, required); @@ -427,7 +430,7 @@ namespace Mono.Linker.Steps { void MarkMethod (TypeDefinition type, MethodDefinition method, bool required) { - if (Annotations.IsMarked (method)) + if (Annotations.IsMarked (method)) Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {method.FullName}"); Annotations.Mark (method, new DependencyInfo (DependencyKind.XmlDescriptor, _xmlDocumentLocation)); @@ -483,7 +486,7 @@ namespace Mono.Linker.Steps { if (i > 0) sb.Append (","); - sb.Append (meth.Parameters [i].ParameterType.FullName); + sb.Append (meth.Parameters[i].ParameterType.FullName); } } sb.Append (")"); @@ -599,7 +602,7 @@ namespace Mono.Linker.Steps { { if (Annotations.IsMarked (property)) Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {property.FullName}"); - + Annotations.Mark (property, new DependencyInfo (DependencyKind.XmlDescriptor, _xmlDocumentLocation)); MarkPropertyAccessors (type, property, accessors, required); @@ -617,7 +620,7 @@ namespace Mono.Linker.Steps { MarkMethod (type, property.GetMethod, required); else if (property.GetMethod == null) AddUnresolveMarker (string.Format ("T: {0}' M: {1} get_{2}", type, property.PropertyType, property.Name)); - + if (property.SetMethod != null && Array.IndexOf (accessors, "set") >= 0) MarkMethod (type, property.SetMethod, required); else if (property.SetMethod == null) @@ -691,7 +694,7 @@ namespace Mono.Linker.Steps { { string accessorsValue = GetAttribute (nav, _accessors); - if (accessorsValue != null) { + if (accessorsValue != null) { string[] accessors = accessorsValue.Split ( _accessorsSep, StringSplitOptions.RemoveEmptyEntries); @@ -709,7 +712,7 @@ namespace Mono.Linker.Steps { { return nav.GetAttribute (attribute, _ns); } - + #if !FEATURE_ILLINK protected virtual bool IsExcluded (XPathNavigator nav) { diff --git a/src/linker/Linker.Steps/ResolveStep.cs b/src/linker/Linker.Steps/ResolveStep.cs index 49503f936..6057360c7 100644 --- a/src/linker/Linker.Steps/ResolveStep.cs +++ b/src/linker/Linker.Steps/ResolveStep.cs @@ -28,9 +28,11 @@ using System.Collections.Generic; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public abstract class ResolveStep : BaseStep { + public abstract class ResolveStep : BaseStep + { readonly List<string> _unResolved; @@ -39,12 +41,11 @@ namespace Mono.Linker.Steps { _unResolved = new List<string> (); } - public bool AllMarkerResolved - { + public bool AllMarkerResolved { get { return _unResolved.Count == 0; } } - public string [] GetUnresolvedMarkers () + public string[] GetUnresolvedMarkers () { return _unResolved.ToArray (); } diff --git a/src/linker/Linker.Steps/SweepStep.cs b/src/linker/Linker.Steps/SweepStep.cs index 940f724c1..000ce0f36 100644 --- a/src/linker/Linker.Steps/SweepStep.cs +++ b/src/linker/Linker.Steps/SweepStep.cs @@ -33,11 +33,12 @@ using Mono.Cecil; using Mono.Collections.Generic; using Mono.Cecil.Cil; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ public class SweepStep : BaseStep { - AssemblyDefinition [] assemblies; + AssemblyDefinition[] assemblies; readonly bool sweepSymbols; readonly HashSet<AssemblyDefinition> BypassNGenToSave = new HashSet<AssemblyDefinition> (); @@ -193,7 +194,7 @@ namespace Mono.Linker.Steps { var resources = assembly.MainModule.Resources; for (int i = 0; i < resources.Count; i++) { - if (!(resources [i] is EmbeddedResource resource)) + if (!(resources[i] is EmbeddedResource resource)) continue; if (resourcesToRemove.Contains (resource.Name)) @@ -211,7 +212,7 @@ namespace Mono.Linker.Steps { var references = assembly.MainModule.AssemblyReferences; for (int i = 0; i < references.Count; i++) { - var reference = references [i]; + var reference = references[i]; AssemblyDefinition ad = Context.Resolver.Resolve (reference); if (ad == null || !AreSameReference (ad.Name, referenceToRemove.Name)) @@ -337,7 +338,7 @@ namespace Mono.Linker.Steps { static void UpdateCustomAttributesTypesScopes (TypeDefinition typeDefinition) { - UpdateCustomAttributesTypesScopes ((ICustomAttributeProvider)typeDefinition); + UpdateCustomAttributesTypesScopes ((ICustomAttributeProvider) typeDefinition); if (typeDefinition.HasEvents) UpdateCustomAttributesTypesScopes (typeDefinition.Events); @@ -484,11 +485,11 @@ namespace Mono.Linker.Steps { protected void SweepNestedTypes (TypeDefinition type) { for (int i = 0; i < type.NestedTypes.Count; i++) { - var nested = type.NestedTypes [i]; + var nested = type.NestedTypes[i]; if (Annotations.IsMarked (nested)) { SweepType (nested); } else { - ElementRemoved (type.NestedTypes [i]); + ElementRemoved (type.NestedTypes[i]); type.NestedTypes.RemoveAt (i--); } } @@ -497,7 +498,7 @@ namespace Mono.Linker.Steps { protected void SweepInterfaces (TypeDefinition type) { for (int i = type.Interfaces.Count - 1; i >= 0; i--) { - var iface = type.Interfaces [i]; + var iface = type.Interfaces[i]; if (Annotations.IsMarked (iface)) { SweepCustomAttributes (iface); continue; @@ -551,7 +552,8 @@ namespace Mono.Linker.Steps { return false; if (definition.Namespace == "System.Security") { - return definition.FullName switch { + return definition.FullName switch + { // This seems to be one attribute in the System.Security namespace that doesn't count // as an attribute that requires HasSecurity to be true "System.Security.SecurityCriticalAttribute" => false, @@ -567,15 +569,15 @@ namespace Mono.Linker.Steps { protected IList<CustomAttribute> SweepCustomAttributes (ICustomAttributeProvider provider) { - var removed = new List<CustomAttribute>(); + var removed = new List<CustomAttribute> (); for (int i = provider.CustomAttributes.Count - 1; i >= 0; i--) { - var attribute = provider.CustomAttributes [i]; + var attribute = provider.CustomAttributes[i]; if (Annotations.IsMarked (attribute)) { UpdateForwardedTypesScope (attribute); } else { CustomAttributeUsageRemoved (provider, attribute); - removed.Add (provider.CustomAttributes [i]); + removed.Add (provider.CustomAttributes[i]); provider.CustomAttributes.RemoveAt (i); } } @@ -631,7 +633,7 @@ namespace Mono.Linker.Steps { if (scope.HasConstants) { var constants = scope.Constants; for (int i = 0; i < constants.Count; ++i) { - if (!Annotations.IsMarked (constants [i].ConstantType)) + if (!Annotations.IsMarked (constants[i].ConstantType)) constants.RemoveAt (i--); } } @@ -641,7 +643,7 @@ namespace Mono.Linker.Steps { if (import.HasTargets) { var targets = import.Targets; for (int i = 0; i < targets.Count; ++i) { - var ttype = targets [i].Type; + var ttype = targets[i].Type; if (ttype != null && !Annotations.IsMarked (ttype)) targets.RemoveAt (i--); @@ -657,11 +659,11 @@ namespace Mono.Linker.Steps { protected void SweepCollectionWithCustomAttributes<T> (IList<T> list) where T : ICustomAttributeProvider { for (int i = 0; i < list.Count; i++) - if (ShouldRemove (list [i])) { - ElementRemoved (list [i]); + if (ShouldRemove (list[i])) { + ElementRemoved (list[i]); list.RemoveAt (i--); } else { - SweepCustomAttributes (list [i]); + SweepCustomAttributes (list[i]); } } @@ -670,8 +672,8 @@ namespace Mono.Linker.Steps { bool removed = false; for (int i = 0; i < list.Count; i++) { - if (ShouldRemove (list [i])) { - ElementRemoved (list [i]); + if (ShouldRemove (list[i])) { + ElementRemoved (list[i]); list.RemoveAt (i--); removed = true; } diff --git a/src/linker/Linker.Steps/TypeMapStep.cs b/src/linker/Linker.Steps/TypeMapStep.cs index b8c2db250..1038753a7 100644 --- a/src/linker/Linker.Steps/TypeMapStep.cs +++ b/src/linker/Linker.Steps/TypeMapStep.cs @@ -29,9 +29,11 @@ using System.Collections.Generic; using Mono.Cecil; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public class TypeMapStep : BaseStep { + public class TypeMapStep : BaseStep + { protected override void ProcessAssembly (AssemblyDefinition assembly) { @@ -62,7 +64,7 @@ namespace Mono.Linker.Steps { var resolved = iface.InterfaceType.Resolve (); if (resolved == null) continue; - + Annotations.AddDerivedInterfaceForInterface (resolved, type); } } @@ -98,14 +100,14 @@ namespace Mono.Linker.Steps { static MethodReference CreateGenericInstanceCandidate (Inflater.GenericContext context, TypeDefinition candidateType, MethodDefinition interfaceMethod) { - var methodReference = new MethodReference (interfaceMethod.Name, interfaceMethod.ReturnType, candidateType) {HasThis = interfaceMethod.HasThis}; - + var methodReference = new MethodReference (interfaceMethod.Name, interfaceMethod.ReturnType, candidateType) { HasThis = interfaceMethod.HasThis }; + foreach (var genericMethodParameter in interfaceMethod.GenericParameters) methodReference.GenericParameters.Add (new GenericParameter (genericMethodParameter.Name, methodReference)); - + if (interfaceMethod.ReturnType.IsGenericParameter || interfaceMethod.ReturnType.IsGenericInstance) methodReference.ReturnType = Inflater.InflateType (context, interfaceMethod.ReturnType); - + foreach (var p in interfaceMethod.Parameters) { var parameterType = p.ParameterType; if (parameterType.IsGenericParameter || parameterType.IsGenericInstance) @@ -219,7 +221,7 @@ namespace Mono.Linker.Steps { TypeReference @base = type.GetInflatedBaseType (); while (@base != null) { var candidate = CreateGenericInstanceCandidate (context, @base.Resolve (), interfaceMethod); - + MethodDefinition base_method = TryMatchMethod (@base, candidate); if (base_method != null) return base_method; @@ -333,7 +335,7 @@ namespace Mono.Linker.Steps { return false; for (int i = 0; i < gaa.Count; i++) { - if (!TypeMatch (gaa [i], gab [i])) + if (!TypeMatch (gaa[i], gab[i])) return false; } diff --git a/src/linker/Linker/Annotations.cs b/src/linker/Linker/Annotations.cs index 7f0a98f0f..9e305cac6 100644 --- a/src/linker/Linker/Annotations.cs +++ b/src/linker/Linker/Annotations.cs @@ -32,9 +32,11 @@ using System.Diagnostics; using Mono.Cecil; using Mono.Cecil.Cil; -namespace Mono.Linker { +namespace Mono.Linker +{ - public partial class AnnotationStore { + public partial class AnnotationStore + { protected readonly LinkContext context; @@ -53,14 +55,14 @@ namespace Mono.Linker { protected readonly Dictionary<MethodDefinition, List<MethodDefinition>> base_methods = new Dictionary<MethodDefinition, List<MethodDefinition>> (); protected readonly Dictionary<AssemblyDefinition, ISymbolReader> symbol_readers = new Dictionary<AssemblyDefinition, ISymbolReader> (); protected readonly Dictionary<TypeDefinition, List<TypeDefinition>> class_type_base_hierarchy = new Dictionary<TypeDefinition, List<TypeDefinition>> (); - protected readonly Dictionary<TypeDefinition, List<TypeDefinition>> derived_interfaces = new Dictionary<TypeDefinition, List<TypeDefinition>>(); + protected readonly Dictionary<TypeDefinition, List<TypeDefinition>> derived_interfaces = new Dictionary<TypeDefinition, List<TypeDefinition>> (); readonly Dictionary<object, Dictionary<IMetadataTokenProvider, object>> custom_annotations = new Dictionary<object, Dictionary<IMetadataTokenProvider, object>> (); protected readonly Dictionary<AssemblyDefinition, HashSet<string>> resources_to_remove = new Dictionary<AssemblyDefinition, HashSet<string>> (); protected readonly HashSet<CustomAttribute> marked_attributes = new HashSet<CustomAttribute> (); readonly HashSet<TypeDefinition> marked_types_with_cctor = new HashSet<TypeDefinition> (); protected readonly HashSet<TypeDefinition> marked_instantiated = new HashSet<TypeDefinition> (); - protected readonly HashSet<MethodDefinition> indirectly_called = new HashSet<MethodDefinition>(); + protected readonly HashSet<MethodDefinition> indirectly_called = new HashSet<MethodDefinition> (); public AnnotationStore (LinkContext context) => this.context = context; @@ -95,7 +97,7 @@ namespace Mono.Linker { if (assembly_actions.TryGetValue (assembly, out AssemblyAction action)) return action; - throw new InvalidOperationException($"No action for the assembly {assembly.Name} defined"); + throw new InvalidOperationException ($"No action for the assembly {assembly.Name} defined"); } public MethodAction GetAction (MethodDefinition method) @@ -108,7 +110,7 @@ namespace Mono.Linker { public void SetAction (AssemblyDefinition assembly, AssemblyAction action) { - assembly_actions [assembly] = action; + assembly_actions[assembly] = action; } public bool HasAction (AssemblyDefinition assembly) @@ -118,17 +120,17 @@ namespace Mono.Linker { public void SetAction (MethodDefinition method, MethodAction action) { - method_actions [method] = action; + method_actions[method] = action; } public void SetMethodStubValue (MethodDefinition method, object value) { - method_stub_values [method] = value; + method_stub_values[method] = value; } public void SetFieldValue (FieldDefinition field, object value) { - field_values [field] = value; + field_values[field] = value; } public void SetSubstitutedInit (FieldDefinition field) @@ -233,7 +235,7 @@ namespace Mono.Linker { public void SetPreserve (TypeDefinition type, TypePreserve preserve) { if (preserved_types.TryGetValue (type, out TypePreserve existing)) - preserved_types [type] = ChoosePreserveActionWhichPreservesTheMost (existing, preserve); + preserved_types[type] = ChoosePreserveActionWhichPreservesTheMost (existing, preserve); else preserved_types.Add (type, preserve); } @@ -293,7 +295,7 @@ namespace Mono.Linker { public void AddResourceToRemove (AssemblyDefinition assembly, string name) { if (!resources_to_remove.TryGetValue (assembly, out HashSet<string> resources)) - resources = resources_to_remove [assembly] = new HashSet<string> (); + resources = resources_to_remove[assembly] = new HashSet<string> (); resources.Add (name); } @@ -329,7 +331,7 @@ namespace Mono.Linker { var methods = GetBaseMethods (method); if (methods == null) { methods = new List<MethodDefinition> (); - base_methods [method] = methods; + base_methods[method] = methods; } methods.Add (@base); @@ -376,7 +378,7 @@ namespace Mono.Linker { var methods = GetPreservedMethods (definition); if (methods == null) { methods = new List<MethodDefinition> (); - preserved_methods [definition] = methods; + preserved_methods[definition] = methods; } methods.Add (method); @@ -384,7 +386,7 @@ namespace Mono.Linker { public void AddSymbolReader (AssemblyDefinition assembly, ISymbolReader symbolReader) { - symbol_readers [assembly] = symbolReader; + symbol_readers[assembly] = symbolReader; } public void CloseSymbolReader (AssemblyDefinition assembly) @@ -414,7 +416,7 @@ namespace Mono.Linker { custom_annotations.Add (key, slots); } - slots [item] = value; + slots[item] = value; } public bool HasPreservedStaticCtor (TypeDefinition type) @@ -429,7 +431,7 @@ namespace Mono.Linker { public void SetClassHierarchy (TypeDefinition type, List<TypeDefinition> bases) { - class_type_base_hierarchy [type] = bases; + class_type_base_hierarchy[type] = bases; } public List<TypeDefinition> GetClassHierarchy (TypeDefinition type) @@ -449,16 +451,16 @@ namespace Mono.Linker { throw new ArgumentException ($"{nameof (derived)} must be an interface"); if (!derived_interfaces.TryGetValue (@base, out List<TypeDefinition> derivedInterfaces)) - derived_interfaces [@base] = derivedInterfaces = new List<TypeDefinition> (); - - derivedInterfaces.Add(derived); + derived_interfaces[@base] = derivedInterfaces = new List<TypeDefinition> (); + + derivedInterfaces.Add (derived); } public List<TypeDefinition> GetDerivedInterfacesForInterface (TypeDefinition @interface) { if (!@interface.IsInterface) throw new ArgumentException ($"{nameof (@interface)} must be an interface"); - + if (derived_interfaces.TryGetValue (@interface, out List<TypeDefinition> derivedInterfaces)) return derivedInterfaces; diff --git a/src/linker/Linker/ArrayBuilder.cs b/src/linker/Linker/ArrayBuilder.cs index 1dbf767fd..0d7e3b6a4 100644 --- a/src/linker/Linker/ArrayBuilder.cs +++ b/src/linker/Linker/ArrayBuilder.cs @@ -15,7 +15,7 @@ namespace Mono.Linker public bool Any (Predicate<T> callback) => _list?.Exists (callback) == true; - public T [] ToArray () => _list?.ToArray (); + public T[] ToArray () => _list?.ToArray (); public int Count => _list?.Count ?? 0; } diff --git a/src/linker/Linker/AssemblyAction.cs b/src/linker/Linker/AssemblyAction.cs index 341339cd1..9a4ebd5ff 100644 --- a/src/linker/Linker/AssemblyAction.cs +++ b/src/linker/Linker/AssemblyAction.cs @@ -26,9 +26,11 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -namespace Mono.Linker { +namespace Mono.Linker +{ - public enum AssemblyAction { + public enum AssemblyAction + { // Ignore the assembly Skip, // Copy the existing files, assembly and symbols, into the output destination. E.g. .dll and .mdb diff --git a/src/linker/Linker/AssemblyResolver.cs b/src/linker/Linker/AssemblyResolver.cs index 9a423ab77..2d3c45640 100644 --- a/src/linker/Linker/AssemblyResolver.cs +++ b/src/linker/Linker/AssemblyResolver.cs @@ -32,12 +32,14 @@ using System.IO; using Mono.Cecil; using Mono.Collections.Generic; -namespace Mono.Linker { +namespace Mono.Linker +{ #if FEATURE_ILLINK public class AssemblyResolver : DirectoryAssemblyResolver { #else - public class AssemblyResolver : BaseAssemblyResolver { + public class AssemblyResolver : BaseAssemblyResolver + { #endif readonly Dictionary<string, AssemblyDefinition> _assemblies; @@ -83,7 +85,7 @@ namespace Mono.Linker { } #endif - public string GetAssemblyFileName(AssemblyDefinition assembly) + public string GetAssemblyFileName (AssemblyDefinition assembly) { #if FEATURE_ILLINK if (assemblyToPath.TryGetValue(assembly, out string path)) { @@ -113,7 +115,7 @@ namespace Mono.Linker { return null; } - public AssemblyDefinition ResolveFromPath(string path, ReaderParameters parameters) + public AssemblyDefinition ResolveFromPath (string path, ReaderParameters parameters) { return CacheAssembly (GetAssembly (path, parameters)); } @@ -135,7 +137,7 @@ namespace Mono.Linker { if (asm == null) asm = base.Resolve (name, parameters); - _assemblies [name.Name] = asm; + _assemblies[name.Name] = asm; } catch (AssemblyResolutionException) { if (!_ignoreUnresolved) throw; @@ -151,8 +153,8 @@ namespace Mono.Linker { public virtual AssemblyDefinition CacheAssembly (AssemblyDefinition assembly) { - _assemblies [assembly.Name.Name] = assembly; - base.AddSearchDirectory (Path.GetDirectoryName (GetAssemblyFileName(assembly))); + _assemblies[assembly.Name.Name] = assembly; + base.AddSearchDirectory (Path.GetDirectoryName (GetAssemblyFileName (assembly))); return assembly; } diff --git a/src/linker/Linker/AssemblyUtilities.cs b/src/linker/Linker/AssemblyUtilities.cs index 66409d202..62a128413 100644 --- a/src/linker/Linker/AssemblyUtilities.cs +++ b/src/linker/Linker/AssemblyUtilities.cs @@ -1,9 +1,11 @@ using System; using Mono.Cecil; -namespace Mono.Linker { +namespace Mono.Linker +{ - public static class AssemblyUtilities { + public static class AssemblyUtilities + { public static bool IsCrossgened (this ModuleDefinition module) { diff --git a/src/linker/Linker/BCL.cs b/src/linker/Linker/BCL.cs index 74b866ee4..c069474a2 100644 --- a/src/linker/Linker/BCL.cs +++ b/src/linker/Linker/BCL.cs @@ -60,7 +60,7 @@ namespace Mono.Linker return true; } - static readonly string[] corlibNames = new [] { + static readonly string[] corlibNames = new[] { "mscorlib", "System.Runtime", "System.Private.CoreLib", diff --git a/src/linker/Linker/DependencyInfo.cs b/src/linker/Linker/DependencyInfo.cs index 73dc41c03..5a4d6453a 100644 --- a/src/linker/Linker/DependencyInfo.cs +++ b/src/linker/Linker/DependencyInfo.cs @@ -2,29 +2,30 @@ using System; namespace Mono.Linker { - public enum DependencyKind { - // For tracking any other kinds of dependencies in extensions to the core logic + public enum DependencyKind + { + // For tracking any other kinds of dependencies in extensions to the core logic Custom = -1, // the source is reserved to carry any dependency information tracked by the extender - // For use when we don't care about tracking a particular dependency + // For use when we don't care about tracking a particular dependency Unspecified = 0, // currently unused - // Entry points to the analysis + // Entry points to the analysis AssemblyAction = 1, // assembly action -> entry assembly RootAssembly = 2, // assembly -> entry type XmlDescriptor = 3, // xml document -> entry member - // Attributes on assemblies are marked whether or not we keep - // the assembly, so mark these as entry points. + // Attributes on assemblies are marked whether or not we keep + // the assembly, so mark these as entry points. AssemblyOrModuleAttribute = 4, // assembly/module -> entry attribute - // Membership and containment relationships + // Membership and containment relationships NestedType = 5, // parent type -> nested type MemberOfType = 6, // type -> member DeclaringType = 7, // member -> type FieldOnGenericInstance = 8, // fieldref on instantiated generic -> field on generic typedef MethodOnGenericInstance = 9, // methodref on instantiated generic -> method on generic typedef - // Type relationships + // Type relationships BaseType = 10, // type -> its base type FieldType = 11, // field -> its type ParameterType = 12, // method -> types of its parameters @@ -32,7 +33,7 @@ namespace Mono.Linker VariableType = 14, // method -> types of its variables CatchType = 15, // method -> types of its exception handlers - // Override relationships + // Override relationships BaseMethod = 16, // override -> base method Override = 17, // base method -> override MethodImplOverride = 18, // method -> .override on the method @@ -40,7 +41,7 @@ namespace Mono.Linker MethodForInstantiatedType = 20, // type -> methods kept because type is instantiated or scope requires it BaseDefaultCtorForStubbedMethod = 21, // stubbed method -> default ctor of base type - // Generic type relationships + // Generic type relationships GenericArgumentType = 22, // generic instance -> argument type GenericParameterConstraintType = 23, // generic typedef/methoddef -> parameter constraint type DefaultCtorForNewConstrainedGenericArgument = 24, // generic instance -> argument ctor @@ -48,29 +49,29 @@ namespace Mono.Linker ElementMethod = 26, // generic method instantiation -> generic methoddef ModifierType = 27, // modified type -> type modifier - // Modules and assemblies + // Modules and assemblies ScopeOfType = 28, // type -> module/assembly TypeInAssembly = 29, // assembly -> type ModuleOfExportedType = 30, // exported type -> module ExportedType = 31, // type -> exported type - // Grouping of property/event methods + // Grouping of property/event methods PropertyOfPropertyMethod = 32, // property method -> its property EventOfEventMethod = 33, // event method -> its event EventMethod = 34, // event -> its event methods - // PropertyMethod doesn't exist because property methods aren't always marked for a property + // PropertyMethod doesn't exist because property methods aren't always marked for a property - // Interface implementations + // Interface implementations InterfaceImplementationInterfaceType = 35, // interfaceimpl -> interface type InterfaceImplementationOnType = 36, // type -> interfaceimpl on it - // Interop methods + // Interop methods ReturnTypeMarshalSpec = 37, // interop method -> marshal spec of its return type ParameterMarshalSpec = 38, // interop method -> marshal spec of its parameters FieldMarshalSpec = 39, // field -> its marshal spec InteropMethodDependency = 40, // interop method -> required members of its parameters, return type, declaring type - // Dependencies created by instructions + // Dependencies created by instructions DirectCall = 41, // method -> method VirtualCall = 42, // method -> method Ldvirtftn = 43, // method -> method @@ -80,41 +81,41 @@ namespace Mono.Linker FieldAccess = 47, // method -> field (for instructions that load/store fields) InstructionTypeRef = 48, // other instructions that have an inline type token (method -> type) - // Custom attributes on various providers + // Custom attributes on various providers CustomAttribute = 49, // attribute provider (type/field/method/etc...) -> attribute on it ParameterAttribute = 50, // method parameter -> attribute on it ReturnTypeAttribute = 51, // method return type -> attribute on it GenericParameterCustomAttribute = 52, // generic parameter -> attribute on it GenericParameterConstraintCustomAttribute = 53, // generic parameter constraint -> attribute on it - // Dependencies of custom attributes + // Dependencies of custom attributes AttributeConstructor = 54, // attribute -> its ctor - // used for security attributes, where we mark the type/properties directly + // used for security attributes, where we mark the type/properties directly AttributeType = 55, // attribute -> attribute type AttributeProperty = 56, // attribute -> attribute property CustomAttributeArgumentType = 57, // attribute -> type of an argument to the attribute ctor CustomAttributeArgumentValue = 58, // attribute -> type passed as an argument to the attribute ctor CustomAttributeField = 59, // attribute -> field on the attribute - // Tracking cctors + // Tracking cctors TriggersCctorThroughFieldAccess = 60, // field-accessing method -> cctor of field's declaring type TriggersCctorForCalledMethod = 61, // caller method -> callee method type cctor DeclaringTypeOfCalledMethod = 62, // called method -> its declaring type (used to track when a cctor is triggered by a method call) CctorForType = 63, // type -> cctor of type CctorForField = 64, // field -> cctor of field's declaring type - // Tracking instantiations + // Tracking instantiations InstantiatedByCtor = 65, // ctor -> its declaring type (indicating that it was marked instantiated due to the ctor) OverrideOnInstantiatedType = 66, // instantiated type -> override method on the type - // Linker-specific behavior (preservation hints, patterns, user inputs, linker outputs, etc.) + // Linker-specific behavior (preservation hints, patterns, user inputs, linker outputs, etc.) PreservedDependency = 67, // PreserveDependency attribute -> member AccessedViaReflection = 68, // method -> detected member accessed via reflection from that method PreservedMethod = 69, // type/method -> preserved method (explicitly preserved in Annotations by XML or other steps) TypePreserve = 70, // type -> field/method preserved for the type (explicitly set in Annotations by XML or other steps) DisablePrivateReflection = 71, // type/method -> DisablePrivateReflection attribute added by linkerf - // Built-in knowledge of special runtime/diagnostic subsystems + // Built-in knowledge of special runtime/diagnostic subsystems // XmlSchemaProvider, DebuggerDisplay, DebuggerTypeProxy, SoapHeader, TypeDescriptionProvider ReferencedBySpecialAttribute = 72, // attribute -> referenced members KeptForSpecialAttribute = 73, // attribute -> kept members (used when the members are not explicitly referenced) @@ -122,13 +123,14 @@ namespace Mono.Linker EventSourceProviderField = 75, // EventSource derived type -> fields on nested Keywords/Tasks/Opcodes provider classes MethodForSpecialType = 76, // type -> methods kept (currently used for MulticastDelegate) - // Linker internals, requirements for certain optimizations + // Linker internals, requirements for certain optimizations UnreachableBodyRequirement = 77, // method -> well-known type required for unreachable bodies optimization DisablePrivateReflectionRequirement = 78, // null -> DisablePrivateReflectionAttribute type/methods (note that no specific source is reported) AlreadyMarked = 79, // null -> member that has already been marked for a particular reason (used to propagate reasons internally, not reported) } - readonly public struct DependencyInfo : IEquatable<DependencyInfo> { + readonly public struct DependencyInfo : IEquatable<DependencyInfo> + { public DependencyKind Kind { get; } public object Source { get; } public DependencyInfo (DependencyKind kind, object source) => (Kind, Source) = (kind, source); @@ -137,7 +139,7 @@ namespace Mono.Linker public static readonly DependencyInfo DisablePrivateReflectionRequirement = new DependencyInfo (DependencyKind.DisablePrivateReflectionRequirement, null); public bool Equals (DependencyInfo other) => (Kind, Source) == (other.Kind, other.Source); public override bool Equals (Object obj) => obj is DependencyInfo info && this.Equals (info); - public override int GetHashCode() => (Kind, Source).GetHashCode (); + public override int GetHashCode () => (Kind, Source).GetHashCode (); public static bool operator == (DependencyInfo lhs, DependencyInfo rhs) => lhs.Equals (rhs); public static bool operator != (DependencyInfo lhs, DependencyInfo rhs) => !lhs.Equals (rhs); } diff --git a/src/linker/Linker/Driver.cs b/src/linker/Linker/Driver.cs index 880275471..22e92578d 100644 --- a/src/linker/Linker/Driver.cs +++ b/src/linker/Linker/Driver.cs @@ -35,9 +35,11 @@ using System.Xml.XPath; using Mono.Linker.Steps; -namespace Mono.Linker { +namespace Mono.Linker +{ - public partial class Driver : IDisposable { + public partial class Driver : IDisposable + { #if FEATURE_ILLINK const string resolvers = "-a|-r|-x"; @@ -47,7 +49,7 @@ namespace Mono.Linker { static readonly string _linker = "Mono IL Linker"; #endif - public static int Main (string [] args) + public static int Main (string[] args) { return Execute (args); } @@ -113,7 +115,7 @@ namespace Mono.Linker { var responseFileText = rawResponseFileText.Trim (); int idx = 0; while (idx < responseFileText.Length) { - while (idx < responseFileText.Length && char.IsWhiteSpace (responseFileText [idx])) { + while (idx < responseFileText.Length && char.IsWhiteSpace (responseFileText[idx])) { idx++; } if (idx == responseFileText.Length) { @@ -124,13 +126,13 @@ namespace Mono.Linker { while (true) { bool copyChar = true; int numBackslash = 0; - while (idx < responseFileText.Length && responseFileText [idx] == '\\') { + while (idx < responseFileText.Length && responseFileText[idx] == '\\') { numBackslash++; idx++; } - if (idx < responseFileText.Length && responseFileText [idx] == '"') { - if ( (numBackslash % 2) == 0) { - if (inquote && (idx + 1) < responseFileText.Length && responseFileText [idx + 1] == '"') { + if (idx < responseFileText.Length && responseFileText[idx] == '"') { + if ((numBackslash % 2) == 0) { + if (inquote && (idx + 1) < responseFileText.Length && responseFileText[idx + 1] == '"') { idx++; } else { copyChar = false; @@ -140,11 +142,11 @@ namespace Mono.Linker { numBackslash /= 2; } argBuilder.Append (new String ('\\', numBackslash)); - if (idx == responseFileText.Length || (!inquote && Char.IsWhiteSpace (responseFileText [idx]))) { + if (idx == responseFileText.Length || (!inquote && Char.IsWhiteSpace (responseFileText[idx]))) { break; } if (copyChar) { - argBuilder.Append (responseFileText [idx]); + argBuilder.Append (responseFileText[idx]); } idx++; } @@ -204,7 +206,7 @@ namespace Mono.Linker { // // Handling of --value like options // - if (token [0] == '-' && token [1] == '-') { + if (token[0] == '-' && token[1] == '-') { switch (token) { case "--skip-unresolved": if (!GetBoolParam (token, l => context.IgnoreUnresolved = context.Resolver.IgnoreUnresolved = l)) @@ -296,13 +298,13 @@ namespace Mono.Linker { } var arg = arguments.Dequeue (); - string [] values = arg.Split ('='); + string[] values = arg.Split ('='); if (values?.Length != 2) { Console.WriteLine ($"Value used with '--custom-data' has to be in the KEY=VALUE format"); return -1; } - context.SetCustomData (values [0], values [1]); + context.SetCustomData (values[0], values[1]); continue; case "--keep-facades": @@ -323,47 +325,44 @@ namespace Mono.Linker { continue; - case "--disable-opt": - { - string optName = null; - if (!GetStringParam (token, l => optName = l)) - return -1; + case "--disable-opt": { + string optName = null; + if (!GetStringParam (token, l => optName = l)) + return -1; - if (!GetOptimizationName (optName, out var opt)) - return -1; + if (!GetOptimizationName (optName, out var opt)) + return -1; - string assemblyName = GetNextStringValue (); - set_optimizations.Add ((opt, assemblyName, false)); + string assemblyName = GetNextStringValue (); + set_optimizations.Add ((opt, assemblyName, false)); - continue; - } - case "--enable-opt": - { - string optName = null; - if (!GetStringParam (token, l => optName = l)) - return -1; - - if (!GetOptimizationName (optName, out var opt)) - return -1; + continue; + } + case "--enable-opt": { + string optName = null; + if (!GetStringParam (token, l => optName = l)) + return -1; - string assemblyName = GetNextStringValue (); - set_optimizations.Add ((opt, assemblyName, true)); + if (!GetOptimizationName (optName, out var opt)) + return -1; - continue; - } - case "--feature": - { - string featureName = null; - if (!GetStringParam (token, l => featureName = l)) - return -1; + string assemblyName = GetNextStringValue (); + set_optimizations.Add ((opt, assemblyName, true)); - if (!GetBoolParam (token, value => { - context.SetFeatureValue (featureName, value); + continue; + } + case "--feature": { + string featureName = null; + if (!GetStringParam (token, l => featureName = l)) + return -1; + + if (!GetBoolParam (token, value => { + context.SetFeatureValue (featureName, value); })) - return -1; + return -1; - continue; - } + continue; + } case "--new-mvid": // // This is not same as --deterministic which calculates MVID @@ -398,20 +397,20 @@ namespace Mono.Linker { continue; - case "--attribute-defs": - if (arguments.Count < 1) { - ErrorMissingArgument (token); - return -1; - } + case "--attribute-defs": + if (arguments.Count < 1) { + ErrorMissingArgument (token); + return -1; + } - if (!GetStringParam (token, l => context.AddAttributeDefinitionFile (l))) - return -1; + if (!GetStringParam (token, l => context.AddAttributeDefinitionFile (l))) + return -1; - continue; + continue; - case "--version": - Version (); - return 1; + case "--version": + Version (); + return 1; case "--about": About (); @@ -419,7 +418,7 @@ namespace Mono.Linker { } } - if (token [0] == '-' || token [1] == '/') { + if (token[0] == '-' || token[1] == '/') { switch (token.Substring (1)) { case "d": @@ -453,7 +452,7 @@ namespace Mono.Linker { } AssemblyAction action = ParseAssemblyAction (arguments.Dequeue ()); - context.Actions [arguments.Dequeue ()] = action; + context.Actions[arguments.Dequeue ()] = action; continue; case "t": context.KeepTypeForwarderOnlyAssemblies = true; @@ -462,7 +461,7 @@ namespace Mono.Linker { if (!GetStringParam (token, l => { foreach (string file in GetFiles (l)) resolve_from_xml_steps.Push (file); - })) + })) return -1; resolver = true; @@ -471,7 +470,7 @@ namespace Mono.Linker { case "a": if (!GetStringParam (token, l => { - var rootVisibility = (token [1] == 'r') + var rootVisibility = (token[1] == 'r') ? ResolveFromAssemblyStep.RootVisibility.PublicAndFamily : ResolveFromAssemblyStep.RootVisibility.Any; foreach (string file in GetFiles (l)) @@ -486,7 +485,7 @@ namespace Mono.Linker { if (!GetStringParam (token, l => { foreach (string file in GetFiles (l)) resolve_from_xapi_steps.Push (file); - })) + })) return -1; resolver = true; @@ -605,7 +604,7 @@ namespace Mono.Linker { FeatureGlobalization = excluded_features.Contains ("globalization") }); - var excluded = new string [excluded_features.Count]; + var excluded = new string[excluded_features.Count]; excluded_features.CopyTo (excluded); context.ExcludedFeatures = excluded; } @@ -676,14 +675,14 @@ namespace Mono.Linker { partial void PreProcessPipeline (Pipeline pipeline); - private static Assembly GetCustomAssembly (string arg) { + private static Assembly GetCustomAssembly (string arg) + { if (Path.IsPathRooted (arg)) { var assemblyPath = Path.GetFullPath (arg); if (File.Exists (assemblyPath)) return Assembly.Load (File.ReadAllBytes (assemblyPath)); Console.WriteLine ($"The assembly '{arg}' specified for '--custom-step' option could not be found"); - } - else + } else Console.WriteLine ($"The path to the assembly '{arg}' specified for '--custom-step' must be fully qualified"); return null; @@ -731,13 +730,13 @@ namespace Mono.Linker { return false; } - if (!parts[0].StartsWith ("-") && !parts [0].StartsWith ("+")) { + if (!parts[0].StartsWith ("-") && !parts[0].StartsWith ("+")) { Console.WriteLine ($"Expected '+' or '-' to control new step insertion"); return false; } - bool before = parts [0][0] == '-'; - string name = parts [0].Substring (1); + bool before = parts[0][0] == '-'; + string name = parts[0].Substring (1); IStep target = FindStep (pipeline, name); if (target == null) { @@ -745,7 +744,7 @@ namespace Mono.Linker { return false; } - IStep newStep = ResolveStep (parts [1], custom_assembly); + IStep newStep = ResolveStep (parts[1], custom_assembly); if (newStep == null) return false; @@ -770,7 +769,7 @@ namespace Mono.Linker { static IStep ResolveStep (string type, Assembly assembly) { - Type step = assembly != null ? assembly.GetType(type) : Type.GetType (type, false); + Type step = assembly != null ? assembly.GetType (type) : Type.GetType (type, false); if (step == null) { Console.WriteLine ($"Custom step '{type}' could not be found"); @@ -785,16 +784,16 @@ namespace Mono.Linker { return (IStep) Activator.CreateInstance (step); } - static string [] GetFiles (string param) + static string[] GetFiles (string param) { - if (param.Length < 1 || param [0] != '@') - return new string [] {param}; + if (param.Length < 1 || param[0] != '@') + return new string[] { param }; string file = param.Substring (1); return ReadLines (file); } - static string [] ReadLines (string file) + static string[] ReadLines (string file) { var lines = new List<string> (); using (StreamReader reader = new StreamReader (file)) { @@ -809,7 +808,7 @@ namespace Mono.Linker { protected static I18nAssemblies ParseI18n (string str) { I18nAssemblies assemblies = I18nAssemblies.None; - string [] parts = str.Split (','); + string[] parts = str.Split (','); foreach (string part in parts) assemblies |= (I18nAssemblies) Enum.Parse (typeof (I18nAssemblies), part.Trim (), true); @@ -819,7 +818,7 @@ namespace Mono.Linker { AssemblyAction ParseAssemblyAction (string s) { - var assemblyAction = (AssemblyAction)Enum.Parse(typeof(AssemblyAction), s, true); + var assemblyAction = (AssemblyAction) Enum.Parse (typeof (AssemblyAction), s, true); // The AddBypassNGenStep is necessary if any actions (default or per-assembly) are AddBypassNGen(Used). // We enable this step as soon as we see such an action. Even if subsequent parameters change an action we have // already seen, the step will only operate on assemblies with a final action AddBypassNGen(Used). diff --git a/src/linker/Linker/FieldDefinitionExtensions.cs b/src/linker/Linker/FieldDefinitionExtensions.cs index 735513fb8..46425bc23 100644 --- a/src/linker/Linker/FieldDefinitionExtensions.cs +++ b/src/linker/Linker/FieldDefinitionExtensions.cs @@ -8,7 +8,7 @@ namespace Mono.Linker { static class FieldDefinitionExtensions { - public static bool IsCompilerGenerated(this FieldDefinition field) + public static bool IsCompilerGenerated (this FieldDefinition field) { if (!field.HasCustomAttributes) return false; diff --git a/src/linker/Linker/I18nAssemblies.cs b/src/linker/Linker/I18nAssemblies.cs index a14c58fe2..8c79d5a86 100644 --- a/src/linker/Linker/I18nAssemblies.cs +++ b/src/linker/Linker/I18nAssemblies.cs @@ -28,10 +28,12 @@ using System; -namespace Mono.Linker { +namespace Mono.Linker +{ [Flags] - public enum I18nAssemblies { + public enum I18nAssemblies + { None = 0, diff --git a/src/linker/Linker/IXApiVisitor.cs b/src/linker/Linker/IXApiVisitor.cs index 204d699ee..53158c105 100644 --- a/src/linker/Linker/IXApiVisitor.cs +++ b/src/linker/Linker/IXApiVisitor.cs @@ -30,9 +30,11 @@ using System.Xml.XPath; using Mono.Cecil; -namespace Mono.Linker { +namespace Mono.Linker +{ - public interface IXApiVisitor { + public interface IXApiVisitor + { void OnAssembly (XPathNavigator nav, AssemblyDefinition assembly); void OnAttribute (XPathNavigator nav); diff --git a/src/linker/Linker/Inflater.cs b/src/linker/Linker/Inflater.cs index a1cb57ae2..65a4fc27c 100644 --- a/src/linker/Linker/Inflater.cs +++ b/src/linker/Linker/Inflater.cs @@ -3,43 +3,43 @@ using System.Collections.Generic; using System.Linq; using Mono.Cecil; -namespace Mono.Linker { - class Inflater { - public static TypeReference InflateType(GenericContext context, TypeReference typeReference) +namespace Mono.Linker +{ + class Inflater + { + public static TypeReference InflateType (GenericContext context, TypeReference typeReference) { - var typeDefinition = InflateTypeWithoutException(context, typeReference); + var typeDefinition = InflateTypeWithoutException (context, typeReference); if (typeDefinition == null) - throw new InvalidOperationException($"Unable to resolve a reference to the type '{typeReference.FullName}' in the assembly '{typeReference.Module.Assembly.FullName}'. Does this type exist in a different assembly in the project?"); - + throw new InvalidOperationException ($"Unable to resolve a reference to the type '{typeReference.FullName}' in the assembly '{typeReference.Module.Assembly.FullName}'. Does this type exist in a different assembly in the project?"); + return typeDefinition; } - - public static GenericInstanceType InflateType(GenericContext context, TypeDefinition typeDefinition) + + public static GenericInstanceType InflateType (GenericContext context, TypeDefinition typeDefinition) { - return ConstructGenericType(context, typeDefinition, typeDefinition.GenericParameters); + return ConstructGenericType (context, typeDefinition, typeDefinition.GenericParameters); } - - public static GenericInstanceType InflateType(GenericContext context, GenericInstanceType genericInstanceType) + + public static GenericInstanceType InflateType (GenericContext context, GenericInstanceType genericInstanceType) { - var inflatedType = ConstructGenericType(context, genericInstanceType.Resolve(), genericInstanceType.GenericArguments); + var inflatedType = ConstructGenericType (context, genericInstanceType.Resolve (), genericInstanceType.GenericArguments); inflatedType.MetadataToken = genericInstanceType.MetadataToken; return inflatedType; } - - public static TypeReference InflateTypeWithoutException(GenericContext context, TypeReference typeReference) + + public static TypeReference InflateTypeWithoutException (GenericContext context, TypeReference typeReference) { - if (typeReference is GenericParameter genericParameter) - { - if (context.Method == null && genericParameter.Type != GenericParameterType.Type) - { + if (typeReference is GenericParameter genericParameter) { + if (context.Method == null && genericParameter.Type != GenericParameterType.Type) { // If no method is specified assume only partial inflation is desired. return typeReference; } - + var genericArgumentType = genericParameter.Type == GenericParameterType.Type ? context.Type.GenericArguments[genericParameter.Position] : context.Method.GenericArguments[genericParameter.Position]; - + var inflatedType = genericArgumentType; return inflatedType; } @@ -47,30 +47,30 @@ namespace Mono.Linker { return InflateType (context, genericInstanceType); if (typeReference is ArrayType arrayType) - return new ArrayType(InflateType(context, arrayType.ElementType), arrayType.Rank); - + return new ArrayType (InflateType (context, arrayType.ElementType), arrayType.Rank); + if (typeReference is ByReferenceType byReferenceType) - return new ByReferenceType(InflateType(context, byReferenceType.ElementType)); - + return new ByReferenceType (InflateType (context, byReferenceType.ElementType)); + if (typeReference is PointerType pointerType) - return new PointerType(InflateType(context, pointerType.ElementType)); - + return new PointerType (InflateType (context, pointerType.ElementType)); + if (typeReference is RequiredModifierType reqModType) - return InflateTypeWithoutException(context, reqModType.ElementType); - + return InflateTypeWithoutException (context, reqModType.ElementType); + if (typeReference is OptionalModifierType optModType) - return InflateTypeWithoutException(context, optModType.ElementType); - - return typeReference.Resolve(); + return InflateTypeWithoutException (context, optModType.ElementType); + + return typeReference.Resolve (); } - - static GenericInstanceType ConstructGenericType(GenericContext context, TypeDefinition typeDefinition, IEnumerable<TypeReference> genericArguments) + + static GenericInstanceType ConstructGenericType (GenericContext context, TypeDefinition typeDefinition, IEnumerable<TypeReference> genericArguments) { - var inflatedType = new GenericInstanceType(typeDefinition); - + var inflatedType = new GenericInstanceType (typeDefinition); + foreach (var genericArgument in genericArguments) - inflatedType.GenericArguments.Add(InflateType(context, genericArgument)); - + inflatedType.GenericArguments.Add (InflateType (context, genericArgument)); + return inflatedType; } @@ -79,19 +79,17 @@ namespace Mono.Linker { private readonly GenericInstanceType _type; private readonly GenericInstanceMethod _method; - public GenericContext(GenericInstanceType type, GenericInstanceMethod method) + public GenericContext (GenericInstanceType type, GenericInstanceMethod method) { _type = type; _method = method; } - public GenericInstanceType Type - { + public GenericInstanceType Type { get { return _type; } } - public GenericInstanceMethod Method - { + public GenericInstanceMethod Method { get { return _method; } } } diff --git a/src/linker/Linker/KnownMembers.cs b/src/linker/Linker/KnownMembers.cs index 02dcf6469..c5ca3d122 100644 --- a/src/linker/Linker/KnownMembers.cs +++ b/src/linker/Linker/KnownMembers.cs @@ -13,7 +13,7 @@ namespace Mono.Linker if (!method.IsConstructor || method.IsStatic || !method.HasParameters) return false; - if (method.Parameters.Count != 1 || method.Parameters [0].ParameterType.MetadataType != MetadataType.String) + if (method.Parameters.Count != 1 || method.Parameters[0].ParameterType.MetadataType != MetadataType.String) return false; return true; diff --git a/src/linker/Linker/LinkContext.cs b/src/linker/Linker/LinkContext.cs index 79c21ba32..b2023826f 100644 --- a/src/linker/Linker/LinkContext.cs +++ b/src/linker/Linker/LinkContext.cs @@ -33,15 +33,18 @@ using System.IO; using Mono.Cecil; using Mono.Cecil.Cil; -namespace Mono.Linker { +namespace Mono.Linker +{ - public class UnintializedContextFactory { + public class UnintializedContextFactory + { virtual public AnnotationStore CreateAnnotationStore (LinkContext context) => new AnnotationStore (context); virtual public MarkingHelpers CreateMarkingHelpers (LinkContext context) => new MarkingHelpers (context); virtual public Tracer CreateTracer (LinkContext context) => new Tracer (context); } - public class LinkContext : IDisposable { + public class LinkContext : IDisposable + { readonly Pipeline _pipeline; AssemblyAction _coreAction; @@ -92,20 +95,17 @@ namespace Mono.Linker { set { _linkSymbols = value; } } - public bool KeepTypeForwarderOnlyAssemblies - { + public bool KeepTypeForwarderOnlyAssemblies { get { return _keepTypeForwarderOnlyAssemblies; } set { _keepTypeForwarderOnlyAssemblies = value; } } - public bool KeepMembersForDebugger - { + public bool KeepMembersForDebugger { get { return _keepMembersForDebugger; } set { _keepMembersForDebugger = value; } } - public bool IgnoreUnresolved - { + public bool IgnoreUnresolved { get { return _ignoreUnresolved; } set { _ignoreUnresolved = value; } } @@ -162,7 +162,7 @@ namespace Mono.Linker { public IReflectionPatternRecorder ReflectionPatternRecorder { get; set; } #if !FEATURE_ILLINK - public string [] ExcludedFeatures { get; set; } + public string[] ExcludedFeatures { get; set; } #endif public CodeOptimizationsSettings Optimizations { get; set; } @@ -176,8 +176,7 @@ namespace Mono.Linker { } public LinkContext (Pipeline pipeline, AssemblyResolver resolver) - : this(pipeline, resolver, new ReaderParameters - { + : this (pipeline, resolver, new ReaderParameters { AssemblyResolver = resolver }, new UnintializedContextFactory ()) { @@ -191,7 +190,7 @@ namespace Mono.Linker { _actions = new Dictionary<string, AssemblyAction> (); _parameters = new Dictionary<string, string> (StringComparer.Ordinal); _readerParameters = readerParameters; - + SymbolReaderProvider = new DefaultSymbolReaderProvider (false); if (factory == null) @@ -223,7 +222,7 @@ namespace Mono.Linker { return; } - FeatureSettings [feature] = value; + FeatureSettings[feature] = value; } public void AddAttributeDefinitionFile (string file) @@ -282,8 +281,7 @@ namespace Mono.Linker { RegisterAssembly (assembly); return assembly; - } - catch (Exception e) { + } catch (Exception e) { throw new AssemblyResolutionException (reference, e); } } @@ -312,7 +310,7 @@ namespace Mono.Linker { try { var symbolReader = _symbolReaderProvider.GetSymbolReader ( assembly.MainModule, - _resolver.GetAssemblyFileName(assembly)); + _resolver.GetAssemblyFileName (assembly)); if (symbolReader == null) return; @@ -353,7 +351,7 @@ namespace Mono.Linker { return reference; } - + public void SetAction (AssemblyDefinition assembly, AssemblyAction defaultAction) { RegisterAssembly (assembly); @@ -384,7 +382,7 @@ namespace Mono.Linker { case "mscorlib": case "Accessibility": case "Mono.Security": - // WPF + // WPF case "PresentationFramework": case "PresentationCore": case "WindowsBase": @@ -393,17 +391,17 @@ namespace Mono.Linker { case "PresentationUI": case "ReachFramework": case "netstandard": - return true; + return true; default: return name.Name.StartsWith ("System") || name.Name.StartsWith ("Microsoft"); } } - public virtual AssemblyDefinition [] GetAssemblies () + public virtual AssemblyDefinition[] GetAssemblies () { var cache = _resolver.AssemblyCache; - AssemblyDefinition [] asms = new AssemblyDefinition [cache.Count]; + AssemblyDefinition[] asms = new AssemblyDefinition[cache.Count]; cache.Values.CopyTo (asms, 0); return asms; } @@ -418,7 +416,7 @@ namespace Mono.Linker { public void SetCustomData (string key, string value) { - _parameters [key] = value; + _parameters[key] = value; } public bool HasCustomData (string key) @@ -512,7 +510,7 @@ namespace Mono.Linker { return; } - perAssembly [assemblyContext] |= optimizations; + perAssembly[assemblyContext] |= optimizations; } public void Disable (CodeOptimizations optimizations, string assemblyContext = null) @@ -527,7 +525,7 @@ namespace Mono.Linker { return; } - perAssembly [assemblyContext] &= ~optimizations; + perAssembly[assemblyContext] &= ~optimizations; } } @@ -535,7 +533,7 @@ namespace Mono.Linker { public enum CodeOptimizations { BeforeFieldInit = 1 << 0, - + /// <summary> /// Option to disable removal of overrides of virtual methods when a type is never instantiated /// @@ -543,7 +541,7 @@ namespace Mono.Linker { /// that do not get an instance constructor marked. /// </summary> OverrideRemoval = 1 << 1, - + /// <summary> /// Option to disable delaying marking of instance methods until an instance of that type could exist /// </summary> diff --git a/src/linker/Linker/MarkingHelpers.cs b/src/linker/Linker/MarkingHelpers.cs index 3d0dfb9a3..0fd829722 100644 --- a/src/linker/Linker/MarkingHelpers.cs +++ b/src/linker/Linker/MarkingHelpers.cs @@ -1,8 +1,10 @@ using System; using Mono.Cecil; -namespace Mono.Linker { - public class MarkingHelpers { +namespace Mono.Linker +{ + public class MarkingHelpers + { protected readonly LinkContext _context; public MarkingHelpers (LinkContext context) diff --git a/src/linker/Linker/MessageContainer.cs b/src/linker/Linker/MessageContainer.cs index c1da72455..cd50eac4d 100644 --- a/src/linker/Linker/MessageContainer.cs +++ b/src/linker/Linker/MessageContainer.cs @@ -101,9 +101,8 @@ namespace Mono.Linker if (!string.IsNullOrEmpty (Text)) sb.Append (": ").Append (Text); - } - else { - sb.Append (" " ).Append (Text); + } else { + sb.Append (" ").Append (Text); } // Expected output $"{Origin}: {SubCategory}{Category} IL{Code}: {Text}"); diff --git a/src/linker/Linker/MessageSubcategory.cs b/src/linker/Linker/MessageSubcategory.cs index ecd1c5afc..f2f442d98 100644 --- a/src/linker/Linker/MessageSubcategory.cs +++ b/src/linker/Linker/MessageSubcategory.cs @@ -2,7 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -namespace Mono.Linker { +namespace Mono.Linker +{ public static class MessageSubCategory { public const string None = ""; diff --git a/src/linker/Linker/MethodAction.cs b/src/linker/Linker/MethodAction.cs index a3550e783..6a4f40602 100644 --- a/src/linker/Linker/MethodAction.cs +++ b/src/linker/Linker/MethodAction.cs @@ -26,9 +26,11 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -namespace Mono.Linker { +namespace Mono.Linker +{ - public enum MethodAction { + public enum MethodAction + { Nothing, Parse, ForceParse, diff --git a/src/linker/Linker/MethodBodyScanner.cs b/src/linker/Linker/MethodBodyScanner.cs index 939bed5e2..7eb10ef44 100644 --- a/src/linker/Linker/MethodBodyScanner.cs +++ b/src/linker/Linker/MethodBodyScanner.cs @@ -4,14 +4,16 @@ using System.Linq; using Mono.Cecil; using Mono.Cecil.Cil; -namespace Mono.Linker { - public static class MethodBodyScanner { +namespace Mono.Linker +{ + public static class MethodBodyScanner + { public static bool IsWorthConvertingToThrow (MethodBody body) { // Some bodies are cheaper size wise to leave alone than to convert to a throw Instruction previousMeaningful = null; int meaningfulCount = 0; - foreach (var ins in body.Instructions) { + foreach (var ins in body.Instructions) { // Handle ignoring noops because because (1) it's a valid case to ignore // and (2) When running the tests on .net core roslyn tosses in no ops // and that leads to a difference in test results between mcs and .net framework csc. @@ -19,23 +21,23 @@ namespace Mono.Linker { continue; meaningfulCount++; - + if (meaningfulCount == 1 && ins.OpCode.Code == Code.Ret) return false; if (meaningfulCount == 2 && ins.OpCode.Code == Code.Ret && previousMeaningful != null) { if (previousMeaningful.OpCode.StackBehaviourPop == StackBehaviour.Pop0) { switch (previousMeaningful.OpCode.StackBehaviourPush) { - case StackBehaviour.Pushi: - case StackBehaviour.Pushi8: - case StackBehaviour.Pushr4: - case StackBehaviour.Pushr8: - return false; + case StackBehaviour.Pushi: + case StackBehaviour.Pushi8: + case StackBehaviour.Pushr4: + case StackBehaviour.Pushr8: + return false; } - + switch (previousMeaningful.OpCode.Code) { - case Code.Ldnull: - return false; + case Code.Ldnull: + return false; } } } @@ -82,7 +84,7 @@ namespace Mono.Linker { static HashSet<TypeDefinition> AllPossibleStackTypes (MethodDefinition method) { if (!method.HasBody) - throw new ArgumentException(); + throw new ArgumentException (); var body = method.Body; var types = new HashSet<TypeDefinition> (); @@ -90,7 +92,7 @@ namespace Mono.Linker { foreach (VariableDefinition var in body.Variables) AddIfResolved (types, var.VariableType); - foreach(var parameter in body.Method.Parameters) + foreach (var parameter in body.Method.Parameters) AddIfResolved (types, parameter.ParameterType); foreach (ExceptionHandler eh in body.ExceptionHandlers) { @@ -126,7 +128,7 @@ namespace Mono.Linker { return types; } - static void AddMatchingInterfaces (HashSet<(InterfaceImplementation, TypeDefinition)> results, TypeDefinition type, TypeDefinition [] interfaceTypes) + static void AddMatchingInterfaces (HashSet<(InterfaceImplementation, TypeDefinition)> results, TypeDefinition type, TypeDefinition[] interfaceTypes) { foreach (var interfaceType in interfaceTypes) { if (type.HasInterface (interfaceType, out InterfaceImplementation implementation)) diff --git a/src/linker/Linker/MethodDefinitionExtensions.cs b/src/linker/Linker/MethodDefinitionExtensions.cs index 0a45a8132..f5f6a7e67 100644 --- a/src/linker/Linker/MethodDefinitionExtensions.cs +++ b/src/linker/Linker/MethodDefinitionExtensions.cs @@ -2,7 +2,7 @@ namespace Mono.Linker { - public static class MethodDefinitionExtensions + public static class MethodDefinitionExtensions { public static bool IsDefaultConstructor (this MethodDefinition method) { @@ -81,7 +81,7 @@ namespace Mono.Linker return true; } - + public static void ClearDebugInformation (this MethodDefinition method) { // TODO: This always allocates, update when Cecil catches up diff --git a/src/linker/Linker/MethodReferenceExtensions.cs b/src/linker/Linker/MethodReferenceExtensions.cs index 55d6d1838..64d04e01d 100644 --- a/src/linker/Linker/MethodReferenceExtensions.cs +++ b/src/linker/Linker/MethodReferenceExtensions.cs @@ -19,9 +19,9 @@ namespace Mono.Linker public static TypeReference GetParameterType (this MethodReference method, int parameterIndex) { if (method.DeclaringType is GenericInstanceType genericInstance) - return TypeReferenceExtensions.InflateGenericType (genericInstance, method.Parameters [parameterIndex].ParameterType); + return TypeReferenceExtensions.InflateGenericType (genericInstance, method.Parameters[parameterIndex].ParameterType); - return method.Parameters [parameterIndex].ParameterType; + return method.Parameters[parameterIndex].ParameterType; } public static bool IsDeclaredOnType (this MethodReference method, string namespaceName, string typeName) @@ -31,7 +31,7 @@ namespace Mono.Linker public static bool HasParameterOfType (this MethodReference method, int parameterIndex, string namespaceName, string typeName) { - return method.Parameters.Count > parameterIndex && method.Parameters [parameterIndex].ParameterType.IsTypeOf (namespaceName, typeName); + return method.Parameters.Count > parameterIndex && method.Parameters[parameterIndex].ParameterType.IsTypeOf (namespaceName, typeName); } } } diff --git a/src/linker/Linker/OverrideInformation.cs b/src/linker/Linker/OverrideInformation.cs index 848199da3..1f223b8e8 100644 --- a/src/linker/Linker/OverrideInformation.cs +++ b/src/linker/Linker/OverrideInformation.cs @@ -1,9 +1,11 @@ using System.Diagnostics; using Mono.Cecil; -namespace Mono.Linker { +namespace Mono.Linker +{ [DebuggerDisplay ("{Override}")] - public class OverrideInformation { + public class OverrideInformation + { public OverrideInformation (MethodDefinition @base, MethodDefinition @override, InterfaceImplementation matchingInterfaceImplementation = null) { Base = @base; @@ -15,10 +17,8 @@ namespace Mono.Linker { public MethodDefinition Override { get; } public InterfaceImplementation MatchingInterfaceImplementation { get; } - public bool IsOverrideOfInterfaceMember - { - get - { + public bool IsOverrideOfInterfaceMember { + get { if (MatchingInterfaceImplementation != null) return true; @@ -26,10 +26,8 @@ namespace Mono.Linker { } } - public TypeDefinition InterfaceType - { - get - { + public TypeDefinition InterfaceType { + get { if (!IsOverrideOfInterfaceMember) return null; diff --git a/src/linker/Linker/Pipeline.cs b/src/linker/Linker/Pipeline.cs index 11fae6a7d..0aa5a3d1a 100644 --- a/src/linker/Linker/Pipeline.cs +++ b/src/linker/Linker/Pipeline.cs @@ -31,15 +31,17 @@ using System.Collections.Generic; using Mono.Linker.Steps; -namespace Mono.Linker { +namespace Mono.Linker +{ - public class Pipeline { + public class Pipeline + { readonly List<IStep> _steps; public Pipeline () { - _steps = new List<IStep>(); + _steps = new List<IStep> (); } public void PrependStep (IStep step) @@ -55,7 +57,7 @@ namespace Mono.Linker { public void AddStepBefore (Type target, IStep step) { for (int i = 0; i < _steps.Count; i++) { - if (target.IsInstanceOfType (_steps [i])) { + if (target.IsInstanceOfType (_steps[i])) { _steps.Insert (i, step); return; } @@ -67,7 +69,7 @@ namespace Mono.Linker { public void AddStepBefore (IStep target, IStep step) { for (int i = 0; i < _steps.Count; i++) { - if (_steps [i] == target) { + if (_steps[i] == target) { _steps.Insert (i, step); return; } @@ -83,7 +85,7 @@ namespace Mono.Linker { public void AddStepAfter (Type target, IStep step) { for (int i = 0; i < _steps.Count; i++) { - if (target.IsInstanceOfType (_steps [i])) { + if (target.IsInstanceOfType (_steps[i])) { if (i == _steps.Count - 1) _steps.Add (step); else @@ -98,7 +100,7 @@ namespace Mono.Linker { public void AddStepAfter (IStep target, IStep step) { for (int i = 0; i < _steps.Count; i++) { - if (_steps [i] == target) { + if (_steps[i] == target) { if (i == _steps.Count - 1) _steps.Add (step); else @@ -111,7 +113,7 @@ namespace Mono.Linker { public void RemoveStep (Type target) { for (int i = 0; i < _steps.Count; i++) { - if (_steps [i].GetType () != target) + if (_steps[i].GetType () != target) continue; _steps.RemoveAt (i); @@ -122,18 +124,18 @@ namespace Mono.Linker { public void Process (LinkContext context) { while (_steps.Count > 0) { - IStep step = _steps [0]; + IStep step = _steps[0]; ProcessStep (context, step); _steps.Remove (step); } } - + protected virtual void ProcessStep (LinkContext context, IStep step) { step.Process (context); } - public IStep [] GetSteps () + public IStep[] GetSteps () { return _steps.ToArray (); } diff --git a/src/linker/Linker/TypeDefinitionExtensions.cs b/src/linker/Linker/TypeDefinitionExtensions.cs index 1e06def6e..a874a0286 100644 --- a/src/linker/Linker/TypeDefinitionExtensions.cs +++ b/src/linker/Linker/TypeDefinitionExtensions.cs @@ -2,8 +2,10 @@ using System; using Mono.Cecil; -namespace Mono.Linker { - public static class TypeDefinitionExtensions { +namespace Mono.Linker +{ + public static class TypeDefinitionExtensions + { public static bool HasInterface (this TypeDefinition type, TypeDefinition interfaceType, out InterfaceImplementation implementation) { implementation = null; @@ -29,8 +31,8 @@ namespace Mono.Linker { } throw new MissingFieldException ($"Enum type '{enumType.FullName}' is missing 'value__' field"); - } - + } + public static bool IsMulticastDelegate (this TypeDefinition td) { return td.BaseType?.Name == "MulticastDelegate" && td.BaseType.Namespace == "System"; diff --git a/src/linker/Linker/TypeNameParser.cs b/src/linker/Linker/TypeNameParser.cs index 15d53c09c..b04b2c607 100644 --- a/src/linker/Linker/TypeNameParser.cs +++ b/src/linker/Linker/TypeNameParser.cs @@ -1,8 +1,11 @@ using System; -namespace Mono.Linker { - public static class TypeNameParser { - public static bool TryParseTypeAssemblyQualifiedName (string value, out string typeName, out string assemblyName) { +namespace Mono.Linker +{ + public static class TypeNameParser + { + public static bool TryParseTypeAssemblyQualifiedName (string value, out string typeName, out string assemblyName) + { if (string.IsNullOrEmpty (value)) { typeName = null; assemblyName = null; @@ -19,7 +22,7 @@ namespace Mono.Linker { while (value.IndexOf ('[') > 0) { var openidx = value.IndexOf ('['); var closeidx = value.IndexOf (']'); - + // No matching close ] or out of order if (closeidx < 0 || closeidx < openidx) { typeName = null; @@ -31,10 +34,10 @@ namespace Mono.Linker { } var tokens = value.Split (','); - typeName = tokens [0].Trim (); + typeName = tokens[0].Trim (); assemblyName = null; if (tokens.Length > 1) - assemblyName = tokens [1].Trim (); + assemblyName = tokens[1].Trim (); if (string.IsNullOrWhiteSpace (typeName)) { typeName = null; diff --git a/src/linker/Linker/TypePreserve.cs b/src/linker/Linker/TypePreserve.cs index bc743c65a..1e5862fc3 100644 --- a/src/linker/Linker/TypePreserve.cs +++ b/src/linker/Linker/TypePreserve.cs @@ -26,7 +26,8 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -namespace Mono.Linker { +namespace Mono.Linker +{ public enum TypePreserve { diff --git a/src/linker/Linker/TypeReferenceExtensions.cs b/src/linker/Linker/TypeReferenceExtensions.cs index 988e0b6b3..6910de04c 100644 --- a/src/linker/Linker/TypeReferenceExtensions.cs +++ b/src/linker/Linker/TypeReferenceExtensions.cs @@ -72,7 +72,7 @@ namespace Mono.Linker var elementType = genericInstanceProvider.ElementType.Resolve (); var parameter = elementType.GenericParameters.Single (p => p == genericParameter); - return genericInstanceProvider.GenericArguments [parameter.Position]; + return genericInstanceProvider.GenericArguments[parameter.Position]; } if (typeToInflate is FunctionPointerType functionPointerType) { @@ -81,7 +81,7 @@ namespace Mono.Linker }; for (int i = 0; i < functionPointerType.Parameters.Count; i++) { - var inflatedParameterType = InflateGenericType(genericInstanceProvider, functionPointerType.Parameters [i].ParameterType); + var inflatedParameterType = InflateGenericType (genericInstanceProvider, functionPointerType.Parameters[i].ParameterType); result.Parameters.Add (new ParameterDefinition (inflatedParameterType)); } @@ -143,7 +143,7 @@ namespace Mono.Linker var result = new GenericInstanceType (type.ElementType); for (var i = 0; i < type.GenericArguments.Count; ++i) { - result.GenericArguments.Add (InflateGenericType (genericInstanceProvider, type.GenericArguments [i])); + result.GenericArguments.Add (InflateGenericType (genericInstanceProvider, type.GenericArguments[i])); } return result; @@ -174,7 +174,7 @@ namespace Mono.Linker }; foreach (var parameter in methodDef.Parameters) - method.Parameters.Add (new ParameterDefinition(parameter.Name, parameter.Attributes, parameter.ParameterType)); + method.Parameters.Add (new ParameterDefinition (parameter.Name, parameter.Attributes, parameter.ParameterType)); foreach (var gp in methodDef.GenericParameters) method.GenericParameters.Add (new GenericParameter (gp.Name, method)); @@ -200,7 +200,7 @@ namespace Mono.Linker return false; } - + public static MethodReference GetDefaultInstanceConstructor (this TypeReference type) { foreach (var m in type.GetMethods ()) { diff --git a/src/linker/Linker/XApiReader.cs b/src/linker/Linker/XApiReader.cs index 4c96fc283..382294a63 100644 --- a/src/linker/Linker/XApiReader.cs +++ b/src/linker/Linker/XApiReader.cs @@ -35,9 +35,11 @@ using System.Xml.XPath; using Mono.Cecil; using Mono.Collections.Generic; -namespace Mono.Linker { +namespace Mono.Linker +{ - public class XApiReader { + public class XApiReader + { static readonly string _name = "name"; static readonly string _ns = string.Empty; diff --git a/src/linker/Linker/XmlDependencyRecorder.cs b/src/linker/Linker/XmlDependencyRecorder.cs index 8f093a29c..160af612c 100644 --- a/src/linker/Linker/XmlDependencyRecorder.cs +++ b/src/linker/Linker/XmlDependencyRecorder.cs @@ -162,12 +162,12 @@ namespace Mono.Linker bool WillAssemblyBeModified (AssemblyDefinition assembly) { switch (context.Annotations.GetAction (assembly)) { - case AssemblyAction.Link: - case AssemblyAction.AddBypassNGen: - case AssemblyAction.AddBypassNGenUsed: - return true; - default: - return false; + case AssemblyAction.Link: + case AssemblyAction.AddBypassNGen: + case AssemblyAction.AddBypassNGenUsed: + return true; + default: + return false; } } diff --git a/src/linker/ref/Linker.Steps/BaseStep.cs b/src/linker/ref/Linker.Steps/BaseStep.cs index 9e0fb53e1..122911db0 100644 --- a/src/linker/ref/Linker.Steps/BaseStep.cs +++ b/src/linker/ref/Linker.Steps/BaseStep.cs @@ -4,9 +4,11 @@ using Mono.Cecil; -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public abstract class BaseStep : IStep { + public abstract class BaseStep : IStep + { public LinkContext Context { get { throw null; } } public AnnotationStore Annotations { get { throw null; } } public void Process (LinkContext context) { throw null; } diff --git a/src/linker/ref/Linker.Steps/IStep.cs b/src/linker/ref/Linker.Steps/IStep.cs index 53a3cd007..6986a02e2 100644 --- a/src/linker/ref/Linker.Steps/IStep.cs +++ b/src/linker/ref/Linker.Steps/IStep.cs @@ -2,9 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -namespace Mono.Linker.Steps { +namespace Mono.Linker.Steps +{ - public interface IStep { + public interface IStep + { void Process (LinkContext context); } } diff --git a/src/linker/ref/Linker/Annotations.cs b/src/linker/ref/Linker/Annotations.cs index 9b340b715..0fe8ef6e4 100644 --- a/src/linker/ref/Linker/Annotations.cs +++ b/src/linker/ref/Linker/Annotations.cs @@ -5,11 +5,12 @@ using System.Collections.Generic; using Mono.Cecil; -namespace Mono.Linker { +namespace Mono.Linker +{ public partial class AnnotationStore { - internal AnnotationStore() {} + internal AnnotationStore () { } public IEnumerable<OverrideInformation> GetOverrides (MethodDefinition method) { throw null; } @@ -25,7 +26,7 @@ namespace Mono.Linker { public void SetAction (AssemblyDefinition assembly, AssemblyAction action) { throw null; } public bool HasAction (AssemblyDefinition assembly) { throw null; } - public object GetCustomAnnotation (object key, IMetadataTokenProvider item) { throw null; } - public void SetCustomAnnotation (object key, IMetadataTokenProvider item, object value) { throw null; } + public object GetCustomAnnotation (object key, IMetadataTokenProvider item) { throw null; } + public void SetCustomAnnotation (object key, IMetadataTokenProvider item, object value) { throw null; } } } diff --git a/src/linker/ref/Linker/LinkContext.cs b/src/linker/ref/Linker/LinkContext.cs index 477ab8a2c..a15b378d3 100644 --- a/src/linker/ref/Linker/LinkContext.cs +++ b/src/linker/ref/Linker/LinkContext.cs @@ -4,7 +4,8 @@ using Mono.Cecil; -namespace Mono.Linker { +namespace Mono.Linker +{ public class LinkContext { diff --git a/src/linker/ref/Linker/MessageContainer.cs b/src/linker/ref/Linker/MessageContainer.cs index 8ddaef2b4..ba351fbb2 100644 --- a/src/linker/ref/Linker/MessageContainer.cs +++ b/src/linker/ref/Linker/MessageContainer.cs @@ -9,6 +9,6 @@ namespace Mono.Linker public static MessageContainer CreateErrorMessage (string text, int code, string subcategory = "", MessageOrigin? origin = null) { throw null; } public static MessageContainer CreateWarningMessage (string text, int code, string subcategory = "", MessageOrigin? origin = null) { throw null; } public static MessageContainer CreateInfoMessage (string text) { throw null; } - public static MessageContainer CreateDiagnosticMessage (string text) { throw null; } + public static MessageContainer CreateDiagnosticMessage (string text) { throw null; } } } diff --git a/test/ILLink.Tasks.IntegrationTests/CommandRunner.cs b/test/ILLink.Tasks.IntegrationTests/CommandRunner.cs index 041d65008..b9cb5c3ce 100644 --- a/test/ILLink.Tasks.IntegrationTests/CommandRunner.cs +++ b/test/ILLink.Tasks.IntegrationTests/CommandRunner.cs @@ -12,37 +12,37 @@ namespace ILLink.Tests { private readonly ILogger logger; - public CommandHelper(ILogger logger) + public CommandHelper (ILogger logger) { this.logger = logger; } - public int Dotnet(string args, string workingDir, string additionalPath = null) + public int Dotnet (string args, string workingDir, string additionalPath = null) { - return RunCommand(Path.GetFullPath(TestContext.DotnetToolPath), args, + return RunCommand (Path.GetFullPath (TestContext.DotnetToolPath), args, workingDir, additionalPath, out _); } - public int RunCommand(string command, string args, int timeout = Int32.MaxValue) + public int RunCommand (string command, string args, int timeout = Int32.MaxValue) { - return RunCommand(command, args, null, null, out _, timeout); + return RunCommand (command, args, null, null, out _, timeout); } - public int RunCommand(string command, string args, string workingDir) + public int RunCommand (string command, string args, string workingDir) { - return RunCommand(command, args, workingDir, null, out _); + return RunCommand (command, args, workingDir, null, out _); } - public int RunCommand(string command, string args, string workingDir, string additionalPath, + public int RunCommand (string command, string args, string workingDir, string additionalPath, out string commandOutput, int timeout = Int32.MaxValue, string terminatingOutput = null) { - return (new CommandRunner(command, logger)) - .WithArguments(args) - .WithWorkingDir(workingDir) - .WithAdditionalPath(additionalPath) - .WithTimeout(timeout) - .WithTerminatingOutput(terminatingOutput) - .Run(out commandOutput); + return (new CommandRunner (command, logger)) + .WithArguments (args) + .WithWorkingDir (workingDir) + .WithAdditionalPath (additionalPath) + .WithTimeout (timeout) + .WithTerminatingOutput (terminatingOutput) + .Run (out commandOutput); } } @@ -62,68 +62,73 @@ namespace ILLink.Tests logger.LogMessage (message); } - public CommandRunner(string command, ILogger logger) { + public CommandRunner (string command, ILogger logger) + { this.command = command; this.logger = logger; } - public CommandRunner WithArguments(string args) { + public CommandRunner WithArguments (string args) + { this.args = args; return this; } - public CommandRunner WithWorkingDir(string workingDir) { + public CommandRunner WithWorkingDir (string workingDir) + { this.workingDir = workingDir; return this; } - public CommandRunner WithAdditionalPath(string additionalPath) { + public CommandRunner WithAdditionalPath (string additionalPath) + { this.additionalPath = additionalPath; return this; } - public CommandRunner WithTimeout(int timeout) { + public CommandRunner WithTimeout (int timeout) + { this.timeout = timeout; return this; } - public CommandRunner WithTerminatingOutput(string terminatingOutput) { + public CommandRunner WithTerminatingOutput (string terminatingOutput) + { this.terminatingOutput = terminatingOutput; return this; } - public int Run() + public int Run () { - return Run(out _); + return Run (out _); } - public int Run(out string commandOutput) + public int Run (out string commandOutput) { - if (String.IsNullOrEmpty(command)) { - throw new Exception("No command was specified specified."); + if (String.IsNullOrEmpty (command)) { + throw new Exception ("No command was specified specified."); } if (logger == null) { - throw new Exception("No logger present."); + throw new Exception ("No logger present."); } - var psi = new ProcessStartInfo - { + var psi = new ProcessStartInfo { FileName = command, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, }; LogMessage ($"caller working directory: {Environment.CurrentDirectory}"); - if (!String.IsNullOrEmpty(args)) { + if (!String.IsNullOrEmpty (args)) { psi.Arguments = args; LogMessage ($"{command} {args}"); } else { LogMessage ($"{command}"); } - if (!String.IsNullOrEmpty(workingDir)) { + if (!String.IsNullOrEmpty (workingDir)) { LogMessage ($"working directory: {workingDir}"); psi.WorkingDirectory = workingDir; } - if (!String.IsNullOrEmpty(additionalPath)) { + if (!String.IsNullOrEmpty (additionalPath)) { string path = psi.Environment["PATH"]; psi.Environment["PATH"] = path + ";" + additionalPath; } @@ -133,57 +138,60 @@ namespace ILLink.Tests // dotnet sets some environment variables that // may cause problems in the child process. - psi.Environment.Remove("MSBuildExtensionsPath"); - psi.Environment.Remove("MSBuildLoadMicrosoftTargetsReadOnly"); - psi.Environment.Remove("MSBuildSDKsPath"); - psi.Environment.Remove("VbcToolExe"); - psi.Environment.Remove("CscToolExe"); - psi.Environment.Remove("MSBUILD_EXE_PATH"); + psi.Environment.Remove ("MSBuildExtensionsPath"); + psi.Environment.Remove ("MSBuildLoadMicrosoftTargetsReadOnly"); + psi.Environment.Remove ("MSBuildSDKsPath"); + psi.Environment.Remove ("VbcToolExe"); + psi.Environment.Remove ("CscToolExe"); + psi.Environment.Remove ("MSBUILD_EXE_PATH"); LogMessage ("environment:"); foreach (var item in psi.Environment) { LogMessage ($"\t{item.Key}={item.Value}"); } - StringBuilder processOutput = new StringBuilder(); - void handler(object sender, DataReceivedEventArgs e) { - processOutput.Append(e.Data); - processOutput.AppendLine(); + StringBuilder processOutput = new StringBuilder (); + void handler (object sender, DataReceivedEventArgs e) + { + processOutput.Append (e.Data); + processOutput.AppendLine (); } - StringBuilder processError = new StringBuilder(); - void ehandler(object sender, DataReceivedEventArgs e) { - processError.Append(e.Data); - processError.AppendLine(); + StringBuilder processError = new StringBuilder (); + void ehandler (object sender, DataReceivedEventArgs e) + { + processError.Append (e.Data); + processError.AppendLine (); } process.OutputDataReceived += handler; process.ErrorDataReceived += ehandler; // terminate process if output contains specified string - if (!String.IsNullOrEmpty(terminatingOutput)) { - void terminatingOutputHandler(object sender, DataReceivedEventArgs e) { - if (!String.IsNullOrEmpty(e.Data) && e.Data.Contains(terminatingOutput)) - process.Kill(); + if (!String.IsNullOrEmpty (terminatingOutput)) { + void terminatingOutputHandler (object sender, DataReceivedEventArgs e) + { + if (!String.IsNullOrEmpty (e.Data) && e.Data.Contains (terminatingOutput)) + process.Kill (); } process.OutputDataReceived += terminatingOutputHandler; } // start the process - process.Start(); - process.BeginOutputReadLine(); - process.BeginErrorReadLine(); - if (!process.WaitForExit(timeout)) { + process.Start (); + process.BeginOutputReadLine (); + process.BeginErrorReadLine (); + if (!process.WaitForExit (timeout)) { LogMessage ($"killing process after {timeout} ms"); - process.Kill(); + process.Kill (); } // WaitForExit with timeout doesn't guarantee // that the async output handlers have been // called, so WaitForExit needs to be called // afterwards. - process.WaitForExit(); - string processOutputStr = processOutput.ToString(); - string processErrorStr = processError.ToString(); - LogMessage(processOutputStr); - LogMessage(processErrorStr); + process.WaitForExit (); + string processOutputStr = processOutput.ToString (); + string processErrorStr = processError.ToString (); + LogMessage (processOutputStr); + LogMessage (processErrorStr); commandOutput = processOutputStr; return process.ExitCode; } diff --git a/test/ILLink.Tasks.IntegrationTests/HelloWorldTest.cs b/test/ILLink.Tasks.IntegrationTests/HelloWorldTest.cs index 784b089c4..fe44e9f69 100644 --- a/test/ILLink.Tasks.IntegrationTests/HelloWorldTest.cs +++ b/test/ILLink.Tasks.IntegrationTests/HelloWorldTest.cs @@ -15,30 +15,30 @@ namespace ILLink.Tests csproj = SetupProject (); } - public string SetupProject() + public string SetupProject () { - string projectRoot = CreateTestFolder("helloworld"); - string csproj = Path.Combine(projectRoot, $"helloworld.csproj"); + string projectRoot = CreateTestFolder ("helloworld"); + string csproj = Path.Combine (projectRoot, $"helloworld.csproj"); - if (File.Exists(csproj)) { + if (File.Exists (csproj)) { LogMessage ($"using existing project {csproj}"); return csproj; } - if (Directory.Exists(projectRoot)) { - Directory.Delete(projectRoot, true); + if (Directory.Exists (projectRoot)) { + Directory.Delete (projectRoot, true); } - Directory.CreateDirectory(projectRoot); - int ret = CommandHelper.Dotnet("new console", projectRoot); + Directory.CreateDirectory (projectRoot); + int ret = CommandHelper.Dotnet ("new console", projectRoot); if (ret != 0) { LogMessage ("dotnet new failed"); - Assert.True(false); + Assert.True (false); } - AddLinkerReference(csproj); + AddLinkerReference (csproj); - AddNuGetConfig(projectRoot); + AddNuGetConfig (projectRoot); return csproj; } @@ -48,22 +48,23 @@ namespace ILLink.Tests { readonly HelloWorldFixture fixture; - public HelloWorldTest(HelloWorldFixture fixture, ITestOutputHelper helper) : base(helper) { + public HelloWorldTest (HelloWorldFixture fixture, ITestOutputHelper helper) : base (helper) + { this.fixture = fixture; } [Fact] - public void RunHelloWorldStandalone() + public void RunHelloWorldStandalone () { - string executablePath = BuildAndLink(fixture.csproj, selfContained: true); - CheckOutput(executablePath, selfContained: true); + string executablePath = BuildAndLink (fixture.csproj, selfContained: true); + CheckOutput (executablePath, selfContained: true); } - void CheckOutput(string target, bool selfContained = false) + void CheckOutput (string target, bool selfContained = false) { - int ret = RunApp(target, out string commandOutput, selfContained: selfContained); - Assert.True(ret == 0); - Assert.Contains("Hello World!", commandOutput); + int ret = RunApp (target, out string commandOutput, selfContained: selfContained); + Assert.True (ret == 0); + Assert.Contains ("Hello World!", commandOutput); } } } diff --git a/test/ILLink.Tasks.IntegrationTests/IntegrationTestBase.cs b/test/ILLink.Tasks.IntegrationTests/IntegrationTestBase.cs index c9c01a2e2..b46b3ee8e 100644 --- a/test/ILLink.Tasks.IntegrationTests/IntegrationTestBase.cs +++ b/test/ILLink.Tasks.IntegrationTests/IntegrationTestBase.cs @@ -33,65 +33,65 @@ namespace ILLink.Tests CommandHelper = new CommandHelper (logger); } - protected void AddNuGetConfig(string projectRoot) + protected void AddNuGetConfig (string projectRoot) { - var nugetConfig = Path.Combine(projectRoot, "NuGet.config"); - var xdoc = new XDocument(); - var configuration = new XElement("configuration"); - var packageSources = new XElement("packageSources"); - packageSources.Add(new XElement("add", - new XAttribute("key", "dotnet-core"), - new XAttribute("value", "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"))); - - configuration.Add(packageSources); - xdoc.Add(configuration); - - using (var fs = new FileStream(nugetConfig, FileMode.Create)) { - xdoc.Save(fs); + var nugetConfig = Path.Combine (projectRoot, "NuGet.config"); + var xdoc = new XDocument (); + var configuration = new XElement ("configuration"); + var packageSources = new XElement ("packageSources"); + packageSources.Add (new XElement ("add", + new XAttribute ("key", "dotnet-core"), + new XAttribute ("value", "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"))); + + configuration.Add (packageSources); + xdoc.Add (configuration); + + using (var fs = new FileStream (nugetConfig, FileMode.Create)) { + xdoc.Save (fs); } } - protected void AddLinkerReference(string csproj) + protected void AddLinkerReference (string csproj) { - var xdoc = XDocument.Load(csproj); - var ns = xdoc.Root.GetDefaultNamespace(); + var xdoc = XDocument.Load (csproj); + var ns = xdoc.Root.GetDefaultNamespace (); - foreach (var el in xdoc.Root.Elements(ns + "PropertyGroup")) { - el.Add(new XElement(ns + "ILLinkTasksAssembly", TestContext.TasksAssemblyPath)); + foreach (var el in xdoc.Root.Elements (ns + "PropertyGroup")) { + el.Add (new XElement (ns + "ILLinkTasksAssembly", TestContext.TasksAssemblyPath)); break; } // Workaround to avoid passing an argument that was removed (-l). // This can be removed once we update to a recent SDK that does not pass this argument. - xdoc.Root.Add (new XElement(ns + "Target", - new XAttribute("Name", "_FixILLinkDefaults"), - new XAttribute("AfterTargets", "_SetILLinkDefaults"), - new XElement(ns + "PropertyGroup", - new XElement(ns + "_ExtraTrimmerArgs", + xdoc.Root.Add (new XElement (ns + "Target", + new XAttribute ("Name", "_FixILLinkDefaults"), + new XAttribute ("AfterTargets", "_SetILLinkDefaults"), + new XElement (ns + "PropertyGroup", + new XElement (ns + "_ExtraTrimmerArgs", "--skip-unresolved true -c copyused -u copyused")))); - using (var fs = new FileStream(csproj, FileMode.Create)) { - xdoc.Save(fs); + using (var fs = new FileStream (csproj, FileMode.Create)) { + xdoc.Save (fs); } } - protected string CreateTestFolder(string projectName) + protected string CreateTestFolder (string projectName) { - string tempFolder = Path.GetFullPath(Path.Combine("tests-temp", projectName)); - Directory.CreateDirectory(tempFolder); + string tempFolder = Path.GetFullPath (Path.Combine ("tests-temp", projectName)); + Directory.CreateDirectory (tempFolder); // write empty Directory.Build.props and Directory.Build.targets to disable accidental import of arcade from repo root - File.WriteAllText(Path.Combine(tempFolder, "Directory.Build.props"), "<Project></Project>"); - File.WriteAllText(Path.Combine(tempFolder, "Directory.Build.targets"), "<Project></Project>"); + File.WriteAllText (Path.Combine (tempFolder, "Directory.Build.props"), "<Project></Project>"); + File.WriteAllText (Path.Combine (tempFolder, "Directory.Build.targets"), "<Project></Project>"); - return Path.Combine(tempFolder, projectName); + return Path.Combine (tempFolder, projectName); } - protected void WriteEmbeddedResource(string resourceName, string destination) + protected void WriteEmbeddedResource (string resourceName, string destination) { - var assembly = Assembly.GetExecutingAssembly(); - var resourceStream = assembly.GetManifestResourceStream(resourceName); - resourceStream.CopyTo(File.Create(destination)); + var assembly = Assembly.GetExecutingAssembly (); + var resourceStream = assembly.GetManifestResourceStream (resourceName); + resourceStream.CopyTo (File.Create (destination)); } } @@ -103,10 +103,10 @@ namespace ILLink.Tests private readonly TestLogger logger; protected readonly CommandHelper CommandHelper; - public IntegrationTestBase(ITestOutputHelper output) + public IntegrationTestBase (ITestOutputHelper output) { - logger = new TestLogger(output); - CommandHelper = new CommandHelper(logger); + logger = new TestLogger (output); + CommandHelper = new CommandHelper (logger); } private void LogMessage (string message) @@ -123,17 +123,17 @@ namespace ILLink.Tests /// host for self-contained publish, or the dll containing /// the entry point. /// </summary> - public string BuildAndLink(string csproj, List<string> rootFiles = null, Dictionary<string, string> extraPublishArgs = null, bool selfContained = false) + public string BuildAndLink (string csproj, List<string> rootFiles = null, Dictionary<string, string> extraPublishArgs = null, bool selfContained = false) { - string demoRoot = Path.GetDirectoryName(csproj); + string demoRoot = Path.GetDirectoryName (csproj); string publishArgs = $"publish -c {TestContext.Configuration} /v:n /p:PublishTrimmed=true"; if (selfContained) { publishArgs += $" -r {TestContext.RuntimeIdentifier}"; } string rootFilesStr; - if (rootFiles != null && rootFiles.Any()) { - rootFilesStr = String.Join(";", rootFiles); + if (rootFiles != null && rootFiles.Any ()) { + rootFilesStr = String.Join (";", rootFiles); publishArgs += $" /p:LinkerRootDescriptors={rootFilesStr}"; } if (extraPublishArgs != null) { @@ -141,48 +141,48 @@ namespace ILLink.Tests publishArgs += $" /p:{item.Key}={item.Value}"; } } - int ret = CommandHelper.Dotnet(publishArgs, demoRoot); + int ret = CommandHelper.Dotnet (publishArgs, demoRoot); if (ret != 0) { - LogMessage("publish failed, returning " + ret); - Assert.True(false); + LogMessage ("publish failed, returning " + ret); + Assert.True (false); } // detect the target framework for which the app was published - string tfmDir = Path.Combine(demoRoot, "bin", TestContext.Configuration); - string tfm = Directory.GetDirectories(tfmDir).Select(p => Path.GetFileName(p)).Single(); - string builtApp = Path.Combine(tfmDir, tfm); + string tfmDir = Path.Combine (demoRoot, "bin", TestContext.Configuration); + string tfm = Directory.GetDirectories (tfmDir).Select (p => Path.GetFileName (p)).Single (); + string builtApp = Path.Combine (tfmDir, tfm); if (selfContained) { - builtApp = Path.Combine(builtApp, TestContext.RuntimeIdentifier); + builtApp = Path.Combine (builtApp, TestContext.RuntimeIdentifier); } - builtApp = Path.Combine(builtApp, "publish", - Path.GetFileNameWithoutExtension(csproj)); + builtApp = Path.Combine (builtApp, "publish", + Path.GetFileNameWithoutExtension (csproj)); if (selfContained) { - if (TestContext.RuntimeIdentifier.Contains("win")) { + if (TestContext.RuntimeIdentifier.Contains ("win")) { builtApp += ".exe"; } } else { builtApp += ".dll"; } - Assert.True(File.Exists(builtApp)); + Assert.True (File.Exists (builtApp)); return builtApp; } - public int RunApp(string target, out string processOutput, int timeout = Int32.MaxValue, + public int RunApp (string target, out string processOutput, int timeout = Int32.MaxValue, string terminatingOutput = null, bool selfContained = false) { - Assert.True(File.Exists(target)); + Assert.True (File.Exists (target)); int ret; if (selfContained) { - ret = CommandHelper.RunCommand( + ret = CommandHelper.RunCommand ( target, null, - Directory.GetParent(target).FullName, + Directory.GetParent (target).FullName, null, out processOutput, timeout, terminatingOutput); } else { - ret = CommandHelper.RunCommand( - Path.GetFullPath(TestContext.DotnetToolPath), - Path.GetFullPath(target), - Directory.GetParent(target).FullName, + ret = CommandHelper.RunCommand ( + Path.GetFullPath (TestContext.DotnetToolPath), + Path.GetFullPath (target), + Directory.GetParent (target).FullName, null, out processOutput, timeout, terminatingOutput); } return ret; diff --git a/test/ILLink.Tasks.IntegrationTests/MusicStoreTest.cs b/test/ILLink.Tasks.IntegrationTests/MusicStoreTest.cs index 8f0e3bac0..c2cca08da 100644 --- a/test/ILLink.Tasks.IntegrationTests/MusicStoreTest.cs +++ b/test/ILLink.Tasks.IntegrationTests/MusicStoreTest.cs @@ -32,8 +32,7 @@ namespace ILLink.Tests private static readonly string aspNetVersion = "2.1.0-preview1-27654"; public static Dictionary<string, string> versionPublishArgs; - public static Dictionary<string, string> VersionPublishArgs - { + public static Dictionary<string, string> VersionPublishArgs { get { if (versionPublishArgs != null) { return versionPublishArgs; @@ -48,51 +47,51 @@ namespace ILLink.Tests public static string csproj; - public MusicStoreFixture(IMessageSink diagnosticMessageSink) : base(diagnosticMessageSink) + public MusicStoreFixture (IMessageSink diagnosticMessageSink) : base (diagnosticMessageSink) { - csproj = SetupProject(); + csproj = SetupProject (); } // returns path to .csproj project file - string SetupProject() + string SetupProject () { int ret; - string repoName = CreateTestFolder("MusicStore"); - string demoRoot = Path.Combine(repoName, Path.Combine("src", "MusicStore")); - string csproj = Path.Combine(demoRoot, "MusicStore.csproj"); + string repoName = CreateTestFolder ("MusicStore"); + string demoRoot = Path.Combine (repoName, Path.Combine ("src", "MusicStore")); + string csproj = Path.Combine (demoRoot, "MusicStore.csproj"); - if (File.Exists(csproj)) { - LogMessage($"using existing project {csproj}"); + if (File.Exists (csproj)) { + LogMessage ($"using existing project {csproj}"); return csproj; } - if (Directory.Exists(repoName)) { - Directory.Delete(repoName, true); + if (Directory.Exists (repoName)) { + Directory.Delete (repoName, true); } - ret = CommandHelper.RunCommand("git", $"clone {gitRepo} {repoName}"); + ret = CommandHelper.RunCommand ("git", $"clone {gitRepo} {repoName}"); if (ret != 0) { - LogMessage("git failed"); - Assert.True(false); + LogMessage ("git failed"); + Assert.True (false); } - if (!Directory.Exists(demoRoot)) { - LogMessage($"{demoRoot} does not exist"); - Assert.True(false); + if (!Directory.Exists (demoRoot)) { + LogMessage ($"{demoRoot} does not exist"); + Assert.True (false); } - ret = CommandHelper.RunCommand("git", $"checkout {gitRevision}", demoRoot); + ret = CommandHelper.RunCommand ("git", $"checkout {gitRevision}", demoRoot); if (ret != 0) { - LogMessage($"problem checking out revision {gitRevision}"); - Assert.True(false); + LogMessage ($"problem checking out revision {gitRevision}"); + Assert.True (false); } // Write root files into the project directory foreach (var rf in rootFiles) { - WriteEmbeddedResource(rf, Path.Combine(demoRoot, rf)); + WriteEmbeddedResource (rf, Path.Combine (demoRoot, rf)); } - AddLinkerReference(csproj); + AddLinkerReference (csproj); // We no longer need a custom global.json, because we are // using the same SDK used in the repo. @@ -101,74 +100,74 @@ namespace ILLink.Tests return csproj; } - void AddGlobalJson(string repoDir) + void AddGlobalJson (string repoDir) { - string globalJson = Path.Combine(repoDir, "global.json"); + string globalJson = Path.Combine (repoDir, "global.json"); string globalJsonContents = "{ \"sdk\": { \"version\": \"" + sdkVersion + "\" } }\n"; - File.WriteAllText(globalJson, globalJsonContents); + File.WriteAllText (globalJson, globalJsonContents); } - string GetDotnetToolPath(string dotnetDir) + string GetDotnetToolPath (string dotnetDir) { - string dotnetToolName = Directory.GetFiles(dotnetDir) - .Select(p => Path.GetFileName(p)) - .Where(p => p.Contains("dotnet")) - .Single(); - string dotnetToolPath = Path.Combine(dotnetDir, dotnetToolName); - - if (!File.Exists(dotnetToolPath)) { - LogMessage("repo-local dotnet tool does not exist."); - Assert.True(false); + string dotnetToolName = Directory.GetFiles (dotnetDir) + .Select (p => Path.GetFileName (p)) + .Where (p => p.Contains ("dotnet")) + .Single (); + string dotnetToolPath = Path.Combine (dotnetDir, dotnetToolName); + + if (!File.Exists (dotnetToolPath)) { + LogMessage ("repo-local dotnet tool does not exist."); + Assert.True (false); } return dotnetToolPath; } - string ObtainSDK(string rootDir, string repoDir) + string ObtainSDK (string rootDir, string repoDir) { int ret; string dotnetDirName = ".dotnet"; - string dotnetDir = Path.Combine(rootDir, dotnetDirName); - if (Directory.Exists(dotnetDir)) { - return GetDotnetToolPath(dotnetDir); + string dotnetDir = Path.Combine (rootDir, dotnetDirName); + if (Directory.Exists (dotnetDir)) { + return GetDotnetToolPath (dotnetDir); } - string dotnetInstall = Path.Combine(Path.GetFullPath(repoDir), "dotnet-install"); - if (TestContext.RuntimeIdentifier.Contains("win")) { + string dotnetInstall = Path.Combine (Path.GetFullPath (repoDir), "dotnet-install"); + if (TestContext.RuntimeIdentifier.Contains ("win")) { dotnetInstall += ".ps1"; } else { dotnetInstall += ".sh"; } - if (!File.Exists(dotnetInstall)) { - LogMessage($"missing dotnet-install script at {dotnetInstall}"); - Assert.True(false); + if (!File.Exists (dotnetInstall)) { + LogMessage ($"missing dotnet-install script at {dotnetInstall}"); + Assert.True (false); } - if (TestContext.RuntimeIdentifier.Contains("win")) { - ret = CommandHelper.RunCommand("powershell", $"{dotnetInstall} -SharedRuntime -InstallDir {dotnetDirName} -Channel master -Architecture x64 -Version {runtimeVersion}", rootDir); + if (TestContext.RuntimeIdentifier.Contains ("win")) { + ret = CommandHelper.RunCommand ("powershell", $"{dotnetInstall} -SharedRuntime -InstallDir {dotnetDirName} -Channel master -Architecture x64 -Version {runtimeVersion}", rootDir); if (ret != 0) { - LogMessage("failed to retrieve shared runtime"); - Assert.True(false); + LogMessage ("failed to retrieve shared runtime"); + Assert.True (false); } - ret = CommandHelper.RunCommand("powershell", $"{dotnetInstall} -InstallDir {dotnetDirName} -Channel master -Architecture x64 -Version {sdkVersion}", rootDir); + ret = CommandHelper.RunCommand ("powershell", $"{dotnetInstall} -InstallDir {dotnetDirName} -Channel master -Architecture x64 -Version {sdkVersion}", rootDir); if (ret != 0) { - LogMessage("failed to retrieve sdk"); - Assert.True(false); + LogMessage ("failed to retrieve sdk"); + Assert.True (false); } } else { - ret = CommandHelper.RunCommand(dotnetInstall, $"-sharedruntime -runtimeid {TestContext.RuntimeIdentifier} -installdir {dotnetDirName} -channel master -architecture x64 -version {runtimeVersion}", rootDir); + ret = CommandHelper.RunCommand (dotnetInstall, $"-sharedruntime -runtimeid {TestContext.RuntimeIdentifier} -installdir {dotnetDirName} -channel master -architecture x64 -version {runtimeVersion}", rootDir); if (ret != 0) { - LogMessage("failed to retrieve shared runtime"); - Assert.True(false); + LogMessage ("failed to retrieve shared runtime"); + Assert.True (false); } - ret = CommandHelper.RunCommand(dotnetInstall, $"-installdir {dotnetDirName} -channel master -architecture x64 -version {sdkVersion}", rootDir); + ret = CommandHelper.RunCommand (dotnetInstall, $"-installdir {dotnetDirName} -channel master -architecture x64 -version {sdkVersion}", rootDir); if (ret != 0) { - LogMessage("failed to retrieve sdk"); - Assert.True(false); + LogMessage ("failed to retrieve sdk"); + Assert.True (false); } } - return GetDotnetToolPath(dotnetDir); + return GetDotnetToolPath (dotnetDir); } } @@ -176,7 +175,8 @@ namespace ILLink.Tests { readonly MusicStoreFixture fixture; - public MusicStoreTest(MusicStoreFixture fixture, ITestOutputHelper output) : base(output) { + public MusicStoreTest (MusicStoreFixture fixture, ITestOutputHelper output) : base (output) + { this.fixture = fixture; // MusicStore has been updated to target netcoreapp3.0, so // we should be able to run on the SDK used to build this @@ -185,30 +185,30 @@ namespace ILLink.Tests } //[Fact] // https://github.com/aspnet/JitBench/issues/96 - public void RunMusicStoreStandalone() + public void RunMusicStoreStandalone () { - string executablePath = BuildAndLink(MusicStoreFixture.csproj, MusicStoreFixture.rootFiles, MusicStoreFixture.VersionPublishArgs, selfContained: true); - CheckOutput(executablePath, selfContained: true); + string executablePath = BuildAndLink (MusicStoreFixture.csproj, MusicStoreFixture.rootFiles, MusicStoreFixture.VersionPublishArgs, selfContained: true); + CheckOutput (executablePath, selfContained: true); } //[Fact] // https://github.com/aspnet/JitBench/issues/96 - public void RunMusicStorePortable() + public void RunMusicStorePortable () { - Dictionary<string, string> extraPublishArgs = new Dictionary<string, string>(MusicStoreFixture.VersionPublishArgs) { + Dictionary<string, string> extraPublishArgs = new Dictionary<string, string> (MusicStoreFixture.VersionPublishArgs) { { "PublishWithAspNetCoreTargetManifest", "false" } }; - string target = BuildAndLink(MusicStoreFixture.csproj, null, extraPublishArgs, selfContained: false); - CheckOutput(target, selfContained: false); + string target = BuildAndLink (MusicStoreFixture.csproj, null, extraPublishArgs, selfContained: false); + CheckOutput (target, selfContained: false); } - void CheckOutput(string target, bool selfContained = false) + void CheckOutput (string target, bool selfContained = false) { - int ret = RunApp(target, out string commandOutput, selfContained: selfContained); + int ret = RunApp (target, out string commandOutput, selfContained: selfContained); - Assert.Contains("starting request to http://localhost:5000", commandOutput); - Assert.Contains("Response: OK", commandOutput); - Assert.Contains("Running 100 requests", commandOutput); - Assert.True(ret == 0); + Assert.Contains ("starting request to http://localhost:5000", commandOutput); + Assert.Contains ("Response: OK", commandOutput); + Assert.Contains ("Running 100 requests", commandOutput); + Assert.True (ret == 0); } } diff --git a/test/ILLink.Tasks.IntegrationTests/TestContext.cs b/test/ILLink.Tasks.IntegrationTests/TestContext.cs index db97d4bcf..6c9268c51 100644 --- a/test/ILLink.Tasks.IntegrationTests/TestContext.cs +++ b/test/ILLink.Tasks.IntegrationTests/TestContext.cs @@ -37,9 +37,9 @@ namespace ILLink.Tests /// </summary> public static string TestBin { get; private set; } - static TestContext() + static TestContext () { - SetupDefaultContext(); + SetupDefaultContext (); } /// <summary> @@ -50,11 +50,11 @@ namespace ILLink.Tests /// one version of the package is present, and uses it to /// unambiguously determine which package to use in the tests. /// </summary> - public static void SetupDefaultContext() + public static void SetupDefaultContext () { // test working directory is test project's <baseoutputpath>/<config>/<tfm> - var testBin = Path.Combine(Environment.CurrentDirectory, "..", ".."); - var repoRoot = Path.GetFullPath(Path.Combine(testBin, "..", "..", "..")); + var testBin = Path.Combine (Environment.CurrentDirectory, "..", ".."); + var repoRoot = Path.GetFullPath (Path.Combine (testBin, "..", "..", "..")); // We want to build and link integration projects in the // release configuration. @@ -68,33 +68,32 @@ namespace ILLink.Tests #endif // Locate tasks assembly - var tasksAssembly = Path.Combine(repoRoot, "artifacts", "bin", "ILLink.Tasks", illinkConfiguration, "netcoreapp3.0", "ILLink.Tasks.dll"); - if (!File.Exists(tasksAssembly)) { - throw new Exception("ILLink.Tasks not found at " + tasksAssembly); + var tasksAssembly = Path.Combine (repoRoot, "artifacts", "bin", "ILLink.Tasks", illinkConfiguration, "netcoreapp3.0", "ILLink.Tasks.dll"); + if (!File.Exists (tasksAssembly)) { + throw new Exception ("ILLink.Tasks not found at " + tasksAssembly); } // Locate dotnet host - var dotnetDir = Path.Combine(repoRoot, ".dotnet"); - var dotnetToolName = Directory.GetFiles(dotnetDir) - .Select(p => Path.GetFileName(p)) - .Where(p => p.StartsWith("dotnet")) - .Where(p => { - var ext = Path.GetExtension(p); + var dotnetDir = Path.Combine (repoRoot, ".dotnet"); + var dotnetToolName = Directory.GetFiles (dotnetDir) + .Select (p => Path.GetFileName (p)) + .Where (p => p.StartsWith ("dotnet")) + .Where (p => { + var ext = Path.GetExtension (p); return ext == "" || ext == ".exe"; }) - .Single(); - var dotnetToolPath = Path.Combine(dotnetDir, dotnetToolName); + .Single (); + var dotnetToolPath = Path.Combine (dotnetDir, dotnetToolName); // Initialize static members TasksAssemblyPath = tasksAssembly; DotnetToolPath = dotnetToolPath; // This sets the RID to the RID of the currently-executing system. - RuntimeIdentifier = RuntimeEnvironment.GetRuntimeIdentifier(); + RuntimeIdentifier = RuntimeEnvironment.GetRuntimeIdentifier (); // workaround: the osx.10.13-x64 RID doesn't exist yet. // see https://github.com/NuGet/Home/issues/5862 - if (RuntimeIdentifier == "osx.10.14-x64") - { + if (RuntimeIdentifier == "osx.10.14-x64") { RuntimeIdentifier = "osx.10.13-x64"; } } diff --git a/test/ILLink.Tasks.IntegrationTests/WebApiTest.cs b/test/ILLink.Tasks.IntegrationTests/WebApiTest.cs index 4e9c93632..75775fe3c 100644 --- a/test/ILLink.Tasks.IntegrationTests/WebApiTest.cs +++ b/test/ILLink.Tasks.IntegrationTests/WebApiTest.cs @@ -10,36 +10,37 @@ namespace ILLink.Tests { public string csproj; - public WebApiFixture(IMessageSink diagnosticMessageSink) : base(diagnosticMessageSink) { - csproj = SetupProject(); + public WebApiFixture (IMessageSink diagnosticMessageSink) : base (diagnosticMessageSink) + { + csproj = SetupProject (); } - public string SetupProject() + public string SetupProject () { - string projectRoot = CreateTestFolder("webapi"); - string csproj = Path.Combine(projectRoot, $"webapi.csproj"); + string projectRoot = CreateTestFolder ("webapi"); + string csproj = Path.Combine (projectRoot, $"webapi.csproj"); - if (File.Exists(csproj)) { - LogMessage($"using existing project {csproj}"); + if (File.Exists (csproj)) { + LogMessage ($"using existing project {csproj}"); return csproj; } - if (Directory.Exists(projectRoot)) { - Directory.Delete(projectRoot, true); + if (Directory.Exists (projectRoot)) { + Directory.Delete (projectRoot, true); } - Directory.CreateDirectory(projectRoot); - int ret = CommandHelper.Dotnet("new webapi", projectRoot); + Directory.CreateDirectory (projectRoot); + int ret = CommandHelper.Dotnet ("new webapi", projectRoot); if (ret != 0) { - LogMessage("dotnet new failed"); - Assert.True(false); + LogMessage ("dotnet new failed"); + Assert.True (false); } - PreventPublishFiltering(csproj); + PreventPublishFiltering (csproj); - AddLinkerReference(csproj); + AddLinkerReference (csproj); - AddNuGetConfig(projectRoot); + AddNuGetConfig (projectRoot); return csproj; } @@ -48,18 +49,19 @@ namespace ILLink.Tests // that have the publish output filtered by a manifest // file. It looks like aspnet has made this the default. See // the bug at https://github.com/dotnet/sdk/issues/1160. - private void PreventPublishFiltering(string csproj) { - var xdoc = XDocument.Load(csproj); - var ns = xdoc.Root.GetDefaultNamespace(); + private void PreventPublishFiltering (string csproj) + { + var xdoc = XDocument.Load (csproj); + var ns = xdoc.Root.GetDefaultNamespace (); - var propertygroup = xdoc.Root.Element(ns + "PropertyGroup"); + var propertygroup = xdoc.Root.Element (ns + "PropertyGroup"); - LogMessage("setting PublishWithAspNetCoreTargetManifest=false"); - propertygroup.Add(new XElement(ns + "PublishWithAspNetCoreTargetManifest", + LogMessage ("setting PublishWithAspNetCoreTargetManifest=false"); + propertygroup.Add (new XElement (ns + "PublishWithAspNetCoreTargetManifest", "false")); - using (var fs = new FileStream(csproj, FileMode.Create)) { - xdoc.Save(fs); + using (var fs = new FileStream (csproj, FileMode.Create)) { + xdoc.Save (fs); } } } @@ -68,24 +70,24 @@ namespace ILLink.Tests { private readonly WebApiFixture fixture; - public WebApiTest(WebApiFixture fixture, ITestOutputHelper output) : base(output) + public WebApiTest (WebApiFixture fixture, ITestOutputHelper output) : base (output) { this.fixture = fixture; } [Fact] - public void RunWebApiStandalone() + public void RunWebApiStandalone () { - string executablePath = BuildAndLink(fixture.csproj, selfContained: true); - CheckOutput(executablePath, selfContained: true); + string executablePath = BuildAndLink (fixture.csproj, selfContained: true); + CheckOutput (executablePath, selfContained: true); } - void CheckOutput(string target, bool selfContained = false) + void CheckOutput (string target, bool selfContained = false) { string terminatingOutput = "Application started. Press Ctrl+C to shut down."; - RunApp(target, out string commandOutput, 60000, terminatingOutput, selfContained: selfContained); - Assert.Contains("Now listening on: http://localhost:5000", commandOutput); - Assert.Contains(terminatingOutput, commandOutput); + RunApp (target, out string commandOutput, 60000, terminatingOutput, selfContained: selfContained); + Assert.Contains ("Now listening on: http://localhost:5000", commandOutput); + Assert.Contains (terminatingOutput, commandOutput); } } } diff --git a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.cs b/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.cs index bbae3a027..3bb0d16cd 100644 --- a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.cs +++ b/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.cs @@ -18,7 +18,7 @@ namespace ILLink.Tasks.Tests // the task -> response file -> parsed arguments -> options on LinkContext public class TaskArgumentTests { - public static IEnumerable<object []> AssemblyPathsCases => new List<object []> { + public static IEnumerable<object[]> AssemblyPathsCases => new List<object[]> { new object [] { new ITaskItem [] { new TaskItem ("Assembly.dll", new Dictionary<string, string> { { "action", "copy" } }) @@ -59,7 +59,7 @@ namespace ILLink.Tasks.Tests [Theory] [MemberData (nameof (AssemblyPathsCases))] - public void TestAssemblyPaths (ITaskItem [] assemblyPaths) + public void TestAssemblyPaths (ITaskItem[] assemblyPaths) { var task = new MockTask () { AssemblyPaths = assemblyPaths @@ -78,8 +78,8 @@ namespace ILLink.Tasks.Tests var action = item.GetMetadata ("action"); if (String.IsNullOrEmpty (action)) continue; - AssemblyAction expectedAction = (AssemblyAction)Enum.Parse (typeof(AssemblyAction), action, ignoreCase: true); - AssemblyAction actualAction = (AssemblyAction) context.Actions [Path.GetFileNameWithoutExtension (assemblyPath)]; + AssemblyAction expectedAction = (AssemblyAction) Enum.Parse (typeof (AssemblyAction), action, ignoreCase: true); + AssemblyAction actualAction = (AssemblyAction) context.Actions[Path.GetFileNameWithoutExtension (assemblyPath)]; Assert.Equal (expectedAction, actualAction); } } @@ -89,18 +89,18 @@ namespace ILLink.Tasks.Tests public void TestAssemblyPathsWithInvalidAction () { var task = new MockTask () { - AssemblyPaths = new ITaskItem [] { new TaskItem ("Assembly.dll", new Dictionary<string, string> { { "action", "invalid" } }) } + AssemblyPaths = new ITaskItem[] { new TaskItem ("Assembly.dll", new Dictionary<string, string> { { "action", "invalid" } }) } }; - Assert.Throws <ArgumentException> (() => task.CreateDriver ()); + Assert.Throws<ArgumentException> (() => task.CreateDriver ()); } // the InlineData string [] parameters are wrapped in object [] as described in https://github.com/xunit/xunit/issues/2060 [Theory] - [InlineData (new object [] { new string [] { "path/to/Assembly.dll" } })] - [InlineData (new object [] { new string [] { "path with/spaces/Assembly.dll" } })] - [InlineData (new object [] { new string [] { "path/to/Assembly With Spaces.dll" } })] - public void TestReferenceAssemblyPaths (string [] referenceAssemblyPaths) + [InlineData (new object[] { new string[] { "path/to/Assembly.dll" } })] + [InlineData (new object[] { new string[] { "path with/spaces/Assembly.dll" } })] + [InlineData (new object[] { new string[] { "path/to/Assembly With Spaces.dll" } })] + public void TestReferenceAssemblyPaths (string[] referenceAssemblyPaths) { var task = new MockTask () { ReferenceAssemblyPaths = referenceAssemblyPaths.Select (p => new TaskItem (p)).ToArray () @@ -111,15 +111,15 @@ namespace ILLink.Tasks.Tests Assert.Equal (expectedReferences.OrderBy (a => a), actualReferences.OrderBy (a => a)); foreach (var reference in expectedReferences) { var referenceName = Path.GetFileNameWithoutExtension (reference); - var actualAction = driver.Context.Actions [referenceName]; + var actualAction = driver.Context.Actions[referenceName]; Assert.Equal (AssemblyAction.Skip, actualAction); } } } [Theory] - [InlineData (new object [] { new string [] { "AssemblyName" } })] - public void TestRootAssemblyNames (string [] rootAssemblyNames) + [InlineData (new object[] { new string[] { "AssemblyName" } })] + public void TestRootAssemblyNames (string[] rootAssemblyNames) { var task = new MockTask () { RootAssemblyNames = rootAssemblyNames.Select (a => new TaskItem (a)).ToArray () @@ -146,11 +146,11 @@ namespace ILLink.Tasks.Tests } [Theory] - [InlineData (new object [] { new string [] { "path/to/descriptor.xml" } })] - [InlineData (new object [] { new string [] { "path with/spaces/descriptor.xml" } })] - [InlineData (new object [] { new string [] { "descriptor with spaces.xml" } })] - [InlineData (new object [] { new string [] { "descriptor1.xml", "descriptor2.xml" } })] - public void TestRootDescriptorFiles (string [] rootDescriptorFiles) + [InlineData (new object[] { new string[] { "path/to/descriptor.xml" } })] + [InlineData (new object[] { new string[] { "path with/spaces/descriptor.xml" } })] + [InlineData (new object[] { new string[] { "descriptor with spaces.xml" } })] + [InlineData (new object[] { new string[] { "descriptor1.xml", "descriptor2.xml" } })] + public void TestRootDescriptorFiles (string[] rootDescriptorFiles) { var task = new MockTask () { RootDescriptorFiles = rootDescriptorFiles.Select (f => new TaskItem (f)).ToArray () @@ -161,10 +161,11 @@ namespace ILLink.Tasks.Tests } } - public static IEnumerable<object []> OptimizationsCases () { + public static IEnumerable<object[]> OptimizationsCases () + { foreach (var optimization in MockTask.OptimizationNames) { - yield return new object [] { optimization, true }; - yield return new object [] { optimization, false }; + yield return new object[] { optimization, true }; + yield return new object[] { optimization, false }; } } @@ -182,17 +183,18 @@ namespace ILLink.Tasks.Tests } } - public static IEnumerable<object []> PerAssemblyOptimizationsCases () { + public static IEnumerable<object[]> PerAssemblyOptimizationsCases () + { // test that we can individually enable/disable each optimization foreach (var optimization in MockTask.OptimizationNames) { - yield return new object [] { + yield return new object[] { new ITaskItem [] { new TaskItem ("path/to/Assembly.dll", new Dictionary<string, string> { { optimization, "True" } }) } }; - yield return new object [] { + yield return new object[] { new ITaskItem [] { new TaskItem ("path/to/Assembly.dll", new Dictionary<string, string> { { optimization, "False" } @@ -201,7 +203,7 @@ namespace ILLink.Tasks.Tests }; } // complex case with multiple optimizations, assemblies - yield return new object [] { + yield return new object[] { new ITaskItem [] { new TaskItem ("path/to/Assembly1.dll", new Dictionary<string, string> { { "ClearInitLocals", "True" }, @@ -217,7 +219,7 @@ namespace ILLink.Tasks.Tests [Theory] [MemberData (nameof (PerAssemblyOptimizationsCases))] - public void TestPerAssemblyOptimizations (ITaskItem [] assemblyPaths) + public void TestPerAssemblyOptimizations (ITaskItem[] assemblyPaths) { var task = new MockTask () { AssemblyPaths = assemblyPaths @@ -242,7 +244,7 @@ namespace ILLink.Tasks.Tests public void TestInvalidPerAssemblyOptimizations () { var task = new MockTask () { - AssemblyPaths = new ITaskItem [] { + AssemblyPaths = new ITaskItem[] { new TaskItem ("path/to/Assembly.dll", new Dictionary<string, string> { { "ClearInitLocals", "invalid" } }) @@ -304,7 +306,7 @@ namespace ILLink.Tasks.Tests } } - public static IEnumerable<object []> FeatureSettingsCases => new List<object []> { + public static IEnumerable<object[]> FeatureSettingsCases => new List<object[]> { new object [] { new ITaskItem [] { new TaskItem ("FeatureName", new Dictionary<string, string> { { "Value", "true" } }) @@ -326,7 +328,7 @@ namespace ILLink.Tasks.Tests [Theory] [MemberData (nameof (FeatureSettingsCases))] - public void TestFeatureSettings (ITaskItem [] featureSettings) + public void TestFeatureSettings (ITaskItem[] featureSettings) { var task = new MockTask () { FeatureSettings = featureSettings @@ -334,8 +336,8 @@ namespace ILLink.Tasks.Tests using (var driver = task.CreateDriver ()) { var expectedSettings = featureSettings.Select (f => new { Feature = f.ItemSpec, Value = f.GetMetadata ("Value") }) .GroupBy (f => f.Feature) - .Select (f => f.Last()) - .ToDictionary (f => f.Feature, f => bool.Parse(f.Value)); + .Select (f => f.Last ()) + .ToDictionary (f => f.Feature, f => bool.Parse (f.Value)); var actualSettings = driver.Context.FeatureSettings; Assert.Equal (expectedSettings, actualSettings); } @@ -345,9 +347,9 @@ namespace ILLink.Tasks.Tests public void TestInvalidFeatureSettings () { var task = new MockTask () { - FeatureSettings = new ITaskItem [] { new TaskItem ("FeatureName") } + FeatureSettings = new ITaskItem[] { new TaskItem ("FeatureName") } }; - Assert.Throws <ArgumentException> (() => task.CreateDriver ()); + Assert.Throws<ArgumentException> (() => task.CreateDriver ()); } [Fact] @@ -375,7 +377,7 @@ namespace ILLink.Tasks.Tests using (var driver = task.CreateDriver ()) { Assert.Equal (dumpDependencies, driver.GetDependencyRecorders ()?.Single () == MockXmlDependencyRecorder.Singleton); } - } + } [Theory] [InlineData (true)] @@ -400,7 +402,7 @@ namespace ILLink.Tasks.Tests DefaultAction = defaultAction }; using (var driver = task.CreateDriver ()) { - var expectedAction = (AssemblyAction)Enum.Parse (typeof(AssemblyAction), defaultAction, ignoreCase: true); + var expectedAction = (AssemblyAction) Enum.Parse (typeof (AssemblyAction), defaultAction, ignoreCase: true); Assert.Equal (expectedAction, driver.Context.CoreAction); Assert.Equal (expectedAction, driver.Context.UserAction); } @@ -412,10 +414,10 @@ namespace ILLink.Tasks.Tests var task = new MockTask () { DefaultAction = "invalid" }; - Assert.Throws <ArgumentException> (() => task.CreateDriver ()); + Assert.Throws<ArgumentException> (() => task.CreateDriver ()); } - public static IEnumerable<object []> CustomStepsCases => new List<object []> { + public static IEnumerable<object[]> CustomStepsCases => new List<object[]> { new object [] { new ITaskItem [] { new TaskItem (Assembly.GetExecutingAssembly ().Location, new Dictionary<string, string> { @@ -463,7 +465,7 @@ namespace ILLink.Tasks.Tests [Theory] [MemberData (nameof (CustomStepsCases))] - public void TestCustomSteps (ITaskItem [] customSteps) + public void TestCustomSteps (ITaskItem[] customSteps) { var task = new MockTask () { CustomSteps = customSteps @@ -493,7 +495,7 @@ namespace ILLink.Tasks.Tests [Fact] public void TestCustomStepsWithBeforeAndAfterSteps () { - var customSteps = new ITaskItem [] { + var customSteps = new ITaskItem[] { new TaskItem (Assembly.GetExecutingAssembly ().Location, new Dictionary<string, string> { { "Type", "ILLink.Tasks.Tests.MockCustomStep" }, { "BeforeStep", "MarkStep" }, @@ -503,19 +505,19 @@ namespace ILLink.Tasks.Tests var task = new MockTask () { CustomSteps = customSteps }; - Assert.Throws <ArgumentException> (() => task.CreateDriver ()); + Assert.Throws<ArgumentException> (() => task.CreateDriver ()); } [Fact] public void TestCustomStepsMissingType () { - var customSteps = new ITaskItem [] { + var customSteps = new ITaskItem[] { new TaskItem (Assembly.GetExecutingAssembly ().Location) }; var task = new MockTask () { CustomSteps = customSteps }; - Assert.Throws <ArgumentException> (() => task.CreateDriver ()); + Assert.Throws<ArgumentException> (() => task.CreateDriver ()); } } } diff --git a/test/ILLink.Tasks.Tests/Mock.cs b/test/ILLink.Tasks.Tests/Mock.cs index 723039b31..5d7a51690 100644 --- a/test/ILLink.Tasks.Tests/Mock.cs +++ b/test/ILLink.Tasks.Tests/Mock.cs @@ -11,39 +11,43 @@ namespace ILLink.Tasks.Tests { public class MockTask : ILLink { - public MockTask () { + public MockTask () + { // Ensure that [Required] members are non-null - AssemblyPaths = new ITaskItem [0]; - RootAssemblyNames = new ITaskItem [0]; + AssemblyPaths = new ITaskItem[0]; + RootAssemblyNames = new ITaskItem[0]; } - public MockDriver CreateDriver () { - string [] responseFileLines = GenerateResponseFileCommands ().Split (Environment.NewLine); + public MockDriver CreateDriver () + { + string[] responseFileLines = GenerateResponseFileCommands ().Split (Environment.NewLine); var arguments = new Queue<string> (); Driver.ParseResponseFileLines (responseFileLines, arguments); return new MockDriver (arguments); } - public static string [] OptimizationNames { + public static string[] OptimizationNames { get { var field = typeof (ILLink).GetField ("_optimizationNames", BindingFlags.NonPublic | BindingFlags.Static); - var value = (string []) (field.GetValue (null)); + var value = (string[]) (field.GetValue (null)); return value; } } - public void SetOptimization (string optimization, bool enabled) { + public void SetOptimization (string optimization, bool enabled) + { var property = typeof (ILLink).GetProperty (optimization); var setter = property.GetSetMethod (); - property.GetSetMethod ().Invoke (this, new object [] { enabled }); + property.GetSetMethod ().Invoke (this, new object[] { enabled }); } - static readonly string [] nonOptimizationBooleanProperties = new string [] { + static readonly string[] nonOptimizationBooleanProperties = new string[] { "DumpDependencies", "LinkSymbols" }; - public static IEnumerable<string> GetOptimizationPropertyNames () { + public static IEnumerable<string> GetOptimizationPropertyNames () + { foreach (var property in typeof (ILLink).GetProperties (BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance)) { if (property.PropertyType != typeof (bool)) continue; @@ -56,7 +60,8 @@ namespace ILLink.Tasks.Tests public class MockDriver : Driver { - public MockDriver (Queue<string> arguments) : base (arguments) { + public MockDriver (Queue<string> arguments) : base (arguments) + { // Always add a dummy root assembly for testing purposes (otherwise Driver fails without roots). arguments.Enqueue ("-a"); arguments.Enqueue ("DummyRootAssembly"); @@ -66,32 +71,35 @@ namespace ILLink.Tasks.Tests public LinkContext Context => context; - public IEnumerable<string> GetRootAssemblies () { + public IEnumerable<string> GetRootAssemblies () + { foreach (var step in context.Pipeline.GetSteps ()) { if (!(step is ResolveFromAssemblyStep)) continue; - var assemblyName = (string)(typeof (ResolveFromAssemblyStep).GetField ("_file", BindingFlags.NonPublic | BindingFlags.Instance).GetValue (step)); + var assemblyName = (string) (typeof (ResolveFromAssemblyStep).GetField ("_file", BindingFlags.NonPublic | BindingFlags.Instance).GetValue (step)); if (assemblyName == "DummyRootAssembly") continue; - + yield return assemblyName; } } - public IEnumerable<string> GetRootDescriptors () { + public IEnumerable<string> GetRootDescriptors () + { foreach (var step in context.Pipeline.GetSteps ()) { if (!(step is ResolveFromXmlStep)) continue; - var descriptor = (string)(typeof (ResolveFromXmlStep).GetField ("_xmlDocumentLocation", BindingFlags.NonPublic | BindingFlags.Instance).GetValue (step)); + var descriptor = (string) (typeof (ResolveFromXmlStep).GetField ("_xmlDocumentLocation", BindingFlags.NonPublic | BindingFlags.Instance).GetValue (step)); yield return descriptor; } } - public IEnumerable<string> GetReferenceAssemblies () { - return (IEnumerable<string>)(typeof (AssemblyResolver).GetField ("_references", BindingFlags.NonPublic | BindingFlags.Instance).GetValue (context.Resolver)); + public IEnumerable<string> GetReferenceAssemblies () + { + return (IEnumerable<string>) (typeof (AssemblyResolver).GetField ("_references", BindingFlags.NonPublic | BindingFlags.Instance).GetValue (context.Resolver)); } protected override void AddResolveFromXmlStep (Pipeline pipeline, string file) @@ -106,19 +114,22 @@ namespace ILLink.Tasks.Tests Context.Tracer.AddRecorder (MockXmlDependencyRecorder.Singleton); } - public IEnumerable<IDependencyRecorder> GetDependencyRecorders () { - return (IEnumerable<IDependencyRecorder>)(typeof (Tracer).GetField ("recorders", BindingFlags.NonPublic | BindingFlags.Instance).GetValue (context.Tracer)); + public IEnumerable<IDependencyRecorder> GetDependencyRecorders () + { + return (IEnumerable<IDependencyRecorder>) (typeof (Tracer).GetField ("recorders", BindingFlags.NonPublic | BindingFlags.Instance).GetValue (context.Tracer)); } - public static bool GetOptimizationName (string optimization, out CodeOptimizations codeOptimizations) { - var method = typeof (Driver).GetMethod ("GetOptimizationName", BindingFlags.NonPublic | BindingFlags.Static); - var parameters = new object [] { optimization, null }; + public static bool GetOptimizationName (string optimization, out CodeOptimizations codeOptimizations) + { + var method = typeof (Driver).GetMethod ("GetOptimizationName", BindingFlags.NonPublic | BindingFlags.Static); + var parameters = new object[] { optimization, null }; var ret = (bool) (method.Invoke (null, parameters)); - codeOptimizations = (CodeOptimizations) (parameters [1]); + codeOptimizations = (CodeOptimizations) (parameters[1]); return ret; } - public CodeOptimizations GetDefaultOptimizations () { + public CodeOptimizations GetDefaultOptimizations () + { var context = base.GetDefaultContext (null); return context.Optimizations.Global; } @@ -127,13 +138,13 @@ namespace ILLink.Tasks.Tests public class MockXmlDependencyRecorder : IDependencyRecorder { public static MockXmlDependencyRecorder Singleton = new MockXmlDependencyRecorder (); - public void RecordDependency (object source, object arget, bool marked) {} - public void RecordDependency (object target, in DependencyInfo reason, bool marked) {} + public void RecordDependency (object source, object arget, bool marked) { } + public void RecordDependency (object target, in DependencyInfo reason, bool marked) { } } public class MockCustomStep : IStep { - public void Process (LinkContext context) {} + public void Process (LinkContext context) { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/AddedPseudoAttributeAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/AddedPseudoAttributeAttribute.cs index 93f47e2dd..bed874f0f 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/AddedPseudoAttributeAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/AddedPseudoAttributeAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event, AllowMultiple = true, Inherited = false)] - public class AddedPseudoAttributeAttribute : BaseExpectedLinkedBehaviorAttribute { + public class AddedPseudoAttributeAttribute : BaseExpectedLinkedBehaviorAttribute + { public AddedPseudoAttributeAttribute (uint value) { } diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseExpectedLinkedBehaviorAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseExpectedLinkedBehaviorAttribute.cs index 47f0f3415..b7f7b9f79 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseExpectedLinkedBehaviorAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseExpectedLinkedBehaviorAttribute.cs @@ -1,11 +1,13 @@ using System; using System.Diagnostics; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ /// <summary> /// Base attribute for attributes that mark up the expected behavior of the linker on a member /// </summary> - [Conditional("INCLUDE_EXPECTATIONS")] - public abstract class BaseExpectedLinkedBehaviorAttribute : Attribute { + [Conditional ("INCLUDE_EXPECTATIONS")] + public abstract class BaseExpectedLinkedBehaviorAttribute : Attribute + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseInAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseInAssemblyAttribute.cs index df1a80a13..7b442c851 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseInAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseInAssemblyAttribute.cs @@ -1,5 +1,6 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - public abstract class BaseInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute { + public abstract class BaseInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute + { } } diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/CreatedMemberAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/CreatedMemberAttribute.cs index 2b5fb0332..b51bf3e5d 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/CreatedMemberAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/CreatedMemberAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate | AttributeTargets.Struct | AttributeTargets.Enum, AllowMultiple = true, Inherited = false)] - public sealed class CreatedMemberAttribute : BaseExpectedLinkedBehaviorAttribute { + public sealed class CreatedMemberAttribute : BaseExpectedLinkedBehaviorAttribute + { public CreatedMemberAttribute (string name) { diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/DependencyRecordedAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/DependencyRecordedAttribute.cs index e1bba7364..46f7cb43e 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/DependencyRecordedAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/DependencyRecordedAttribute.cs @@ -5,7 +5,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] public class DependencyRecordedAttribute : BaseExpectedLinkedBehaviorAttribute { - public DependencyRecordedAttribute(string source, string target, string marked = null) + public DependencyRecordedAttribute (string source, string target, string marked = null) { if (string.IsNullOrEmpty (source)) throw new ArgumentException ("Value cannot be null or empty.", nameof (source)); diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectBodyModifiedAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectBodyModifiedAttribute.cs index 078e1d873..a547d4b6f 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectBodyModifiedAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectBodyModifiedAttribute.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)] - public class ExpectBodyModifiedAttribute : BaseInAssemblyAttribute { + public class ExpectBodyModifiedAttribute : BaseInAssemblyAttribute + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectExceptionHandlersModifiedAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectExceptionHandlersModifiedAttribute.cs index 3ad662d85..b8f540f83 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectExceptionHandlersModifiedAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectExceptionHandlersModifiedAttribute.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)] - public class ExpectExceptionHandlersModifiedAttribute : BaseInAssemblyAttribute { + public class ExpectExceptionHandlersModifiedAttribute : BaseInAssemblyAttribute + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectLocalsModifiedAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectLocalsModifiedAttribute.cs index f168e5fc2..f281b8924 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectLocalsModifiedAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectLocalsModifiedAttribute.cs @@ -3,6 +3,7 @@ using System; namespace Mono.Linker.Tests.Cases.Expectations.Assertions { [AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)] - public class ExpectLocalsModifiedAttribute : BaseInAssemblyAttribute { + public class ExpectLocalsModifiedAttribute : BaseInAssemblyAttribute + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedExceptionHandlerSequenceAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedExceptionHandlerSequenceAttribute.cs index e5071b967..a90456dc6 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedExceptionHandlerSequenceAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedExceptionHandlerSequenceAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)] - public class ExpectedExceptionHandlerSequenceAttribute : BaseInAssemblyAttribute { + public class ExpectedExceptionHandlerSequenceAttribute : BaseInAssemblyAttribute + { public ExpectedExceptionHandlerSequenceAttribute (string[] types) { if (types == null) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedInstructionSequenceAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedInstructionSequenceAttribute.cs index 57c87ef64..5254351f5 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedInstructionSequenceAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedInstructionSequenceAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)] - public class ExpectedInstructionSequenceAttribute : BaseInAssemblyAttribute { + public class ExpectedInstructionSequenceAttribute : BaseInAssemblyAttribute + { public ExpectedInstructionSequenceAttribute (string[] opCodes) { if (opCodes == null) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedLocalsSequenceAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedLocalsSequenceAttribute.cs index 73d220588..6eea5b561 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedLocalsSequenceAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedLocalsSequenceAttribute.cs @@ -1,15 +1,17 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)] - public class ExpectedLocalsSequenceAttribute : BaseInAssemblyAttribute { - public ExpectedLocalsSequenceAttribute (string [] types) + public class ExpectedLocalsSequenceAttribute : BaseInAssemblyAttribute + { + public ExpectedLocalsSequenceAttribute (string[] types) { if (types == null) throw new ArgumentNullException (); } - public ExpectedLocalsSequenceAttribute (Type [] types) + public ExpectedLocalsSequenceAttribute (Type[] types) { if (types == null) throw new ArgumentNullException (); diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs index cf6d75094..6595766d0 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class)] - public class IgnoreTestCaseAttribute : Attribute { + public class IgnoreTestCaseAttribute : Attribute + { public IgnoreTestCaseAttribute (string reason) { diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAllTypesAndMembersInAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAllTypesAndMembersInAssemblyAttribute.cs index 66e1380a0..9146b55dd 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAllTypesAndMembersInAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAllTypesAndMembersInAssemblyAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] - public class KeptAllTypesAndMembersInAssemblyAttribute : BaseInAssemblyAttribute { + public class KeptAllTypesAndMembersInAssemblyAttribute : BaseInAssemblyAttribute + { public KeptAllTypesAndMembersInAssemblyAttribute (string assemblyFileName) { if (string.IsNullOrEmpty (assemblyFileName)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs index 5107bdef2..117ae03a1 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs @@ -1,11 +1,13 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ /// <summary> /// Verifies that an assembly does exist in the output directory /// </summary> [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] - public class KeptAssemblyAttribute : KeptAttribute { + public class KeptAssemblyAttribute : KeptAttribute + { public KeptAssemblyAttribute (string fileName) { diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttribute.cs index 837c97152..9c72126ee 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttribute.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.All, Inherited = false)] - public class KeptAttribute : BaseExpectedLinkedBehaviorAttribute { + public class KeptAttribute : BaseExpectedLinkedBehaviorAttribute + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs index c09982a5a..fcd4c4d2b 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Mono.Linker.Tests.Cases.Expectations.Assertions { diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeInAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeInAssemblyAttribute.cs index 266d8aae7..216eacfe0 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeInAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeInAssemblyAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class KeptAttributeInAssemblyAttribute : BaseInAssemblyAttribute { + public class KeptAttributeInAssemblyAttribute : BaseInAssemblyAttribute + { /// <summary> /// Asserts a CustomAttribute was kept on an assembly /// </summary> @@ -11,7 +13,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { public KeptAttributeInAssemblyAttribute (string assemblyName, string attributeTypeName) { } - + /// <summary> /// Asserts a CustomAttribute was kept on an assembly /// </summary> @@ -20,7 +22,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { public KeptAttributeInAssemblyAttribute (string assemblyName, Type attributeType) { } - + /// <summary> /// Asserts a CustomAttribute was kept on a specific type /// </summary> @@ -30,7 +32,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { public KeptAttributeInAssemblyAttribute (string assemblyName, string attributeTypeName, string onType) { } - + /// <summary> /// Asserts a CustomAttribute was kept on a specific type /// </summary> @@ -40,7 +42,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { public KeptAttributeInAssemblyAttribute (string assemblyName, Type attributeType, Type onType) { } - + /// <summary> /// Asserts a CustomAttribute was kept on a member in a specific type /// </summary> diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeOnFixedBufferTypeAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeOnFixedBufferTypeAttribute.cs index 91145dae1..afc41a82d 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeOnFixedBufferTypeAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeOnFixedBufferTypeAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Field, Inherited = false, AllowMultiple = true)] - public class KeptAttributeOnFixedBufferTypeAttribute : KeptAttribute { + public class KeptAttributeOnFixedBufferTypeAttribute : KeptAttribute + { public KeptAttributeOnFixedBufferTypeAttribute (string attributeName) { if (string.IsNullOrEmpty (attributeName)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBackingFieldAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBackingFieldAttribute.cs index b21ce0628..14367f71a 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBackingFieldAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBackingFieldAttribute.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Event, AllowMultiple = false, Inherited = false)] - public sealed class KeptBackingFieldAttribute : KeptAttribute { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ + [AttributeUsage (AttributeTargets.Property | AttributeTargets.Event, AllowMultiple = false, Inherited = false)] + public sealed class KeptBackingFieldAttribute : KeptAttribute + { } } diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseOnTypeInAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseOnTypeInAssemblyAttribute.cs index 2d3e74956..ff95aaf56 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseOnTypeInAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseOnTypeInAssemblyAttribute.cs @@ -1,15 +1,17 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class KeptBaseOnTypeInAssemblyAttribute : BaseInAssemblyAttribute { +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) @@ -22,7 +24,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { 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)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptDelegateCacheFieldAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptDelegateCacheFieldAttribute.cs index 79d7a6f07..7b29dac42 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptDelegateCacheFieldAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptDelegateCacheFieldAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = true)] - public class KeptDelegateCacheFieldAttribute : KeptAttribute { + public class KeptDelegateCacheFieldAttribute : KeptAttribute + { public KeptDelegateCacheFieldAttribute (string uniquePartOfName) { if (string.IsNullOrEmpty (uniquePartOfName)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptEventAddMethodAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptEventAddMethodAttribute.cs index 34e65d4ea..f37e3946e 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptEventAddMethodAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptEventAddMethodAttribute.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Event, Inherited = false, AllowMultiple = false)] - public class KeptEventAddMethodAttribute : KeptAttribute { + public class KeptEventAddMethodAttribute : KeptAttribute + { } } diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptEventRemoveMethodAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptEventRemoveMethodAttribute.cs index d64cf9b38..610519e99 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptEventRemoveMethodAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptEventRemoveMethodAttribute.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Event, Inherited = false, AllowMultiple = false)] - public class KeptEventRemoveMethodAttribute : KeptAttribute { + public class KeptEventRemoveMethodAttribute : KeptAttribute + { } } diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptFixedBufferAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptFixedBufferAttribute.cs index 5b5879699..8b0df770d 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptFixedBufferAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptFixedBufferAttribute.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Field, Inherited = false, AllowMultiple = false)] - public class KeptFixedBufferAttribute : KeptAttribute { + public class KeptFixedBufferAttribute : KeptAttribute + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInitializerData.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInitializerData.cs index 3fe20f9a7..b2c5647f0 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInitializerData.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInitializerData.cs @@ -1,13 +1,15 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Method, AllowMultiple = true, Inherited = false)] - public class KeptInitializerData : KeptAttribute { + public class KeptInitializerData : KeptAttribute + { public KeptInitializerData () { } - + public KeptInitializerData (int occurrenceIndexInBody) { if (occurrenceIndexInBody < 0) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs index b04223645..66fe2c490 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs @@ -11,7 +11,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions if (interfaceType == null) throw new ArgumentNullException (nameof (interfaceType)); } - + public KeptInterfaceAttribute (Type interfaceType, params object[] typeArguments) { if (interfaceType == null) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceOnTypeInAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceOnTypeInAssemblyAttribute.cs index bcbf6744a..802189543 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceOnTypeInAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceOnTypeInAssemblyAttribute.cs @@ -1,15 +1,17 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class KeptInterfaceOnTypeInAssemblyAttribute : BaseInAssemblyAttribute { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ + [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] + public class KeptInterfaceOnTypeInAssemblyAttribute : BaseInAssemblyAttribute + { public KeptInterfaceOnTypeInAssemblyAttribute (string assemblyFileName, Type type, string interfaceAssemblyFileName, Type interfaceType) { 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 (interfaceAssemblyFileName)) throw new ArgumentException ("Value cannot be null or empty.", nameof (interfaceAssemblyFileName)); if (interfaceType == null) @@ -22,7 +24,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { 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 (interfaceAssemblyFileName)) throw new ArgumentException ("Value cannot be null or empty.", nameof (interfaceAssemblyFileName)); if (string.IsNullOrEmpty (interfaceTypeName)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs index 6c9d1bfdd..4082fe4c8 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate | AttributeTargets.Struct | AttributeTargets.Enum, AllowMultiple = true, Inherited = false)] - public sealed class KeptMemberAttribute : KeptAttribute { + public sealed class KeptMemberAttribute : KeptAttribute + { public KeptMemberAttribute (string name) { diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberInAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberInAssemblyAttribute.cs index fed2061ea..f291db5fb 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberInAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberInAssemblyAttribute.cs @@ -1,11 +1,13 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] - public class KeptMemberInAssemblyAttribute : BaseInAssemblyAttribute { + public class KeptMemberInAssemblyAttribute : BaseInAssemblyAttribute + { - public KeptMemberInAssemblyAttribute (string assemblyFileName, Type type, params string [] memberNames) + public KeptMemberInAssemblyAttribute (string assemblyFileName, Type type, params string[] memberNames) { if (string.IsNullOrEmpty (assemblyFileName)) throw new ArgumentNullException (nameof (assemblyFileName)); @@ -15,7 +17,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { throw new ArgumentNullException (nameof (memberNames)); } - public KeptMemberInAssemblyAttribute (string assemblyFileName, string typeName, params string [] memberNames) + public KeptMemberInAssemblyAttribute (string assemblyFileName, string typeName, params string[] memberNames) { if (string.IsNullOrEmpty (assemblyFileName)) throw new ArgumentNullException (nameof (assemblyFileName)); diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptReferenceAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptReferenceAttribute.cs index 4ca94624a..8e5094004 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptReferenceAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptReferenceAttribute.cs @@ -1,11 +1,13 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ /// <summary> /// Verifies that a reference exists in the test case assembly /// </summary> [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class KeptReferenceAttribute : KeptAttribute { + public class KeptReferenceAttribute : KeptAttribute + { public KeptReferenceAttribute (string name) { if (string.IsNullOrEmpty (name)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptReferencesInAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptReferencesInAssemblyAttribute.cs index f83a67c3e..644077a13 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptReferencesInAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptReferencesInAssemblyAttribute.cs @@ -1,9 +1,11 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class KeptReferencesInAssemblyAttribute : BaseInAssemblyAttribute { - public KeptReferencesInAssemblyAttribute (string assemblyFileName, string [] expectedReferenceAssemblyNames) + public class KeptReferencesInAssemblyAttribute : BaseInAssemblyAttribute + { + public KeptReferencesInAssemblyAttribute (string assemblyFileName, string[] expectedReferenceAssemblyNames) { if (string.IsNullOrEmpty (assemblyFileName)) throw new ArgumentNullException (nameof (assemblyFileName)); diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceAttribute.cs index 0106dfd1a..4aab1e908 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceAttribute.cs @@ -1,11 +1,13 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ /// <summary> /// Verifies that a resource exists in the test case assembly /// </summary> [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class KeptResourceAttribute : KeptAttribute { + public class KeptResourceAttribute : KeptAttribute + { public KeptResourceAttribute (string name) { if (string.IsNullOrEmpty (name)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceInAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceInAssemblyAttribute.cs index c17fed964..6bbb9c28f 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceInAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceInAssemblyAttribute.cs @@ -1,11 +1,13 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ /// <summary> /// Verifies that an embedded resource exists in an assembly /// </summary> [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class KeptResourceInAssemblyAttribute : BaseInAssemblyAttribute { + public class KeptResourceInAssemblyAttribute : BaseInAssemblyAttribute + { public KeptResourceInAssemblyAttribute (string assemblyFileName, string resourceName) { if (string.IsNullOrEmpty (assemblyFileName)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptSecurityAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptSecurityAttribute.cs index e25905630..7c66e8058 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptSecurityAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptSecurityAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly | AttributeTargets.Method, AllowMultiple = true, Inherited = false)] - public class KeptSecurityAttribute : KeptAttribute { + public class KeptSecurityAttribute : KeptAttribute + { public KeptSecurityAttribute (string attributeName) { if (string.IsNullOrEmpty (attributeName)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptSymbolsAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptSymbolsAttribute.cs index 897c0b3fa..619d8f880 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptSymbolsAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptSymbolsAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class KeptSymbolsAttribute : KeptAttribute { + public class KeptSymbolsAttribute : KeptAttribute + { public KeptSymbolsAttribute (string assemblyFileName) { if (string.IsNullOrEmpty (assemblyFileName)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptTypeInAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptTypeInAssemblyAttribute.cs index b5aee1392..b29c67995 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptTypeInAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptTypeInAssemblyAttribute.cs @@ -2,8 +2,9 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] - public class KeptTypeInAssemblyAttribute : BaseInAssemblyAttribute { + [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] + public class KeptTypeInAssemblyAttribute : BaseInAssemblyAttribute + { public KeptTypeInAssemblyAttribute (string assemblyFileName, Type type) { if (type == null) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/LogContainsAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/LogContainsAttribute.cs index 56cf87af2..10a436a8e 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/LogContainsAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/LogContainsAttribute.cs @@ -2,13 +2,13 @@ using System; namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class LogContainsAttribute : EnableLoggerAttribute - { - public LogContainsAttribute (string message, bool regexMatch = false) - { - if (string.IsNullOrEmpty (message)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (message)); - } - } + [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] + public class LogContainsAttribute : EnableLoggerAttribute + { + public LogContainsAttribute (string message, bool regexMatch = false) + { + if (string.IsNullOrEmpty (message)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (message)); + } + } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/LogDoesNotContainAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/LogDoesNotContainAttribute.cs index 2f5be1881..697623966 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/LogDoesNotContainAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/LogDoesNotContainAttribute.cs @@ -2,13 +2,13 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class LogDoesNotContainAttribute : EnableLoggerAttribute - { - public LogDoesNotContainAttribute (string message) - { - if (string.IsNullOrEmpty (message)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (message)); - } - } + [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] + public class LogDoesNotContainAttribute : EnableLoggerAttribute + { + public LogDoesNotContainAttribute (string message) + { + if (string.IsNullOrEmpty (message)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (message)); + } + } } diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RecognizedReflectionAccessPatternAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RecognizedReflectionAccessPatternAttribute.cs index 7961eb230..324102836 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RecognizedReflectionAccessPatternAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RecognizedReflectionAccessPatternAttribute.cs @@ -31,8 +31,8 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions throw new ArgumentException ("Value cannot be null or empty.", nameof (accessedItemName)); } - public RecognizedReflectionAccessPatternAttribute (Type reflectionMethodType, string reflectionMethodName, Type [] reflectionMethodParameters, - Type accessedItemType, string accessedItemName, string [] accessedItemParameters = null) + public RecognizedReflectionAccessPatternAttribute (Type reflectionMethodType, string reflectionMethodName, Type[] reflectionMethodParameters, + Type accessedItemType, string accessedItemName, string[] accessedItemParameters = null) { if (reflectionMethodType == null) throw new ArgumentException ("Value cannot be null or empty.", nameof (reflectionMethodType)); diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs index 60cab2a3f..e5b4e1184 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs @@ -1,11 +1,13 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ /// <summary> /// Verifies that an assembly does not exist in the output directory /// </summary> [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] - public class RemovedAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute { + public class RemovedAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute + { public RemovedAssemblyAttribute (string fileName) { diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAttributeInAssembly.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAttributeInAssembly.cs index b418357ad..3dd079bae 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAttributeInAssembly.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAttributeInAssembly.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class RemovedAttributeInAssembly : BaseInAssemblyAttribute { + public class RemovedAttributeInAssembly : BaseInAssemblyAttribute + { /// <summary> /// Asserts a CustomAttribute was kept on an assembly /// </summary> @@ -11,7 +13,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { public RemovedAttributeInAssembly (string assemblyName, string attributeTypeName) { } - + /// <summary> /// Asserts a CustomAttribute was kept on an assembly /// </summary> @@ -20,7 +22,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { public RemovedAttributeInAssembly (string assemblyName, Type attributeType) { } - + /// <summary> /// Asserts a CustomAttribute was kept on a specific type /// </summary> @@ -30,7 +32,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { public RemovedAttributeInAssembly (string assemblyName, string attributeTypeName, string onType) { } - + /// <summary> /// Asserts a CustomAttribute was kept on a specific type /// </summary> @@ -40,7 +42,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { public RemovedAttributeInAssembly (string assemblyName, Type attributeType, Type onType) { } - + /// <summary> /// Asserts a CustomAttribute was kept on a member in a specific type /// </summary> diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedInterfaceOnTypeInAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedInterfaceOnTypeInAssemblyAttribute.cs index 169a0cc95..9a7d0a875 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedInterfaceOnTypeInAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedInterfaceOnTypeInAssemblyAttribute.cs @@ -1,15 +1,17 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class RemovedInterfaceOnTypeInAssemblyAttribute : BaseInAssemblyAttribute { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ + [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] + public class RemovedInterfaceOnTypeInAssemblyAttribute : BaseInAssemblyAttribute + { public RemovedInterfaceOnTypeInAssemblyAttribute (string assemblyFileName, Type type, string interfaceAssemblyFileName, Type interfaceType) { 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 (interfaceAssemblyFileName)) throw new ArgumentException ("Value cannot be null or empty.", nameof (interfaceAssemblyFileName)); if (interfaceType == null) @@ -22,7 +24,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { 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 (interfaceAssemblyFileName)) throw new ArgumentException ("Value cannot be null or empty.", nameof (interfaceAssemblyFileName)); if (string.IsNullOrEmpty (interfaceTypeName)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedMemberInAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedMemberInAssemblyAttribute.cs index 36bc435bf..157eb0688 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedMemberInAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedMemberInAssemblyAttribute.cs @@ -1,10 +1,12 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] - public class RemovedMemberInAssemblyAttribute : BaseInAssemblyAttribute { + public class RemovedMemberInAssemblyAttribute : BaseInAssemblyAttribute + { - public RemovedMemberInAssemblyAttribute (string assemblyFileName, Type type, params string [] memberNames) + public RemovedMemberInAssemblyAttribute (string assemblyFileName, Type type, params string[] memberNames) { if (string.IsNullOrEmpty (assemblyFileName)) throw new ArgumentNullException (nameof (assemblyFileName)); @@ -14,7 +16,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { throw new ArgumentNullException (nameof (memberNames)); } - public RemovedMemberInAssemblyAttribute (string assemblyFileName, string typeName, params string [] memberNames) + public RemovedMemberInAssemblyAttribute (string assemblyFileName, string typeName, params string[] memberNames) { if (string.IsNullOrEmpty (assemblyFileName)) throw new ArgumentNullException (nameof (assemblyFileName)); diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedPseudoAttributeAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedPseudoAttributeAttribute.cs index 3a95bfa0d..bee980344 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedPseudoAttributeAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedPseudoAttributeAttribute.cs @@ -1,9 +1,12 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Delegate | AttributeTargets.Interface | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event, AllowMultiple = true, Inherited = false)] - public class RemovedPseudoAttributeAttribute : BaseExpectedLinkedBehaviorAttribute { - public RemovedPseudoAttributeAttribute (uint value) { + public class RemovedPseudoAttributeAttribute : BaseExpectedLinkedBehaviorAttribute + { + public RemovedPseudoAttributeAttribute (uint value) + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedResourceInAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedResourceInAssemblyAttribute.cs index e05b7ed80..d1ebe1e4b 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedResourceInAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedResourceInAssemblyAttribute.cs @@ -1,11 +1,13 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ /// <summary> /// Verifies that an embedded resource was removed from an assembly /// </summary> [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class RemovedResourceInAssemblyAttribute : BaseInAssemblyAttribute { + public class RemovedResourceInAssemblyAttribute : BaseInAssemblyAttribute + { public RemovedResourceInAssemblyAttribute (string assemblyFileName, string resourceName) { if (string.IsNullOrEmpty (assemblyFileName)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedSymbolsAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedSymbolsAttribute.cs index 633617245..9c65aef44 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedSymbolsAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedSymbolsAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class RemovedSymbolsAttribute : BaseExpectedLinkedBehaviorAttribute { + public class RemovedSymbolsAttribute : BaseExpectedLinkedBehaviorAttribute + { public RemovedSymbolsAttribute (string assemblyFileName) { if (string.IsNullOrEmpty (assemblyFileName)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedTypeInAssemblyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedTypeInAssemblyAttribute.cs index 253f5bed2..35c43c0cb 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedTypeInAssemblyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedTypeInAssemblyAttribute.cs @@ -2,8 +2,9 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] - public class RemovedTypeInAssemblyAttribute : BaseInAssemblyAttribute { + [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] + public class RemovedTypeInAssemblyAttribute : BaseInAssemblyAttribute + { public RemovedTypeInAssemblyAttribute (string assemblyFileName, Type type) { if (type == null) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/SkipPeVerifyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/SkipPeVerifyAttribute.cs index eaccabd25..37a37e337 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/SkipPeVerifyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/SkipPeVerifyAttribute.cs @@ -1,6 +1,7 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ public enum SkipPeVerifyForToolchian { diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/UnrecognizedReflectionAccessPatternAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/UnrecognizedReflectionAccessPatternAttribute.cs index af82912e9..35f157272 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/UnrecognizedReflectionAccessPatternAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/UnrecognizedReflectionAccessPatternAttribute.cs @@ -9,7 +9,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions [AttributeUsage (AttributeTargets.Method, AllowMultiple = true, Inherited = false)] public class UnrecognizedReflectionAccessPatternAttribute : BaseExpectedLinkedBehaviorAttribute { - public UnrecognizedReflectionAccessPatternAttribute (Type reflectionMethodType, string reflectionMethodName, Type [] reflectionMethodParameters, + public UnrecognizedReflectionAccessPatternAttribute (Type reflectionMethodType, string reflectionMethodName, Type[] reflectionMethodParameters, string message = null) { if (reflectionMethodType == null) @@ -23,7 +23,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions throw new ArgumentException ("Value cannot be null or empty.", nameof (message)); } - public UnrecognizedReflectionAccessPatternAttribute (Type reflectionMethodType, string reflectionMethodName, string [] reflectionMethodParameters, + public UnrecognizedReflectionAccessPatternAttribute (Type reflectionMethodType, string reflectionMethodName, string[] reflectionMethodParameters, string message = null) { if (reflectionMethodType == null) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/BaseMetadataAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/BaseMetadataAttribute.cs index d98584eab..ed2ee9c9c 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/BaseMetadataAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/BaseMetadataAttribute.cs @@ -3,7 +3,8 @@ using System.Diagnostics; namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - [Conditional("INCLUDE_EXPECTATIONS")] - public abstract class BaseMetadataAttribute : Attribute { + [Conditional ("INCLUDE_EXPECTATIONS")] + public abstract class BaseMetadataAttribute : Attribute + { } } diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/DefineAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/DefineAttribute.cs index 14e95fd4d..903e267ca 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/DefineAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/DefineAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class DefineAttribute : BaseMetadataAttribute { + public class DefineAttribute : BaseMetadataAttribute + { public DefineAttribute (string name) { if (string.IsNullOrEmpty (name)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/Il8nAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/Il8nAttribute.cs index e72692411..5ded992ed 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/Il8nAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/Il8nAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class)] - public sealed class Il8nAttribute : BaseMetadataAttribute { + public sealed class Il8nAttribute : BaseMetadataAttribute + { public readonly string Value; public Il8nAttribute (string value) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/IncludeBlacklistStepAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/IncludeBlacklistStepAttribute.cs index 4144abcf6..a70567e3b 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/IncludeBlacklistStepAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/IncludeBlacklistStepAttribute.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - public sealed class IncludeBlacklistStepAttribute : BaseMetadataAttribute { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ + public sealed class IncludeBlacklistStepAttribute : BaseMetadataAttribute + { public readonly bool Value; public IncludeBlacklistStepAttribute (bool value) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/KeepTypeForwarderOnlyAssembliesAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/KeepTypeForwarderOnlyAssembliesAttribute.cs index ef00ca5f5..22f989148 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/KeepTypeForwarderOnlyAssembliesAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/KeepTypeForwarderOnlyAssembliesAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class)] - public sealed class KeepTypeForwarderOnlyAssembliesAttribute : BaseMetadataAttribute { + public sealed class KeepTypeForwarderOnlyAssembliesAttribute : BaseMetadataAttribute + { public KeepTypeForwarderOnlyAssembliesAttribute (string value) { if (string.IsNullOrEmpty (value)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/NotATestCaseAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/NotATestCaseAttribute.cs index 1fabca331..af9fc07f0 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/NotATestCaseAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/NotATestCaseAttribute.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct)] - public class NotATestCaseAttribute : BaseMetadataAttribute { + public class NotATestCaseAttribute : BaseMetadataAttribute + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs index 0c6fa852d..6737ee89e 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class ReferenceAttribute : BaseMetadataAttribute { + public class ReferenceAttribute : BaseMetadataAttribute + { public ReferenceAttribute (string value) { diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceDependencyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceDependencyAttribute.cs index 9d536a33e..cada81e68 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceDependencyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceDependencyAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class ReferenceDependencyAttribute : BaseMetadataAttribute { + public class ReferenceDependencyAttribute : BaseMetadataAttribute + { public ReferenceDependencyAttribute (string value) { if (string.IsNullOrEmpty (value)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs index b51755dca..eff6ba34b 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs @@ -1,15 +1,17 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SandboxDependencyAttribute : BaseMetadataAttribute { + public class SandboxDependencyAttribute : BaseMetadataAttribute + { public SandboxDependencyAttribute (string relativePathToFile, string destinationFileName = null) { if (string.IsNullOrEmpty (relativePathToFile)) throw new ArgumentException ("Value cannot be null or empty.", nameof (relativePathToFile)); } - + public SandboxDependencyAttribute (Type typeOfSourceFileToInclude, string destinationFileName = null) { if (typeOfSourceFileToInclude == null) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCSharpCompilerToUseAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCSharpCompilerToUseAttribute.cs index 0e86a36de..d7e56721d 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCSharpCompilerToUseAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCSharpCompilerToUseAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)] - public class SetupCSharpCompilerToUseAttribute : BaseMetadataAttribute { + public class SetupCSharpCompilerToUseAttribute : BaseMetadataAttribute + { public SetupCSharpCompilerToUseAttribute (string name) { if (string.IsNullOrEmpty (name)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAfterAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAfterAttribute.cs index dbaddb631..60a54a1a8 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAfterAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAfterAttribute.cs @@ -1,11 +1,13 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ /// <summary> /// Use to compile an assembly after compiling the main test case executabe /// </summary> [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SetupCompileAfterAttribute : BaseMetadataAttribute { + public class SetupCompileAfterAttribute : BaseMetadataAttribute + { public SetupCompileAfterAttribute (string outputName, string[] sourceFiles, string[] references = null, string[] defines = null, string[] resources = null, string additionalArguments = null, string compilerToUse = null) { if (sourceFiles == null) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileArgumentAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileArgumentAttribute.cs index bec6d93c1..99a65529d 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileArgumentAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileArgumentAttribute.cs @@ -1,12 +1,14 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SetupCompileArgumentAttribute : BaseMetadataAttribute { + public class SetupCompileArgumentAttribute : BaseMetadataAttribute + { public SetupCompileArgumentAttribute (string value) { if (string.IsNullOrEmpty (value)) - throw new ArgumentNullException (nameof(value)); + throw new ArgumentNullException (nameof (value)); } } } diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAsLibraryAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAsLibraryAttribute.cs index 1ca047cbd..3bb547301 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAsLibraryAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAsLibraryAttribute.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)] - public class SetupCompileAsLibraryAttribute : BaseMetadataAttribute { + public class SetupCompileAsLibraryAttribute : BaseMetadataAttribute + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAssemblyNameAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAssemblyNameAttribute.cs index ceb0842eb..91930d562 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAssemblyNameAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAssemblyNameAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)] - public class SetupCompileAssemblyNameAttribute : BaseMetadataAttribute { + public class SetupCompileAssemblyNameAttribute : BaseMetadataAttribute + { public SetupCompileAssemblyNameAttribute (string outputName) { if (string.IsNullOrEmpty (outputName)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileBeforeAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileBeforeAttribute.cs index 6b81b6681..54dd63027 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileBeforeAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileBeforeAttribute.cs @@ -1,11 +1,13 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ /// <summary> /// Use to compile an assembly before compiling the main test case executabe /// </summary> [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SetupCompileBeforeAttribute : BaseMetadataAttribute { + public class SetupCompileBeforeAttribute : BaseMetadataAttribute + { public SetupCompileBeforeAttribute (string outputName, string[] sourceFiles, string[] references = null, string[] defines = null, string[] resources = null, string additionalArguments = null, string compilerToUse = null, bool addAsReference = true) { if (sourceFiles == null) @@ -14,7 +16,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Metadata { if (string.IsNullOrEmpty (outputName)) throw new ArgumentException ("Value cannot be null or empty.", nameof (outputName)); } - + public SetupCompileBeforeAttribute (string outputName, Type[] typesToIncludeSourceFor, string[] references = null, string[] defines = null, string[] resources = null, string additionalArguments = null, string compilerToUse = null, bool addAsReference = true) { if (typesToIncludeSourceFor == null) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileResourceAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileResourceAttribute.cs index b86a162c5..fc66f8578 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileResourceAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileResourceAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SetupCompileResourceAttribute : BaseMetadataAttribute { + public class SetupCompileResourceAttribute : BaseMetadataAttribute + { public SetupCompileResourceAttribute (string relativePathToFile, string destinationFileName = null) { if (string.IsNullOrEmpty (relativePathToFile)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerArgumentAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerArgumentAttribute.cs index 802a53fe6..0bd07057a 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerArgumentAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerArgumentAttribute.cs @@ -1,6 +1,7 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ /// <summary> /// Used to define arguments to pass to the linker. @@ -9,8 +10,9 @@ namespace Mono.Linker.Tests.Cases.Expectations.Metadata { /// and although we need to continue to support the usages that exist today, that doesn't mean we need to make our tests harder to read /// </summary> [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SetupLinkerArgumentAttribute : BaseMetadataAttribute { - public SetupLinkerArgumentAttribute (string flag, params string [] values) + public class SetupLinkerArgumentAttribute : BaseMetadataAttribute + { + public SetupLinkerArgumentAttribute (string flag, params string[] values) { if (string.IsNullOrEmpty (flag)) throw new ArgumentNullException (nameof (flag)); diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerKeepDebugMembersAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerKeepDebugMembersAttribute.cs index 9fa23957a..06ab67591 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerKeepDebugMembersAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerKeepDebugMembersAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class)] - public class SetupLinkerKeepDebugMembersAttribute : BaseMetadataAttribute{ + public class SetupLinkerKeepDebugMembersAttribute : BaseMetadataAttribute + { public SetupLinkerKeepDebugMembersAttribute (string value) { if (string.IsNullOrEmpty (value)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerLinkPublicAndFamilyAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerLinkPublicAndFamilyAttribute.cs index d3f3d7091..872e6f1ac 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerLinkPublicAndFamilyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerLinkPublicAndFamilyAttribute.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)] - public class SetupLinkerLinkPublicAndFamilyAttribute : BaseMetadataAttribute { + public class SetupLinkerLinkPublicAndFamilyAttribute : BaseMetadataAttribute + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerLinkSymbolsAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerLinkSymbolsAttribute.cs index 3bcef8610..1ac4d717b 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerLinkSymbolsAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerLinkSymbolsAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class)] - public class SetupLinkerLinkSymbolsAttribute : BaseMetadataAttribute { + public class SetupLinkerLinkSymbolsAttribute : BaseMetadataAttribute + { public SetupLinkerLinkSymbolsAttribute (string value) { if (string.IsNullOrEmpty (value)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerResponseFileAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerResponseFileAttribute.cs index 8ae909446..d52c511ea 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerResponseFileAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerResponseFileAttribute.cs @@ -1,9 +1,11 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SetupLinkerResponseFileAttribute : BaseMetadataAttribute { - public SetupLinkerResponseFileAttribute(string relativePathToFile, string destinationFileName = null) + public class SetupLinkerResponseFileAttribute : BaseMetadataAttribute + { + public SetupLinkerResponseFileAttribute (string relativePathToFile, string destinationFileName = null) { if (string.IsNullOrEmpty (relativePathToFile)) throw new ArgumentException ("Value cannot be null or empty.", nameof (relativePathToFile)); diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerSubstitutionFileAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerSubstitutionFileAttribute.cs index 6a52e5021..9ac3c74c8 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerSubstitutionFileAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerSubstitutionFileAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SetupLinkerSubstitutionFileAttribute : BaseMetadataAttribute { + public class SetupLinkerSubstitutionFileAttribute : BaseMetadataAttribute + { public SetupLinkerSubstitutionFileAttribute (string relativePathToFile, string destinationFileName = null) { if (string.IsNullOrEmpty (relativePathToFile)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerUserActionAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerUserActionAttribute.cs index 6185bbbf5..b20fd9583 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerUserActionAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerUserActionAttribute.cs @@ -1,8 +1,10 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)] - public class SetupLinkerUserActionAttribute : BaseMetadataAttribute { + public class SetupLinkerUserActionAttribute : BaseMetadataAttribute + { public SetupLinkerUserActionAttribute (string action) { if (string.IsNullOrEmpty (action)) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SkipUnresolvedAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SkipUnresolvedAttribute.cs index bee9a7f4f..a8ea2d8d4 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SkipUnresolvedAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SkipUnresolvedAttribute.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - public sealed class SkipUnresolvedAttribute : BaseMetadataAttribute { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ + public sealed class SkipUnresolvedAttribute : BaseMetadataAttribute + { public readonly bool Value; public SkipUnresolvedAttribute (bool value) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripResourcesAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripResourcesAttribute.cs index 97a77fb42..691152a07 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripResourcesAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripResourcesAttribute.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - public sealed class StripResourcesAttribute : BaseMetadataAttribute { +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ + public sealed class StripResourcesAttribute : BaseMetadataAttribute + { public readonly bool Value; public StripResourcesAttribute (bool value) diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Support/DynamicallyAccessedMembersAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Support/DynamicallyAccessedMembersAttribute.cs index d99147303..990d893f7 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Support/DynamicallyAccessedMembersAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Support/DynamicallyAccessedMembersAttribute.cs @@ -22,12 +22,12 @@ namespace System.Runtime.CompilerServices Events = 0b00011000_00000000, } - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.Method, AllowMultiple = false)] + [AttributeUsage (AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.Method, AllowMultiple = false)] public class DynamicallyAccessedMembersAttribute : Attribute { public DynamicallyAccessedMemberKinds MemberKinds { get; } - public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberKinds memberKinds) + public DynamicallyAccessedMembersAttribute (DynamicallyAccessedMemberKinds memberKinds) { MemberKinds = memberKinds; } diff --git a/test/Mono.Linker.Tests.Cases/Advanced/DeadCodeElimination1.cs b/test/Mono.Linker.Tests.Cases/Advanced/DeadCodeElimination1.cs index 339d223b6..78d127633 100644 --- a/test/Mono.Linker.Tests.Cases/Advanced/DeadCodeElimination1.cs +++ b/test/Mono.Linker.Tests.Cases/Advanced/DeadCodeElimination1.cs @@ -1,8 +1,10 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Advanced { +namespace Mono.Linker.Tests.Cases.Advanced +{ [IgnoreTestCase ("We cannot do this yet")] - class DeadCodeElimination1 { + class DeadCodeElimination1 + { public static void Main () { object o = null; @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Advanced { ((B) o).Method (); } - class B { + class B + { public void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Advanced/FieldThatOnlyGetsSetIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Advanced/FieldThatOnlyGetsSetIsRemoved.cs index 8c4933ad2..8aaaf6f73 100644 --- a/test/Mono.Linker.Tests.Cases/Advanced/FieldThatOnlyGetsSetIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Advanced/FieldThatOnlyGetsSetIsRemoved.cs @@ -1,15 +1,18 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Advanced { +namespace Mono.Linker.Tests.Cases.Advanced +{ [IgnoreTestCase ("We cannot do this yet")] - class FieldThatOnlyGetsSetIsRemoved { + class FieldThatOnlyGetsSetIsRemoved + { public static void Main () { new B ().Method (); } [KeptMember (".ctor()")] - class B { + class B + { public int _unused = 3; [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTarget.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTarget.cs index d7d74833d..ebef31c6f 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTarget.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTarget.cs @@ -6,16 +6,18 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] [assembly: DebuggerDisplay ("{Property}", Target = typeof (DebuggerDisplayAttributeOnAssemblyUsingTarget.Foo))] -namespace Mono.Linker.Tests.Cases.Attributes.Debugger { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("false")] - + // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_Target(System.Type)")] - public class DebuggerDisplayAttributeOnAssemblyUsingTarget { + public class DebuggerDisplayAttributeOnAssemblyUsingTarget + { public static void Main () { var foo = new Foo (); @@ -24,7 +26,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger { [Kept] [KeptMember (".ctor()")] - public class Foo { + public class Foo + { [Kept] [KeptBackingField] public int Property { get; [Kept] set; } diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs index a0661ed62..0d49ae6b7 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs @@ -5,7 +5,8 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: DebuggerDisplay ("{Property}", Target = typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.Foo))] -namespace Mono.Linker.Tests.Cases.Attributes.Debugger { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("false")] @@ -13,12 +14,14 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger { [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] - public class DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType { + public class DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType + { public static void Main () { } - public class Foo { + public class Foo + { public int Property { get; set; } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs index 40819bd10..cd7ee8a5c 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs @@ -6,20 +6,22 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] [assembly: DebuggerDisplay ("{Property}", TargetTypeName = "Mono.Linker.Tests.Cases.Attributes.Debugger.Dependencies.DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib, library")] -namespace Mono.Linker.Tests.Cases.Attributes.Debugger { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("false")] - [SetupCompileBefore ("library.dll", new [] { typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib) })] - + [SetupCompileBefore ("library.dll", new[] { typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib) })] + // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_TargetTypeName(System.String)")] - + [RemovedMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib), "get_Property()")] [KeptMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib), "set_Property(System.Int32)")] - public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly { + public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly + { public static void Main () { var foo = new DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib (); diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnType.cs index 513b1fb1a..a0827114d 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnType.cs @@ -2,7 +2,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Debugger { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("false")] @@ -10,18 +11,20 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger { [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] - public class DebuggerDisplayAttributeOnType { + public class DebuggerDisplayAttributeOnType + { public static void Main () { var foo = new Foo (); - var bar = new Bar(); + var bar = new Bar (); } [Kept] [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] [DebuggerDisplay ("{Property}")] - class Foo { + class Foo + { public int Property { get; set; } } @@ -29,7 +32,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger { [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] [DebuggerDisplay ("{Method()}")] - class Bar { + class Bar + { public int Method () { return 1; diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs index 894d5adbb..3db471578 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs @@ -2,19 +2,22 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Debugger { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("false")] // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - public class DebuggerDisplayAttributeOnTypeThatIsNotUsed { + public class DebuggerDisplayAttributeOnTypeThatIsNotUsed + { public static void Main () { } [DebuggerDisplay ("{Property}")] - class Foo { + class Foo + { public int Property { get; set; } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs index 947919e3d..eff843ca2 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs @@ -3,18 +3,20 @@ using Mono.Linker.Tests.Cases.Attributes.Debugger; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -[assembly: KeptAttributeAttribute(typeof(DebuggerTypeProxyAttribute))] -[assembly: DebuggerTypeProxy (typeof(DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo.FooDebugView), Target = typeof (DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo))] +[assembly: KeptAttributeAttribute (typeof (DebuggerTypeProxyAttribute))] +[assembly: DebuggerTypeProxy (typeof (DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo.FooDebugView), Target = typeof (DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo))] -namespace Mono.Linker.Tests.Cases.Attributes.Debugger { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("false")] - + // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - + [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), ".ctor(System.Type)")] - public class DebuggerTypeProxyAttributeOnAssemblyUsingTarget { + public class DebuggerTypeProxyAttributeOnAssemblyUsingTarget + { public static void Main () { var foo = new Foo (); @@ -23,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger { [Kept] [KeptMember (".ctor()")] - public class Foo { + public class Foo + { [Kept] [KeptBackingField] public int Property { get; [Kept] set; } @@ -33,7 +36,7 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger { { private Foo _foo; - public FooDebugView(Foo foo) + public FooDebugView (Foo foo) { _foo = foo; } diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnType.cs index e10cce1a1..857d6dfc6 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnType.cs @@ -2,15 +2,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Debugger { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("false")] - + // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - + [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), ".ctor(System.Type)")] - public class DebuggerTypeProxyAttributeOnType { + public class DebuggerTypeProxyAttributeOnType + { public static void Main () { var foo = new Foo (); @@ -20,11 +22,13 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger { [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (DebuggerTypeProxyAttribute))] [DebuggerTypeProxy (typeof (FooDebugView))] - class Foo { + class Foo + { } - + [Kept] - class FooDebugView { + class FooDebugView + { public FooDebugView (Foo foo) { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs index 4af869817..1a20cc03d 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs @@ -1,12 +1,16 @@ -namespace Mono.Linker.Tests.Cases.Attributes.Debugger.Dependencies { - public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger.Dependencies +{ + public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib + { public int Property { get; set; } - public class NestedType { + public class NestedType + { public int NestedProperty { get; set; } } - public class GenericType<T> { + public class GenericType<T> + { public T PropertyOnGenericType { get; set; } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTarget.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTarget.cs index 740070469..ba4de5a86 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTarget.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTarget.cs @@ -6,16 +6,18 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] [assembly: DebuggerDisplay ("{Property}", Target = typeof (DebuggerDisplayAttributeOnAssemblyUsingTarget.Foo))] -namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("true")] - + // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - + [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_Target(System.Type)")] - public class DebuggerDisplayAttributeOnAssemblyUsingTarget { + public class DebuggerDisplayAttributeOnAssemblyUsingTarget + { public static void Main () { var foo = new Foo (); @@ -24,7 +26,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { [Kept] [KeptMember (".ctor()")] - public class Foo { + public class Foo + { [Kept] [KeptBackingField] public int Property { [Kept] get; [Kept] set; } diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs index a45e53363..3187911b0 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs @@ -5,7 +5,8 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: DebuggerDisplay ("{Property}", Target = typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.Foo))] -namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("true")] @@ -13,12 +14,14 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] - public class DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType { + public class DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType + { public static void Main () { } - public class Foo { + public class Foo + { public int Property { get; set; } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs index 86fcab15b..7def48ff7 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs @@ -7,20 +7,22 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] [assembly: DebuggerDisplay ("{Property}", TargetTypeName = "Mono.Linker.Tests.Cases.Attributes.Debugger.Dependencies.DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib, library")] -namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("true")] - [SetupCompileBefore ("library.dll", new [] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })] - + [SetupCompileBefore ("library.dll", new[] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })] + // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - + [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_TargetTypeName(System.String)")] - + [KeptMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib), "get_Property()")] [KeptMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib), "set_Property(System.Int32)")] - public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly { + public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly + { public static void Main () { var foo = new DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib (); diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInSameAssembly.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInSameAssembly.cs index 9365cf31c..7385c8396 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInSameAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInSameAssembly.cs @@ -5,16 +5,18 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] [assembly: DebuggerDisplay ("{Property}", TargetTypeName = "Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers.DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInSameAssembly+Foo")] -namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("true")] - + // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - + [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_TargetTypeName(System.String)")] - public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInSameAssembly { + public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInSameAssembly + { public static void Main () { var foo = new Foo (); @@ -23,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { [Kept] [KeptMember (".ctor()")] - public class Foo { + public class Foo + { [Kept] [KeptBackingField] public int Property { [Kept] get; [Kept] set; } diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfGenericTypeInOtherAssembly.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfGenericTypeInOtherAssembly.cs index e2db26428..e1f6466b1 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfGenericTypeInOtherAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfGenericTypeInOtherAssembly.cs @@ -6,20 +6,22 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] [assembly: DebuggerDisplay ("{Property}", TargetTypeName = "Mono.Linker.Tests.Cases.Attributes.Debugger.Dependencies.DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib+GenericType`1, library")] -namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("true")] - [SetupCompileBefore ("library.dll", new [] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })] + [SetupCompileBefore ("library.dll", new[] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })] // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - + [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_TargetTypeName(System.String)")] - + [KeptMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.GenericType<>), "get_PropertyOnGenericType()")] [KeptMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.GenericType<>), "set_PropertyOnGenericType(T)")] - public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfGenericTypeInOtherAssembly { + public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfGenericTypeInOtherAssembly + { public static void Main () { var foo = new DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.GenericType<int> (); diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfNestedTypeInOtherAssembly.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfNestedTypeInOtherAssembly.cs index c6a3f3ca4..9ae1730d4 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfNestedTypeInOtherAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfNestedTypeInOtherAssembly.cs @@ -6,20 +6,22 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] [assembly: DebuggerDisplay ("{Property}", TargetTypeName = "Mono.Linker.Tests.Cases.Attributes.Debugger.Dependencies.DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib+NestedType, library")] -namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("true")] - [SetupCompileBefore ("library.dll", new [] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })] + [SetupCompileBefore ("library.dll", new[] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })] // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_TargetTypeName(System.String)")] - + [KeptMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.NestedType), "get_NestedProperty()")] [KeptMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.NestedType), "set_NestedProperty(System.Int32)")] - public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfNestedTypeInOtherAssembly { + public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfNestedTypeInOtherAssembly + { public static void Main () { var foo = new DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.NestedType (); diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnType.cs index 621789b4e..b167bdd08 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnType.cs @@ -2,36 +2,40 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("true")] - + // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - + [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] - public class DebuggerDisplayAttributeOnType { + public class DebuggerDisplayAttributeOnType + { public static void Main () { var foo = new Foo (); - var bar = new Bar(); + var bar = new Bar (); } [Kept] [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] [DebuggerDisplay ("{Property}")] - class Foo { + class Foo + { [Kept] [KeptBackingField] public int Property { [Kept] get; [Kept] set; } } - + [Kept] - [KeptMember(".ctor()")] + [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] [DebuggerDisplay ("{Method()}")] - class Bar { + class Bar + { [Kept] public int Method () { diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs index de51c012b..61360f4a3 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs @@ -2,19 +2,22 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("true")] - + // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - public class DebuggerDisplayAttributeOnTypeThatIsNotUsed { + public class DebuggerDisplayAttributeOnTypeThatIsNotUsed + { public static void Main () { } [DebuggerDisplay ("{Property}")] - class Foo { + class Foo + { public int Property { get; set; } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs index 220e4e707..2f2738fe9 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs @@ -4,18 +4,20 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: KeptAttributeAttribute (typeof (DebuggerTypeProxyAttribute))] -[assembly: DebuggerTypeProxy (typeof(DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo.FooDebugView), Target = typeof (DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo))] +[assembly: DebuggerTypeProxy (typeof (DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo.FooDebugView), Target = typeof (DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo))] -namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("true")] - + // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - + [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), ".ctor(System.Type)")] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), "set_Target(System.Type)")] - public class DebuggerTypeProxyAttributeOnAssemblyUsingTarget { + public class DebuggerTypeProxyAttributeOnAssemblyUsingTarget + { public static void Main () { var foo = new Foo (); @@ -24,7 +26,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { [Kept] [KeptMember (".ctor()")] - public class Foo { + public class Foo + { [Kept] [KeptBackingField] public int Property { get; [Kept] set; } @@ -36,7 +39,7 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { private Foo _foo; [Kept] - public FooDebugView(Foo foo) + public FooDebugView (Foo foo) { _foo = foo; } diff --git a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnType.cs index fff100055..2d963d90d 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnType.cs @@ -2,15 +2,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { +namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers +{ [SetupLinkerCoreAction ("link")] [SetupLinkerKeepDebugMembers ("true")] - + // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - + [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), ".ctor(System.Type)")] - public class DebuggerTypeProxyAttributeOnType { + public class DebuggerTypeProxyAttributeOnType + { public static void Main () { var foo = new Foo (); @@ -20,11 +22,13 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (DebuggerTypeProxyAttribute))] [DebuggerTypeProxy (typeof (FooDebugView))] - class Foo { + class Foo + { } - + [Kept] - class FooDebugView { + class FooDebugView + { [Kept] public FooDebugView (Foo foo) { diff --git a/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/AutoClass.cs b/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/AutoClass.cs index be4085bad..0db589421 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/AutoClass.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/AutoClass.cs @@ -6,7 +6,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.StructLayout { [StructLayout (LayoutKind.Auto)] [KeptMember (".ctor()")] - class AutoClassData { + class AutoClassData + { public int never_used; [Kept] public int used; diff --git a/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/ExplicitClass.cs b/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/ExplicitClass.cs index dc9f60013..b9d5c960f 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/ExplicitClass.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/ExplicitClass.cs @@ -2,10 +2,12 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Attributes.StructLayout { +namespace Mono.Linker.Tests.Cases.Attributes.StructLayout +{ [StructLayout (LayoutKind.Explicit)] [KeptMember (".ctor()")] - class ExplicitClassData { + class ExplicitClassData + { [FieldOffset (0)] [Kept] // the linker could remove this public int never_used; diff --git a/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/UnusedTypeWithSequentialLayoutIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/UnusedTypeWithSequentialLayoutIsRemoved.cs index d3cb2c30f..b0385a1ed 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/UnusedTypeWithSequentialLayoutIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/UnusedTypeWithSequentialLayoutIsRemoved.cs @@ -3,13 +3,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; namespace Mono.Linker.Tests.Cases.Attributes.StructLayout { - class UnusedTypeWithSequentialLayoutIsRemoved { + class UnusedTypeWithSequentialLayoutIsRemoved + { static void Main () { } [StructLayout (LayoutKind.Sequential)] - class B { + class B + { int a; } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly.cs b/test/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly.cs index 1e74f81c2..f325de503 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly.cs @@ -5,10 +5,12 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: AttributeInReference] -namespace Mono.Linker.Tests.Cases.Attributes { - [SetupCompileBefore ("library.dll", new [] { "Dependencies/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly_Lib.cs" })] +namespace Mono.Linker.Tests.Cases.Attributes +{ + [SetupCompileBefore ("library.dll", new[] { "Dependencies/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly_Lib.cs" })] [RemovedAssembly ("library.dll")] - class AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly { + class AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly + { static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeKeptInComplexCase.cs b/test/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeKeptInComplexCase.cs index 59dec89d4..a67b966b4 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeKeptInComplexCase.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeKeptInComplexCase.cs @@ -16,19 +16,22 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: KeptAttributeAttribute (typeof (AssemblyAttributeKeptInComplexCase.FooAttribute))] [assembly: KeptAttributeAttribute (typeof (AssemblyAttributeKeptInComplexCase_Lib.OtherAssemblyAttribute))] -namespace Mono.Linker.Tests.Cases.Attributes { - [SetupCompileBefore ("library2.dll", new [] { "Dependencies/AssemblyAttributeKeptInComplexCase_Lib.cs" })] +namespace Mono.Linker.Tests.Cases.Attributes +{ + [SetupCompileBefore ("library2.dll", new[] { "Dependencies/AssemblyAttributeKeptInComplexCase_Lib.cs" })] [KeptAssembly ("library2.dll")] [KeptMemberInAssembly ("library2.dll", typeof (AssemblyAttributeKeptInComplexCase_Lib.OtherAssemblyAttribute), ".ctor()")] [KeptMemberInAssembly ("library2.dll", typeof (AssemblyAttributeKeptInComplexCase_Lib), "MethodThatWillBeUsed()")] - public class AssemblyAttributeKeptInComplexCase { + public class AssemblyAttributeKeptInComplexCase + { static void Main () { } [Kept] [KeptBaseType (typeof (Attribute))] - public class FooAttribute : Attribute { + public class FooAttribute : Attribute + { [Kept] public FooAttribute () { diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnAssemblyIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnAssemblyIsKept.cs index b42d3ff2f..615955a01 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnAssemblyIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnAssemblyIsKept.cs @@ -5,14 +5,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; [assembly: AttributeOnAssemblyIsKept.Foo] [assembly: KeptAttributeAttribute (typeof (AttributeOnAssemblyIsKept.FooAttribute))] -namespace Mono.Linker.Tests.Cases.Attributes { - class AttributeOnAssemblyIsKept { +namespace Mono.Linker.Tests.Cases.Attributes +{ + class AttributeOnAssemblyIsKept + { static void Main () { } [KeptBaseType (typeof (System.Attribute))] - public class FooAttribute : Attribute { + public class FooAttribute : Attribute + { [Kept] public FooAttribute () { diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnAssemblyIsKeptIfDeclarationIsSkipped.cs b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnAssemblyIsKeptIfDeclarationIsSkipped.cs index ce76d097d..3f3232d26 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnAssemblyIsKeptIfDeclarationIsSkipped.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnAssemblyIsKeptIfDeclarationIsSkipped.cs @@ -12,9 +12,10 @@ namespace Mono.Linker.Tests.Cases.Attributes { [SkipPeVerify] [Define ("REFERENCE_INCLUDED")] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/AttributeDefinedInReference.cs" })] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/AttributeDefinedInReference.cs" })] [SetupLinkerAction ("skip", "library")] - class AttributeOnAssemblyIsKeptIfDeclarationIsSkipped { + class AttributeOnAssemblyIsKeptIfDeclarationIsSkipped + { static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnParameterInUsedMethodIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnParameterInUsedMethodIsKept.cs index 01cdad565..2874a1139 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnParameterInUsedMethodIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnParameterInUsedMethodIsKept.cs @@ -1,8 +1,10 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Attributes { - class AttributeOnParameterInUsedMethodIsKept { +namespace Mono.Linker.Tests.Cases.Attributes +{ + class AttributeOnParameterInUsedMethodIsKept + { static void Main () { Method ("Bar"); @@ -15,8 +17,9 @@ namespace Mono.Linker.Tests.Cases.Attributes { [Kept] [KeptMember (".ctor()")] - [KeptBaseType (typeof(Attribute))] - class FooAttribute : Attribute { + [KeptBaseType (typeof (Attribute))] + class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeIsKept.cs index 1cd0cdc23..60e64b158 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeIsKept.cs @@ -1,16 +1,19 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Attributes { +namespace Mono.Linker.Tests.Cases.Attributes +{ [Foo] [KeptAttributeAttribute (typeof (FooAttribute))] - class AttributeOnPreservedTypeIsKept { + class AttributeOnPreservedTypeIsKept + { public static void Main () { } [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { + class FooAttribute : Attribute + { [Kept] public FooAttribute () { diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInConstructorIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInConstructorIsKept.cs index aa6600837..909c5dee1 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInConstructorIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInConstructorIsKept.cs @@ -1,16 +1,19 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Attributes { +namespace Mono.Linker.Tests.Cases.Attributes +{ [Foo (typeof (A))] [KeptAttributeAttribute (typeof (FooAttribute))] - class AttributeOnPreservedTypeWithTypeUsedInConstructorIsKept { + class AttributeOnPreservedTypeWithTypeUsedInConstructorIsKept + { public static void Main () { } [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { + class FooAttribute : Attribute + { [Kept] public FooAttribute (Type val) { @@ -18,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { } [Kept] - class A { + class A + { public A () { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept.cs index 976ac6d26..b48bbfa61 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept.cs @@ -1,25 +1,30 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace NamespaceForAttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept { +namespace NamespaceForAttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept +{ [Kept] - class A { + class A + { public A () { } } } -namespace Mono.Linker.Tests.Cases.Attributes { +namespace Mono.Linker.Tests.Cases.Attributes +{ [Foo (typeof (NamespaceForAttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept.A))] [KeptAttributeAttribute (typeof (FooAttribute))] - class AttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept { + class AttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept + { public static void Main () { } [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { + class FooAttribute : Attribute + { [Kept] public FooAttribute (Type val) { @@ -27,7 +32,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { } // This A is not used and should be removed - class A { + class A + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInFieldIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInFieldIsKept.cs index e038333e9..4985d7f38 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInFieldIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInFieldIsKept.cs @@ -1,23 +1,27 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Attributes { +namespace Mono.Linker.Tests.Cases.Attributes +{ [Foo (Val = typeof (A))] [KeptAttributeAttribute (typeof (FooAttribute))] - class AttributeOnPreservedTypeWithTypeUsedInFieldIsKept { + class AttributeOnPreservedTypeWithTypeUsedInFieldIsKept + { public static void Main () { } - [KeptMember(".ctor()")] + [KeptMember (".ctor()")] [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { + class FooAttribute : Attribute + { [Kept] public Type Val; } [Kept] - class A { + class A + { public A () { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInPropertySetterIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInPropertySetterIsKept.cs index 8bc4dd523..eac86ab71 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInPropertySetterIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInPropertySetterIsKept.cs @@ -1,24 +1,28 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Attributes { +namespace Mono.Linker.Tests.Cases.Attributes +{ [Foo (Val = typeof (A))] [KeptAttributeAttribute (typeof (FooAttribute))] - class AttributeOnPreservedTypeWithTypeUsedInPropertySetterIsKept { + class AttributeOnPreservedTypeWithTypeUsedInPropertySetterIsKept + { public static void Main () { } [KeptMember (".ctor()")] [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { + class FooAttribute : Attribute + { [Kept] [KeptBackingField] public Type Val { get; [Kept] set; } } [Kept] - class A { + class A + { public A () { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithUsedSetter.cs b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithUsedSetter.cs index 957de91e1..1da9dc3e9 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithUsedSetter.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithUsedSetter.cs @@ -1,17 +1,20 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Attributes { +namespace Mono.Linker.Tests.Cases.Attributes +{ [Foo (Val = 1)] [KeptAttributeAttribute (typeof (FooAttribute))] - class AttributeOnPreservedTypeWithUsedSetter { + class AttributeOnPreservedTypeWithUsedSetter + { public static void Main () { } [KeptMember (".ctor()")] [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { + class FooAttribute : Attribute + { [Kept] [KeptBackingField] public int Val { get; [Kept] set; } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedFieldIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedFieldIsKept.cs index 834c446ac..e1489d10c 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedFieldIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedFieldIsKept.cs @@ -1,15 +1,18 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Attributes { - class AttributeOnUsedFieldIsKept { +namespace Mono.Linker.Tests.Cases.Attributes +{ + class AttributeOnUsedFieldIsKept + { public static void Main () { var val = new A ().field; } [KeptMember (".ctor()")] - class A { + class A + { [Kept] [KeptAttributeAttribute (typeof (FooAttribute))] [Foo] @@ -17,9 +20,10 @@ namespace Mono.Linker.Tests.Cases.Attributes { } [Kept] - [KeptMember(".ctor()")] + [KeptMember (".ctor()")] [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { + class FooAttribute : Attribute + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedMethodIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedMethodIsKept.cs index 0f99a1ca9..05a448f33 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedMethodIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedMethodIsKept.cs @@ -1,15 +1,18 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Attributes { - class AttributeOnUsedMethodIsKept { +namespace Mono.Linker.Tests.Cases.Attributes +{ + class AttributeOnUsedMethodIsKept + { public static void Main () { new A ().Method (); } [KeptMember (".ctor()")] - class A { + class A + { [Foo] [Kept] [KeptAttributeAttribute (typeof (FooAttribute))] @@ -21,7 +24,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { + class FooAttribute : Attribute + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedPropertyIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedPropertyIsKept.cs index 8e61c12c1..9d32b382f 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedPropertyIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedPropertyIsKept.cs @@ -1,8 +1,10 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Attributes { - class AttributeOnUsedPropertyIsKept { +namespace Mono.Linker.Tests.Cases.Attributes +{ + class AttributeOnUsedPropertyIsKept + { public static void Main () { var val = new A ().Field; @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { [KeptMember (".ctor()")] [KeptMember ("get_Field()")] - class A { + class A + { [Kept] [KeptBackingField] [KeptAttributeAttribute (typeof (FooAttribute))] @@ -21,7 +24,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { + class FooAttribute : Attribute + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/BoxedValues.cs b/test/Mono.Linker.Tests.Cases/Attributes/BoxedValues.cs index 0d4448ccb..184224dd6 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/BoxedValues.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/BoxedValues.cs @@ -1,8 +1,10 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Attributes { - public class BoxedValues { +namespace Mono.Linker.Tests.Cases.Attributes +{ + public class BoxedValues + { // mcs bug // [TestAttribute ((object)typeof (Enum_2))] // [Kept] @@ -25,7 +27,7 @@ namespace Mono.Linker.Tests.Cases.Attributes { { } - [TestAttribute (TestProperty = new object [] { Enum_4.B, null, typeof (Enum_5) })] + [TestAttribute (TestProperty = new object[] { Enum_4.B, null, typeof (Enum_5) })] [Kept] [KeptAttributeAttribute (typeof (TestAttribute))] public void Test_4 () @@ -42,7 +44,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { } [KeptBaseType (typeof (System.Attribute))] - public class TestAttribute : Attribute { + public class TestAttribute : Attribute + { [Kept] public TestAttribute () { @@ -61,7 +64,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { public object TestField; } - public enum Enum_1 { + public enum Enum_1 + { A = 1, B, C @@ -70,7 +74,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { [Kept] [KeptMember ("value__")] [KeptBaseType (typeof (Enum))] - public enum Enum_2 { + public enum Enum_2 + { [Kept] A = 1, [Kept] @@ -82,7 +87,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { [Kept] [KeptMember ("value__")] [KeptBaseType (typeof (Enum))] - public enum Enum_3 { + public enum Enum_3 + { [Kept] C } @@ -90,7 +96,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { [Kept] [KeptMember ("value__")] [KeptBaseType (typeof (Enum))] - public enum Enum_4 { + public enum Enum_4 + { [Kept] B } @@ -98,7 +105,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { [Kept] [KeptMember ("value__")] [KeptBaseType (typeof (Enum))] - public enum Enum_5 { + public enum Enum_5 + { [Kept] B } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/CoreLibraryAssemblyAttributesAreKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/CoreLibraryAssemblyAttributesAreKept.cs index cff049ebb..4dc91982e 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/CoreLibraryAssemblyAttributesAreKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/CoreLibraryAssemblyAttributesAreKept.cs @@ -3,7 +3,8 @@ using System.Timers; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes { +namespace Mono.Linker.Tests.Cases.Attributes +{ [Reference ("System.dll")] [SetupLinkerCoreAction ("link")] [KeptAttributeInAssembly (PlatformAssemblies.CoreLib, typeof (AssemblyDescriptionAttribute))] @@ -13,7 +14,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { [KeptAttributeInAssembly ("System.dll", typeof (AssemblyCompanyAttribute))] #endif [SkipPeVerify] - public class CoreLibraryAssemblyAttributesAreKept { + public class CoreLibraryAssemblyAttributesAreKept + { public static void Main () { // Use something from System so that the entire reference isn't linked away diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeArrayOnAttributeCtorOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeArrayOnAttributeCtorOnType.cs index 66ac1deeb..8e08ad380 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeArrayOnAttributeCtorOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeArrayOnAttributeCtorOnType.cs @@ -2,19 +2,21 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType1.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithType2.dll", new [] { typeof(TypeDefinedInReference2) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType1.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType2.dll", new[] { typeof (TypeDefinedInReference2) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType1.dll", typeof (TypeDefinedInReference))] [KeptTypeInAssembly ("LibraryWithType2.dll", typeof (TypeDefinedInReference2))] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type[])")] - public class OnlyTypeUsedInAssemblyIsTypeArrayOnAttributeCtorOnType { - public static void Main() + public class OnlyTypeUsedInAssemblyIsTypeArrayOnAttributeCtorOnType + { + public static void Main () { var foo = new Foo (); } @@ -22,8 +24,9 @@ namespace Mono.Linker.Tests.Cases.Attributes.Csc { [Kept] [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] - [AttributeDefinedInReference (new [] { typeof (TypeDefinedInReference), typeof (TypeDefinedInReference2) })] - class Foo { + [AttributeDefinedInReference (new[] { typeof (TypeDefinedInReference), typeof (TypeDefinedInReference2) })] + class Foo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssembly.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssembly.cs index 2c4e74f7a..4ff91bb66 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssembly.cs @@ -4,18 +4,20 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: AttributeDefinedInReference (typeof (TypeDefinedInReference))] -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// In the case of attributes on assemblies, we expect both assemblies to be removed because we don't keep assembly level attributes /// when that is the only type marked in the assembly /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [RemovedAssembly ("LibraryWithType.dll")] [RemovedAssembly ("LibraryWithAttribute.dll")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssembly { - public static void Main() + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssembly + { + public static void Main () { } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssemblyOtherTypesInAttributeAssemblyUsed.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssemblyOtherTypesInAttributeAssemblyUsed.cs index eac7c96d7..576c85f24 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssemblyOtherTypesInAttributeAssemblyUsed.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssemblyOtherTypesInAttributeAssemblyUsed.cs @@ -5,23 +5,25 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [assembly: AttributeDefinedInReference (typeof (TypeDefinedInReference))] -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof (AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type)")] [KeptTypeInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference_OtherType))] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssemblyOtherTypesInAttributeAssemblyUsed { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssemblyOtherTypesInAttributeAssemblyUsed + { public static void Main () { // Use something in the attribute assembly so that the special behavior of not preserving a reference if the only thing that is marked // are attributes is not trigged - AttributeDefinedInReference_OtherType.Method(); + AttributeDefinedInReference_OtherType.Method (); } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent.cs index 5241fe700..6b9c5ff8e 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent.cs @@ -3,22 +3,24 @@ using Mono.Linker.Tests.Cases.Attributes.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type)")] [KeptDelegateCacheField ("0")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent + { public static void Main () { var foo = new Foo (); - foo.MyEvent += FooOnMyEvent; + foo.MyEvent += FooOnMyEvent; } [Kept] @@ -34,7 +36,7 @@ namespace Mono.Linker.Tests.Cases.Attributes.Csc { [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] - [KeptAttributeAttribute (typeof( AttributeDefinedInReference))] + [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [AttributeDefinedInReference (typeof (TypeDefinedInReference))] public event EventHandler MyEvent; } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnMethod.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnMethod.cs index 18900f311..ced3f8a2c 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnMethod.cs @@ -2,17 +2,19 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof (TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof (AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type)")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnMethod { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnMethod + { public static void Main () { var foo = new Foo (); @@ -21,7 +23,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Csc { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [AttributeDefinedInReference (typeof (TypeDefinedInReference))] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnProperty.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnProperty.cs index 3f97866a6..b09349e29 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnProperty.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnProperty.cs @@ -2,17 +2,19 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type)")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnProperty { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnProperty + { public static void Main () { var foo = new Foo (); @@ -21,7 +23,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Csc { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptBackingField] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnType.cs index 0b7cfdc2b..8211c496a 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnType.cs @@ -2,20 +2,22 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof (TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof (AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type)")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnType { - public static void Main() + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnType + { + public static void Main () { - var foo = new Foo(); + var foo = new Foo (); } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnAssembly.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnAssembly.cs index afb890223..9c5f402d3 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnAssembly.cs @@ -4,14 +4,15 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: AttributeDefinedInReference (FieldType = typeof (TypeDefinedInReference))] -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// In the case of attributes on assemblies, we expect both assemblies to be removed because we don't keep assembly level attributes /// when that is the only type marked in the assembly /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [RemovedAssembly ("LibraryWithType.dll")] [RemovedAssembly ("LibraryWithAttribute.dll")] public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnAssembly diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnEvent.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnEvent.cs index 939787ff8..9026e6048 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnEvent.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnEvent.cs @@ -3,23 +3,25 @@ using Mono.Linker.Tests.Cases.Attributes.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "FieldType")] [KeptDelegateCacheField ("0")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnEvent { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnEvent + { public static void Main () { var foo = new Foo (); - foo.MyEvent += FooOnMyEvent; + foo.MyEvent += FooOnMyEvent; } [Kept] @@ -29,7 +31,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Csc { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptBackingField] [KeptEventAddMethod] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnMethod.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnMethod.cs index 423c2d571..8cdf7bfdb 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnMethod.cs @@ -2,13 +2,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] @@ -23,10 +24,11 @@ namespace Mono.Linker.Tests.Cases.Attributes.Csc { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] - [AttributeDefinedInReference (FieldType = typeof(TypeDefinedInReference))] + [AttributeDefinedInReference (FieldType = typeof (TypeDefinedInReference))] public void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnProperty.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnProperty.cs index cfe5869f9..6401a1bce 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnProperty.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnProperty.cs @@ -2,18 +2,20 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "FieldType")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnProperty { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnProperty + { public static void Main () { var foo = new Foo (); @@ -22,7 +24,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Csc { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptBackingField] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnType.cs index 971fd317e..b048f5de8 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnType.cs @@ -2,18 +2,20 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "FieldType")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnType { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnType + { public static void Main () { var foo = new Foo (); @@ -23,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Csc { [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [AttributeDefinedInReference (FieldType = typeof (TypeDefinedInReference))] - class Foo { + class Foo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnAssembly.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnAssembly.cs index 904ccb278..24275b74d 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnAssembly.cs @@ -4,17 +4,19 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: AttributeDefinedInReference (PropertyType = typeof (TypeDefinedInReference))] -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// In the case of attributes on assemblies, we expect both assemblies to be removed because we don't keep assembly level attributes /// when that is the only type marked in the assembly /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [RemovedAssembly ("LibraryWithType.dll")] [RemovedAssembly ("LibraryWithAttribute.dll")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnAssembly { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnAssembly + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnEvent.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnEvent.cs index b48d1e64e..5f1791948 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnEvent.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnEvent.cs @@ -3,23 +3,25 @@ using Mono.Linker.Tests.Cases.Attributes.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "set_PropertyType(System.Type)")] [KeptDelegateCacheField ("0")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnEvent { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnEvent + { public static void Main () { var foo = new Foo (); - foo.MyEvent += FooOnMyEvent; + foo.MyEvent += FooOnMyEvent; } [Kept] @@ -29,7 +31,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Csc { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptBackingField] [KeptEventAddMethod] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod.cs index cf503c561..af1c958d7 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod.cs @@ -2,18 +2,20 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "set_PropertyType(System.Type)")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod + { public static void Main () { var foo = new Foo (); @@ -22,7 +24,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Csc { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [AttributeDefinedInReference (PropertyType = typeof (TypeDefinedInReference))] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnProperty.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnProperty.cs index b382e28f8..a615ef0c1 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnProperty.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnProperty.cs @@ -2,18 +2,20 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "set_PropertyType(System.Type)")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnProperty { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnProperty + { public static void Main () { var foo = new Foo (); @@ -22,7 +24,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Csc { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptBackingField] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnType.cs index 1e1b24706..92bbcd3a4 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnType.cs @@ -2,18 +2,20 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "set_PropertyType(System.Type)")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnType { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnType + { public static void Main () { var foo = new Foo (); @@ -23,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Csc { [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [AttributeDefinedInReference (PropertyType = typeof (TypeDefinedInReference))] - class Foo { + class Foo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyWithReferenceIsTypeOnAttributeCtorOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyWithReferenceIsTypeOnAttributeCtorOnType.cs index 265107a78..ef7f6f10f 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyWithReferenceIsTypeOnAttributeCtorOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyWithReferenceIsTypeOnAttributeCtorOnType.cs @@ -2,20 +2,22 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Csc { +namespace Mono.Linker.Tests.Cases.Attributes.Csc +{ /// <summary> /// This explicit csc test exists to ensure that csc adds references in this scenario /// </summary> [SetupCSharpCompilerToUse ("csc")] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithTypeAndReference.dll", new [] { typeof(TypeDefinedInReferenceWithReference) }, new [] { "LibraryWithType.dll", "LibraryWithAttribute.dll" }, compilerToUse: "csc")] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithTypeAndReference.dll", new[] { typeof (TypeDefinedInReferenceWithReference) }, new[] { "LibraryWithType.dll", "LibraryWithAttribute.dll" }, compilerToUse: "csc")] [KeptTypeInAssembly ("LibraryWithTypeAndReference.dll", typeof (TypeDefinedInReferenceWithReference))] [RemovedMemberInAssembly ("LibraryWithTypeAndReference.dll", typeof (TypeDefinedInReferenceWithReference), "Unused()")] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type)")] - public class OnlyTypeUsedInAssemblyWithReferenceIsTypeOnAttributeCtorOnType { + public class OnlyTypeUsedInAssemblyWithReferenceIsTypeOnAttributeCtorOnType + { public static void Main () { var foo = new Foo (); @@ -25,7 +27,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Csc { [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [AttributeDefinedInReference (typeof (TypeDefinedInReferenceWithReference))] - class Foo { + class Foo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly_Lib.cs b/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly_Lib.cs index b52782cd8..b0212d7fe 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly_Lib.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly_Lib.cs @@ -1,6 +1,8 @@ using System; -namespace Mono.Linker.Tests.Cases.Attributes.Dependencies { - public class AttributeInReferenceAttribute : Attribute { +namespace Mono.Linker.Tests.Cases.Attributes.Dependencies +{ + public class AttributeInReferenceAttribute : Attribute + { } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeKeptInComplexCase_Lib.cs b/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeKeptInComplexCase_Lib.cs index 914361f07..187fdd9b7 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeKeptInComplexCase_Lib.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeKeptInComplexCase_Lib.cs @@ -1,8 +1,11 @@ using System; -namespace Mono.Linker.Tests.Cases.Attributes.Dependencies { - public class AssemblyAttributeKeptInComplexCase_Lib { - public class OtherAssemblyAttribute : Attribute { +namespace Mono.Linker.Tests.Cases.Attributes.Dependencies +{ + public class AssemblyAttributeKeptInComplexCase_Lib + { + public class OtherAssemblyAttribute : Attribute + { } public static void MethodThatWillBeUsed () diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/AttributeDefinedInReference.cs b/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/AttributeDefinedInReference.cs index cc6d8d928..0b9620a9d 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/AttributeDefinedInReference.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/AttributeDefinedInReference.cs @@ -1,18 +1,20 @@ using System; -namespace Mono.Linker.Tests.Cases.Attributes.Dependencies { +namespace Mono.Linker.Tests.Cases.Attributes.Dependencies +{ [AttributeUsage (AttributeTargets.All, AllowMultiple = true)] - public class AttributeDefinedInReference : Attribute { + public class AttributeDefinedInReference : Attribute + { public Type FieldType; - + public AttributeDefinedInReference () { } - + public AttributeDefinedInReference (Type t) { } - + public AttributeDefinedInReference (Type[] t) { } @@ -20,7 +22,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Dependencies { public Type PropertyType { get; set; } } - public class AttributeDefinedInReference_OtherType { + public class AttributeDefinedInReference_OtherType + { public static void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/TypeDefinedInReference.cs b/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/TypeDefinedInReference.cs index 76c32933b..63b0b1999 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/TypeDefinedInReference.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/TypeDefinedInReference.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.Attributes.Dependencies { - public class TypeDefinedInReference { +namespace Mono.Linker.Tests.Cases.Attributes.Dependencies +{ + public class TypeDefinedInReference + { public static void Unused () { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/TypeDefinedInReference2.cs b/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/TypeDefinedInReference2.cs index b306dcea5..08a0e2386 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/TypeDefinedInReference2.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/TypeDefinedInReference2.cs @@ -1,4 +1,6 @@ -namespace Mono.Linker.Tests.Cases.Attributes.Dependencies { - public class TypeDefinedInReference2 { +namespace Mono.Linker.Tests.Cases.Attributes.Dependencies +{ + public class TypeDefinedInReference2 + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/TypeDefinedInReferenceWithReference.cs b/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/TypeDefinedInReferenceWithReference.cs index 2f60f4763..e2cf52619 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/TypeDefinedInReferenceWithReference.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Dependencies/TypeDefinedInReferenceWithReference.cs @@ -1,6 +1,8 @@ -namespace Mono.Linker.Tests.Cases.Attributes.Dependencies { +namespace Mono.Linker.Tests.Cases.Attributes.Dependencies +{ [AttributeDefinedInReference (typeof (TypeDefinedInReference))] - public class TypeDefinedInReferenceWithReference { + public class TypeDefinedInReferenceWithReference + { public static void Unused () { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/FixedLengthArrayAttributesArePreserved.cs b/test/Mono.Linker.Tests.Cases/Attributes/FixedLengthArrayAttributesArePreserved.cs index 3c65d0204..4e9727304 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/FixedLengthArrayAttributesArePreserved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/FixedLengthArrayAttributesArePreserved.cs @@ -3,14 +3,16 @@ using System.Security; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes { +namespace Mono.Linker.Tests.Cases.Attributes +{ /// <summary> /// The purpose of this test is mainly to provide coverage on the `KeptAttributeOnFixedBufferType` attribute /// </summary> [SetupCompileArgument ("/unsafe")] // Can't verify because the test contains unsafe code [SkipPeVerify] - public class FixedLengthArrayAttributesArePreserved { + public class FixedLengthArrayAttributesArePreserved + { public static void Main () { Helper (); @@ -28,14 +30,15 @@ namespace Mono.Linker.Tests.Cases.Attributes { static unsafe void AMethodToUseTheReturnValue (int* ptr) { } - + [Kept] - public unsafe struct WithFixedArrayField { + public unsafe struct WithFixedArrayField + { [Kept] [KeptFixedBuffer] [KeptAttributeOnFixedBufferType (typeof (UnsafeValueTypeAttribute))] [KeptAttributeAttribute (typeof (FixedBufferAttribute))] - public fixed int Values [10]; + public fixed int Values[10]; } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeArrayOnAttributeCtorOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeArrayOnAttributeCtorOnType.cs index 4f06ea861..a07cc9d5f 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeArrayOnAttributeCtorOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeArrayOnAttributeCtorOnType.cs @@ -2,20 +2,22 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType1.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithType2.dll", new [] { typeof(TypeDefinedInReference2) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType1.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType2.dll", new[] { typeof (TypeDefinedInReference2) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType1.dll", typeof (TypeDefinedInReference))] [KeptTypeInAssembly ("LibraryWithType2.dll", typeof (TypeDefinedInReference2))] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type[])")] - public class OnlyTypeUsedInAssemblyIsTypeArrayOnAttributeCtorOnType { - public static void Main() + public class OnlyTypeUsedInAssemblyIsTypeArrayOnAttributeCtorOnType + { + public static void Main () { var foo = new Foo (); } @@ -23,8 +25,9 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [Kept] [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] - [AttributeDefinedInReference (new [] { typeof (TypeDefinedInReference), typeof (TypeDefinedInReference2) })] - class Foo { + [AttributeDefinedInReference (new[] { typeof (TypeDefinedInReference), typeof (TypeDefinedInReference2) })] + class Foo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssembly.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssembly.cs index 1d0ab35ca..681365077 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssembly.cs @@ -4,7 +4,8 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: AttributeDefinedInReference (typeof (TypeDefinedInReference))] -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// In the case of attributes on assemblies, we expect both assemblies to be removed because we don't keep assembly level attributes /// when that is the only type marked in the assembly @@ -13,12 +14,13 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [IgnoreTestCase ("Don't try to compile with mcs on .NET Core")] #endif [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [RemovedAssembly ("LibraryWithType.dll")] [RemovedAssembly ("LibraryWithAttribute.dll")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssembly { - public static void Main() + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssembly + { + public static void Main () { } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssemblyOtherTypesInAttributeAssemblyUsed.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssemblyOtherTypesInAttributeAssemblyUsed.cs index c3a62bed0..c04373888 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssemblyOtherTypesInAttributeAssemblyUsed.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssemblyOtherTypesInAttributeAssemblyUsed.cs @@ -5,24 +5,26 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [assembly: AttributeDefinedInReference (typeof (TypeDefinedInReference))] -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof (AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type)")] [KeptTypeInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference_OtherType))] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssemblyOtherTypesInAttributeAssemblyUsed { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnAssemblyOtherTypesInAttributeAssemblyUsed + { public static void Main () { // Use something in the attribute assembly so that the special behavior of not preserving a reference if the only thing that is marked // are attributes is not trigged - AttributeDefinedInReference_OtherType.Method(); + AttributeDefinedInReference_OtherType.Method (); } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent.cs index 0df1c12e5..cb34014ae 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent.cs @@ -3,23 +3,25 @@ using Mono.Linker.Tests.Cases.Attributes.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type)")] [KeptDelegateCacheField ("0")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent + { public static void Main () { var foo = new Foo (); - foo.MyEvent += FooOnMyEvent; + foo.MyEvent += FooOnMyEvent; } [Kept] @@ -35,7 +37,7 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] - [KeptAttributeAttribute (typeof( AttributeDefinedInReference))] + [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [AttributeDefinedInReference (typeof (TypeDefinedInReference))] public event EventHandler MyEvent; } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnMethod.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnMethod.cs index 0d191d7f4..b1a4a54ef 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnMethod.cs @@ -2,18 +2,20 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof (TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof (AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type)")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnMethod { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnMethod + { public static void Main () { var foo = new Foo (); @@ -22,7 +24,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [AttributeDefinedInReference (typeof (TypeDefinedInReference))] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnProperty.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnProperty.cs index ec52d0556..84e498cd1 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnProperty.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnProperty.cs @@ -2,18 +2,20 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type)")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnProperty { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnProperty + { public static void Main () { var foo = new Foo (); @@ -22,7 +24,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptBackingField] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnType.cs index 1708be4a4..dbf006b92 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnType.cs @@ -2,21 +2,23 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof (TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof (AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type)")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnType { - public static void Main() + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnType + { + public static void Main () { - var foo = new Foo(); + var foo = new Foo (); } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnAssembly.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnAssembly.cs index b083155e1..e79418e94 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnAssembly.cs @@ -4,7 +4,8 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: AttributeDefinedInReference (FieldType = typeof (TypeDefinedInReference))] -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// In the case of attributes on assemblies, we expect both assemblies to be removed because we don't keep assembly level attributes /// when that is the only type marked in the assembly @@ -13,8 +14,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [IgnoreTestCase ("Don't try to compile with mcs on .NET Core")] #endif [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [RemovedAssembly ("LibraryWithType.dll")] [RemovedAssembly ("LibraryWithAttribute.dll")] public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnAssembly diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnEvent.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnEvent.cs index ad376f852..3c60ba4dc 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnEvent.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnEvent.cs @@ -3,24 +3,26 @@ using Mono.Linker.Tests.Cases.Attributes.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "FieldType")] [KeptDelegateCacheField ("0")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnEvent { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnEvent + { public static void Main () { var foo = new Foo (); - foo.MyEvent += FooOnMyEvent; + foo.MyEvent += FooOnMyEvent; } [Kept] @@ -30,7 +32,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptBackingField] [KeptEventAddMethod] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnMethod.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnMethod.cs index 26574eb8a..df30b6fb8 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnMethod.cs @@ -2,14 +2,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] @@ -24,10 +25,11 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] - [AttributeDefinedInReference (FieldType = typeof(TypeDefinedInReference))] + [AttributeDefinedInReference (FieldType = typeof (TypeDefinedInReference))] public void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnProperty.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnProperty.cs index 87b1853eb..12b1cc59b 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnProperty.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnProperty.cs @@ -2,19 +2,21 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "FieldType")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnProperty { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnProperty + { public static void Main () { var foo = new Foo (); @@ -23,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptBackingField] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnType.cs index cd62f5b3d..253ce9027 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnType.cs @@ -2,19 +2,21 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "FieldType")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnType { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeFieldOnType + { public static void Main () { var foo = new Foo (); @@ -24,7 +26,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [AttributeDefinedInReference (FieldType = typeof (TypeDefinedInReference))] - class Foo { + class Foo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnAssembly.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnAssembly.cs index b33931b38..bac66108d 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnAssembly.cs @@ -4,7 +4,8 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: AttributeDefinedInReference (PropertyType = typeof (TypeDefinedInReference))] -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// In the case of attributes on assemblies, we expect both assemblies to be removed because we don't keep assembly level attributes /// when that is the only type marked in the assembly @@ -13,11 +14,12 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [IgnoreTestCase ("Don't try to compile with mcs on .NET Core")] #endif [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [RemovedAssembly ("LibraryWithType.dll")] [RemovedAssembly ("LibraryWithAttribute.dll")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnAssembly { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnAssembly + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnEvent.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnEvent.cs index 3c479943d..f54f4b0f6 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnEvent.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnEvent.cs @@ -3,24 +3,26 @@ using Mono.Linker.Tests.Cases.Attributes.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "set_PropertyType(System.Type)")] [KeptDelegateCacheField ("0")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnEvent { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnEvent + { public static void Main () { var foo = new Foo (); - foo.MyEvent += FooOnMyEvent; + foo.MyEvent += FooOnMyEvent; } [Kept] @@ -30,7 +32,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptBackingField] [KeptEventAddMethod] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod.cs index 41d1c803e..77b5fc091 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod.cs @@ -2,19 +2,21 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "set_PropertyType(System.Type)")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod + { public static void Main () { var foo = new Foo (); @@ -23,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [AttributeDefinedInReference (PropertyType = typeof (TypeDefinedInReference))] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnProperty.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnProperty.cs index 66d1a04af..d204ea428 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnProperty.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnProperty.cs @@ -2,19 +2,21 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "set_PropertyType(System.Type)")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnProperty { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnProperty + { public static void Main () { var foo = new Foo (); @@ -23,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptBackingField] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnType.cs index 668f8a9ab..6965171c6 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnType.cs @@ -2,19 +2,21 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "set_PropertyType(System.Type)")] - public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnType { + public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnType + { public static void Main () { var foo = new Foo (); @@ -24,7 +26,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [AttributeDefinedInReference (PropertyType = typeof (TypeDefinedInReference))] - class Foo { + class Foo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyWithReferenceIsTypeOnAttributeCtorOnType.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyWithReferenceIsTypeOnAttributeCtorOnType.cs index 22a34cffb..6be1ce03e 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyWithReferenceIsTypeOnAttributeCtorOnType.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyWithReferenceIsTypeOnAttributeCtorOnType.cs @@ -2,21 +2,23 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.Mcs { +namespace Mono.Linker.Tests.Cases.Attributes.Mcs +{ /// <summary> /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 /// </summary> [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] [SetupCSharpCompilerToUse ("mcs")] - [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] - [SetupCompileBefore ("LibraryWithTypeAndReference.dll", new [] { typeof(TypeDefinedInReferenceWithReference) }, new [] { "LibraryWithType.dll", "LibraryWithAttribute.dll" }, compilerToUse: "mcs")] + [SetupCompileBefore ("LibraryWithAttribute.dll", new[] { typeof (AttributeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithType.dll", new[] { typeof (TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithTypeAndReference.dll", new[] { typeof (TypeDefinedInReferenceWithReference) }, new[] { "LibraryWithType.dll", "LibraryWithAttribute.dll" }, compilerToUse: "mcs")] [KeptTypeInAssembly ("LibraryWithTypeAndReference.dll", typeof (TypeDefinedInReferenceWithReference))] [RemovedMemberInAssembly ("LibraryWithTypeAndReference.dll", typeof (TypeDefinedInReferenceWithReference), "Unused()")] [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor(System.Type)")] - public class OnlyTypeUsedInAssemblyWithReferenceIsTypeOnAttributeCtorOnType { + public class OnlyTypeUsedInAssemblyWithReferenceIsTypeOnAttributeCtorOnType + { public static void Main () { var foo = new Foo (); @@ -26,7 +28,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.Mcs { [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] [AttributeDefinedInReference (typeof (TypeDefinedInReferenceWithReference))] - class Foo { + class Foo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/NoSecurity/CoreLibrarySecurityAttributeTypesAreRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/NoSecurity/CoreLibrarySecurityAttributeTypesAreRemoved.cs index 46a3f5a16..0bfc6b5d2 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/NoSecurity/CoreLibrarySecurityAttributeTypesAreRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/NoSecurity/CoreLibrarySecurityAttributeTypesAreRemoved.cs @@ -4,7 +4,8 @@ using System.Security.Permissions; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.NoSecurity { +namespace Mono.Linker.Tests.Cases.Attributes.NoSecurity +{ [SetupLinkerCoreAction ("link")] [SetupLinkerArgument ("--strip-security", "true")] [Reference ("System.dll")] @@ -33,7 +34,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.NoSecurity { // detects a GetType("SHA256CryptoServiceProvider") in System.dll, which then causes a type in System.Core.dll to be marked. // PeVerify fails on the original GAC copy of System.Core.dll so it's expected that it will also fail on the stripped version we output [SkipPeVerify ("System.Core.dll")] - public class CoreLibrarySecurityAttributeTypesAreRemoved { + public class CoreLibrarySecurityAttributeTypesAreRemoved + { public static void Main () { // Use something that has security attributes to make this test more meaningful diff --git a/test/Mono.Linker.Tests.Cases/Attributes/NoSecurity/SecurityAttributesOnUsedMethodAreRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/NoSecurity/SecurityAttributesOnUsedMethodAreRemoved.cs index eba5ba81f..196569a2a 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/NoSecurity/SecurityAttributesOnUsedMethodAreRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/NoSecurity/SecurityAttributesOnUsedMethodAreRemoved.cs @@ -2,9 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.NoSecurity { +namespace Mono.Linker.Tests.Cases.Attributes.NoSecurity +{ [SetupLinkerArgument ("--strip-security", "true")] - public class SecurityAttributesOnUsedMethodAreRemoved { + public class SecurityAttributesOnUsedMethodAreRemoved + { static void Main () { new Foo ().Method (); @@ -12,7 +14,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.NoSecurity { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [SecurityPermission (SecurityAction.LinkDemand)] [Kept] [RemovedPseudoAttribute (16384)] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/NoSecurity/SecurityAttributesOnUsedTypeAreRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/NoSecurity/SecurityAttributesOnUsedTypeAreRemoved.cs index a5b251400..533b3c0cc 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/NoSecurity/SecurityAttributesOnUsedTypeAreRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/NoSecurity/SecurityAttributesOnUsedTypeAreRemoved.cs @@ -2,9 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.NoSecurity { +namespace Mono.Linker.Tests.Cases.Attributes.NoSecurity +{ [SetupLinkerArgument ("--strip-security", "true")] - public class SecurityAttributesOnUsedTypeAreRemoved { + public class SecurityAttributesOnUsedTypeAreRemoved + { static void Main () { new Foo (); @@ -14,7 +16,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.NoSecurity { [Kept] [KeptMember (".ctor()")] [RemovedPseudoAttribute (262144u)] - class Foo { + class Foo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/AttributeDefinedAndUsedInOtherAssemblyIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/AttributeDefinedAndUsedInOtherAssemblyIsKept.cs index 826ad0011..f89ccb42a 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/AttributeDefinedAndUsedInOtherAssemblyIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/AttributeDefinedAndUsedInOtherAssemblyIsKept.cs @@ -3,11 +3,13 @@ using Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/AttributeDefinedAndUsedInOtherAssemblyIsKept_Lib.cs" })] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/AttributeDefinedAndUsedInOtherAssemblyIsKept_Lib.cs" })] [KeptMemberInAssembly ("library.dll", typeof (AttributeDefinedAndUsedInOtherAssemblyIsKept_Lib.FooAttribute), ".ctor()")] - class AttributeDefinedAndUsedInOtherAssemblyIsKept { + class AttributeDefinedAndUsedInOtherAssemblyIsKept + { static void Main () { Method (); diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/AttributeUsedByAttributeIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/AttributeUsedByAttributeIsKept.cs index 3c7c0d292..b5c8c6347 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/AttributeUsedByAttributeIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/AttributeUsedByAttributeIsKept.cs @@ -2,9 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] - class AttributeUsedByAttributeIsKept { + class AttributeUsedByAttributeIsKept + { static void Main () { var jar = new Jar (); @@ -17,22 +19,24 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [NotUsed] [Kept] [KeptMember (".ctor()")] - [KeptAttributeAttribute (typeof(FooAttribute))] - [KeptAttributeAttribute (typeof(BarAttribute))] - [KeptAttributeAttribute (typeof(KarAttribute))] - class Jar { + [KeptAttributeAttribute (typeof (FooAttribute))] + [KeptAttributeAttribute (typeof (BarAttribute))] + [KeptAttributeAttribute (typeof (KarAttribute))] + class Jar + { [Kept] public void SomeMethod () { - var attr = typeof (Jar).GetCustomAttributes (typeof (FooAttribute), false) [0]; + var attr = typeof (Jar).GetCustomAttributes (typeof (FooAttribute), false)[0]; var asFooAttr = (FooAttribute) attr; asFooAttr.MethodWeWillCall (); } } [Kept] - [KeptBaseType (typeof(Attribute))] - class FooAttribute : Attribute { + [KeptBaseType (typeof (Attribute))] + class FooAttribute : Attribute + { [Kept] public FooAttribute () { @@ -56,8 +60,9 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { } [Kept] - [KeptBaseType (typeof(Attribute))] - class BarAttribute : Attribute { + [KeptBaseType (typeof (Attribute))] + class BarAttribute : Attribute + { [Kept] public BarAttribute () { @@ -69,7 +74,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptBaseType (typeof (Attribute))] - class KarAttribute : Attribute { + class KarAttribute : Attribute + { [Kept] public KarAttribute () { @@ -77,11 +83,13 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { } } - class NotUsedAttribute : Attribute { + class NotUsedAttribute : Attribute + { } [Kept] - static class MethodsUsedFromLateMarking { + static class MethodsUsedFromLateMarking + { [Kept] public static void Method1 () { diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CanLinkCoreLibrariesWithOnlyKeepUsedAttributes.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CanLinkCoreLibrariesWithOnlyKeepUsedAttributes.cs index 6599677e4..36de9c1af 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CanLinkCoreLibrariesWithOnlyKeepUsedAttributes.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CanLinkCoreLibrariesWithOnlyKeepUsedAttributes.cs @@ -3,7 +3,8 @@ using System.Timers; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerCoreAction ("link")] [SetupLinkerArgument ("--used-attrs-only", "true")] [Reference ("System.dll")] @@ -13,7 +14,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [SkipPeVerify ("System.Core.dll")] // Fails with `Runtime critical type System.Reflection.CustomAttributeData not found` [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - class CanLinkCoreLibrariesWithOnlyKeepUsedAttributes { + class CanLinkCoreLibrariesWithOnlyKeepUsedAttributes + { static void Main () { // Use something from System so that the entire reference isn't linked away diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ComAttributesArePreserved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ComAttributesArePreserved.cs index 8c34640d1..15e0b2972 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ComAttributesArePreserved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ComAttributesArePreserved.cs @@ -2,12 +2,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ /// <summary> /// COM related attributes are required at runtime /// </summary> [SetupLinkerArgument ("--used-attrs-only", "true")] - public class ComAttributesArePreserved { + public class ComAttributesArePreserved + { public static void Main () { var tmp = ReturnValueUsedToMarkType (); @@ -18,14 +20,15 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { { return null; } - + [Kept] [KeptAttributeAttribute (typeof (GuidAttribute))] [KeptAttributeAttribute (typeof (InterfaceTypeAttribute))] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)] - interface A { + interface A + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ComAttributesAreRemovedWhenFeatureExcluded.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ComAttributesAreRemovedWhenFeatureExcluded.cs index 0fd0317f7..e33e7d27f 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ComAttributesAreRemovedWhenFeatureExcluded.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ComAttributesAreRemovedWhenFeatureExcluded.cs @@ -2,30 +2,33 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif [SetupLinkerArgument ("--used-attrs-only", "true")] [SetupLinkerArgument ("--exclude-feature", "com")] - public class ComAttributesAreRemovedWhenFeatureExcluded { + public class ComAttributesAreRemovedWhenFeatureExcluded + { public static void Main () { var tmp = ReturnValueUsedToMarkType (); } - + [Kept] static A ReturnValueUsedToMarkType () { return null; } - + [Kept] [RemovedPseudoAttribute (0x00001000u)] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)] - interface A { + interface A + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ContextStaticIsPreservedOnField.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ContextStaticIsPreservedOnField.cs index 39fecc123..451607d69 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ContextStaticIsPreservedOnField.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ContextStaticIsPreservedOnField.cs @@ -2,17 +2,19 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ /// <summary> /// [ContextStatic] is required by the mono runtime /// </summary> [SetupLinkerArgument ("--used-attrs-only", "true")] - public class ContextStaticIsPreservedOnField { + public class ContextStaticIsPreservedOnField + { [ContextStatic] [Kept] [KeptAttributeAttribute (typeof (ContextStaticAttribute))] public static int UsedField; - + public static void Main () { UsedField = 0; diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CoreLibraryUnusedAssemblyAttributesAreRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CoreLibraryUnusedAssemblyAttributesAreRemoved.cs index 96d11f006..cba8cdb7a 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CoreLibraryUnusedAssemblyAttributesAreRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CoreLibraryUnusedAssemblyAttributesAreRemoved.cs @@ -3,7 +3,8 @@ using System.Timers; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [Reference ("System.dll")] [SetupLinkerCoreAction ("link")] [SetupLinkerArgument ("--used-attrs-only", "true")] @@ -12,7 +13,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [RemovedAttributeInAssembly ("System.dll", typeof (AssemblyDescriptionAttribute))] #endif [SkipPeVerify] - public class CoreLibraryUnusedAssemblyAttributesAreRemoved { + public class CoreLibraryUnusedAssemblyAttributesAreRemoved + { public static void Main () { // Use something from System so that the entire reference isn't linked away diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CoreLibraryUsedAssemblyAttributesAreKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CoreLibraryUsedAssemblyAttributesAreKept.cs index 95ee305d4..496450768 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CoreLibraryUsedAssemblyAttributesAreKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CoreLibraryUsedAssemblyAttributesAreKept.cs @@ -3,7 +3,8 @@ using System.Timers; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [Reference ("System.dll")] [SetupLinkerCoreAction ("link")] [SetupLinkerArgument ("--used-attrs-only", "true")] @@ -12,7 +13,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [KeptAttributeInAssembly ("System.dll", typeof (AssemblyDescriptionAttribute))] #endif [SkipPeVerify] - public class CoreLibraryUsedAssemblyAttributesAreKept { + public class CoreLibraryUsedAssemblyAttributesAreKept + { public static void Main () { // Use something from System so that the entire reference isn't linked away diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/Dependencies/AttributeDefinedAndUsedInOtherAssemblyIsKept_Lib.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/Dependencies/AttributeDefinedAndUsedInOtherAssemblyIsKept_Lib.cs index c94d85ba0..43e81ac96 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/Dependencies/AttributeDefinedAndUsedInOtherAssemblyIsKept_Lib.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/Dependencies/AttributeDefinedAndUsedInOtherAssemblyIsKept_Lib.cs @@ -1,13 +1,16 @@ using System; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies { - public class AttributeDefinedAndUsedInOtherAssemblyIsKept_Lib { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies +{ + public class AttributeDefinedAndUsedInOtherAssemblyIsKept_Lib + { public static void UseTheAttributeType () { var str = typeof (FooAttribute).ToString (); } - public class FooAttribute : Attribute { + public class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/Dependencies/UnusedAttributeWithTypeForwarderIsRemoved_Lib.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/Dependencies/UnusedAttributeWithTypeForwarderIsRemoved_Lib.cs index b22c07be9..46522ba57 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/Dependencies/UnusedAttributeWithTypeForwarderIsRemoved_Lib.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/Dependencies/UnusedAttributeWithTypeForwarderIsRemoved_Lib.cs @@ -1,13 +1,16 @@ using System; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies { - public class UnusedAttributeWithTypeForwarderIsRemoved_LibAttribute : Attribute { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies +{ + public class UnusedAttributeWithTypeForwarderIsRemoved_LibAttribute : Attribute + { public UnusedAttributeWithTypeForwarderIsRemoved_LibAttribute (string arg) { } } - public class UnusedAttributeWithTypeForwarderIsRemoved_OtherUsedClass { + public class UnusedAttributeWithTypeForwarderIsRemoved_OtherUsedClass + { public static void UsedMethod () { } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/FixedLengthArrayAttributesArePreserved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/FixedLengthArrayAttributesArePreserved.cs index 3e33c8584..16bfacea2 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/FixedLengthArrayAttributesArePreserved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/FixedLengthArrayAttributesArePreserved.cs @@ -2,13 +2,15 @@ using System.Runtime.CompilerServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] [SetupCompileArgument ("/unsafe")] // Can't verify because the test contains unsafe code [SkipPeVerify] - public class FixedLengthArrayAttributesArePreserved { + public class FixedLengthArrayAttributesArePreserved + { public static void Main () { Helper (); @@ -26,13 +28,14 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { static unsafe void AMethodToUseTheReturnValue (int* ptr) { } - + [Kept] - public unsafe struct WithFixedArrayField { + public unsafe struct WithFixedArrayField + { [Kept] [KeptFixedBuffer] [KeptAttributeAttribute (typeof (FixedBufferAttribute))] - public fixed int Values [10]; + public fixed int Values[10]; } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/MethodWithUnmanagedConstraint.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/MethodWithUnmanagedConstraint.cs index 8d4bd199c..e2d3e86fb 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/MethodWithUnmanagedConstraint.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/MethodWithUnmanagedConstraint.cs @@ -1,11 +1,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupCSharpCompilerToUse ("csc")] [SetupCompileArgument ("/langversion:7.3")] [SetupLinkerArgument ("--used-attrs-only", "true")] - public class MethodWithUnmanagedConstraint { + public class MethodWithUnmanagedConstraint + { public static void Main () { Method<int> (); diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/NullableOnConstraints.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/NullableOnConstraints.cs index e64a1b3f1..3e3c4c767 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/NullableOnConstraints.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/NullableOnConstraints.cs @@ -4,7 +4,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupCSharpCompilerToUse ("csc")] [SetupCompileArgument ("/langversion:8.0")] [SetupLinkerArgument ("--used-attrs-only", "true")] @@ -43,6 +44,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [KeptMember (".ctor()")] class C<T> where T : I? { - } + } } #endif
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ThreadStaticIsPreservedOnField.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ThreadStaticIsPreservedOnField.cs index 35ed32fc1..74e32194b 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ThreadStaticIsPreservedOnField.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/ThreadStaticIsPreservedOnField.cs @@ -2,17 +2,19 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ /// <summary> /// [ThreadStatic] is required by the mono runtime /// </summary> [SetupLinkerArgument ("--used-attrs-only", "true")] - public class ThreadStaticIsPreservedOnField { + public class ThreadStaticIsPreservedOnField + { [ThreadStatic] [Kept] [KeptAttributeAttribute (typeof (ThreadStaticAttribute))] public static int UsedField; - + public static void Main () { UsedField = 0; diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnGenericParameterIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnGenericParameterIsRemoved.cs index 519e7e521..91bf2fc45 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnGenericParameterIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnGenericParameterIsRemoved.cs @@ -1,12 +1,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] [Define ("IL_ASSEMBLY_AVAILABLE")] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/AssemblyWithUnusedAttributeOnGenericParameter.il" })] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/AssemblyWithUnusedAttributeOnGenericParameter.il" })] [RemovedTypeInAssembly ("library.dll", "Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies.FooAttribute")] - public class UnusedAttributeOnGenericParameterIsRemoved { + public class UnusedAttributeOnGenericParameterIsRemoved + { static void Main () { #if IL_ASSEMBLY_AVAILABLE diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnReturnTypeIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnReturnTypeIsRemoved.cs index 1bab0b53f..42250a1b3 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnReturnTypeIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnReturnTypeIsRemoved.cs @@ -1,13 +1,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] [Define ("IL_ASSEMBLY_AVAILABLE")] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/AssemblyWithUnusedAttributeOnReturnParameterDefinition.il" })] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/AssemblyWithUnusedAttributeOnReturnParameterDefinition.il" })] [RemovedTypeInAssembly ("library.dll", "Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies.AssemblyWithUnusedAttributeOnReturnParameterDefinition/FooAttribute")] [RemovedTypeInAssembly ("library.dll", "Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies.BarAttribute")] - public class UnusedAttributeOnReturnTypeIsRemoved { + public class UnusedAttributeOnReturnTypeIsRemoved + { static void Main () { #if IL_ASSEMBLY_AVAILABLE diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributePreservedViaLinkXmlIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributePreservedViaLinkXmlIsKept.cs index c7273e993..50dc794f1 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributePreservedViaLinkXmlIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributePreservedViaLinkXmlIsKept.cs @@ -2,9 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] - class UnusedAttributePreservedViaLinkXmlIsKept { + class UnusedAttributePreservedViaLinkXmlIsKept + { static void Main () { var tmp = new Bar (); @@ -15,7 +17,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (FooAttribute))] [Foo] - class Bar { + class Bar + { [Kept] [KeptAttributeAttribute (typeof (FooAttribute))] [Foo] @@ -27,7 +30,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (Attribute))] - class FooAttribute : Attribute { + class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnAssemblyIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnAssemblyIsRemoved.cs index bbe066f6f..afcee4372 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnAssemblyIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnAssemblyIsRemoved.cs @@ -4,14 +4,17 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: UnusedAttributeTypeOnAssemblyIsRemoved.Foo] -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] - class UnusedAttributeTypeOnAssemblyIsRemoved { + class UnusedAttributeTypeOnAssemblyIsRemoved + { static void Main () { } - public class FooAttribute : Attribute { + public class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnEventIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnEventIsRemoved.cs index 9f0a5271c..ff8775974 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnEventIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnEventIsRemoved.cs @@ -2,10 +2,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] [KeptDelegateCacheField ("0")] - class UnusedAttributeTypeOnEventIsRemoved { + class UnusedAttributeTypeOnEventIsRemoved + { static void Main () { var tmp = new Bar (); @@ -19,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] - class Bar { + class Bar + { [Foo] [Kept] [KeptEventAddMethod] @@ -27,7 +30,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { public event EventHandler<EventArgs> Something { [Foo] add { } [Foo] remove { } } } - class FooAttribute : Attribute { + class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnMethodIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnMethodIsRemoved.cs index 2804e2ff4..4e30d17f4 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnMethodIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnMethodIsRemoved.cs @@ -2,13 +2,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] // System.Core.dll is referenced by System.dll in the .NET FW class libraries. Our GetType reflection marking code // detects a GetType("SHA256CryptoServiceProvider") in System.dll, which then causes a type in System.Core.dll to be marked. // PeVerify fails on the original GAC copy of System.Core.dll so it's expected that it will also fail on the stripped version we output [SkipPeVerify ("System.Core.dll")] - class UnusedAttributeTypeOnMethodIsRemoved { + class UnusedAttributeTypeOnMethodIsRemoved + { static void Main () { new Bar ().Method (); @@ -16,7 +18,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] - class Bar { + class Bar + { [Foo] [Kept] public void Method () @@ -24,7 +27,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { } } - class FooAttribute : Attribute { + class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnModuleIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnModuleIsRemoved.cs index 90619679c..e315e45f1 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnModuleIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnModuleIsRemoved.cs @@ -4,14 +4,17 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [module: UnusedAttributeTypeOnModuleIsRemoved.Foo] -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] - class UnusedAttributeTypeOnModuleIsRemoved { + class UnusedAttributeTypeOnModuleIsRemoved + { static void Main () { } - public class FooAttribute : Attribute { + public class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnParameterIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnParameterIsRemoved.cs index c74e4f6c0..f0d315c3c 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnParameterIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnParameterIsRemoved.cs @@ -2,9 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] - class UnusedAttributeTypeOnParameterIsRemoved { + class UnusedAttributeTypeOnParameterIsRemoved + { static void Main () { new Bar ().Method ("Hello"); @@ -12,14 +14,16 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] - class Bar { + class Bar + { [Kept] public void Method ([Foo] string arg) { } } - class FooAttribute : Attribute { + class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnPropertyIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnPropertyIsRemoved.cs index 7144700ff..359e900a8 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnPropertyIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnPropertyIsRemoved.cs @@ -2,9 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] - class UnusedAttributeTypeOnPropertyIsRemoved { + class UnusedAttributeTypeOnPropertyIsRemoved + { static void Main () { var bar = new Bar (); @@ -14,14 +16,16 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] - class Bar { + class Bar + { [Foo] [Kept] [KeptBackingField] public string Value { [Foo] [Kept] get; [Foo] [Kept] set; } } - class FooAttribute : Attribute { + class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnTypeIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnTypeIsRemoved.cs index 03aba0d14..45f867049 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnTypeIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnTypeIsRemoved.cs @@ -2,9 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] - class UnusedAttributeTypeOnTypeIsRemoved { + class UnusedAttributeTypeOnTypeIsRemoved + { static void Main () { new Bar (); @@ -13,10 +15,12 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] [Foo] - class Bar { + class Bar + { } - class FooAttribute : Attribute { + class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeWithTypeForwarderIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeWithTypeForwarderIsRemoved.cs index 49167f6a7..52afdeaae 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeWithTypeForwarderIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeWithTypeForwarderIsRemoved.cs @@ -3,23 +3,25 @@ using Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [KeepTypeForwarderOnlyAssemblies ("true")] [SetupLinkerArgument ("--used-attrs-only", "true")] [SetupCompileBefore ("library.dll", new[] { "Dependencies/UnusedAttributeWithTypeForwarderIsRemoved_Lib.cs" })] [SetupCompileAfter ("implementation.dll", new[] { "Dependencies/UnusedAttributeWithTypeForwarderIsRemoved_Lib.cs" })] [SetupCompileAfter ("library.dll", new[] { "Dependencies/UnusedAttributeWithTypeForwarderIsRemoved_Forwarder.cs" }, new[] { "implementation.dll" })] - [RemovedTypeInAssembly ("library.dll", typeof(UnusedAttributeWithTypeForwarderIsRemoved_LibAttribute))] + [RemovedTypeInAssembly ("library.dll", typeof (UnusedAttributeWithTypeForwarderIsRemoved_LibAttribute))] [RemovedTypeInAssembly ("implementation.dll", typeof (UnusedAttributeWithTypeForwarderIsRemoved_LibAttribute))] - class UnusedAttributeWithTypeForwarderIsRemoved { + class UnusedAttributeWithTypeForwarderIsRemoved + { static void Main () { Method (null); } [Kept] - + static void Method ([UnusedAttributeWithTypeForwarderIsRemoved_Lib ("")] string arg) { UnusedAttributeWithTypeForwarderIsRemoved_OtherUsedClass.UsedMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnAssemblyIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnAssemblyIsKept.cs index 3f84fddbb..19431989c 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnAssemblyIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnAssemblyIsKept.cs @@ -6,9 +6,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; [assembly: UsedAttributeTypeOnAssemblyIsKept.Foo] [assembly: KeptAttributeAttribute (typeof (UsedAttributeTypeOnAssemblyIsKept.FooAttribute))] -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { - [SetupLinkerArgument("--used-attrs-only", "true")] - class UsedAttributeTypeOnAssemblyIsKept { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ + [SetupLinkerArgument ("--used-attrs-only", "true")] + class UsedAttributeTypeOnAssemblyIsKept + { static void Main () { var str = typeof (FooAttribute).ToString (); @@ -17,7 +19,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (Attribute))] - public class FooAttribute : Attribute { + public class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnEventIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnEventIsKept.cs index 72fb256dc..6b4437f36 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnEventIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnEventIsKept.cs @@ -2,10 +2,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] [KeptDelegateCacheField ("0")] - class UsedAttributeTypeOnEventIsKept { + class UsedAttributeTypeOnEventIsKept + { static void Main () { var tmp = new Bar (); @@ -20,7 +22,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] - class Bar { + class Bar + { [Foo] [Kept] [KeptAttributeAttribute (typeof (FooAttribute))] @@ -31,8 +34,9 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] - [KeptBaseType (typeof(Attribute))] - class FooAttribute : Attribute { + [KeptBaseType (typeof (Attribute))] + class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnMethodIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnMethodIsKept.cs index fc8516f87..7904a05fc 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnMethodIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnMethodIsKept.cs @@ -2,9 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] - class UsedAttributeTypeOnMethodIsKept { + class UsedAttributeTypeOnMethodIsKept + { static void Main () { new Bar ().Method (); @@ -14,7 +16,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] - class Bar { + class Bar + { [Foo] [Kept] [KeptAttributeAttribute (typeof (FooAttribute))] @@ -25,8 +28,9 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] - [KeptBaseType (typeof(Attribute))] - class FooAttribute : Attribute { + [KeptBaseType (typeof (Attribute))] + class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnModuleIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnModuleIsKept.cs index 72e9906df..8046d9b4b 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnModuleIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnModuleIsKept.cs @@ -6,9 +6,11 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; [module: UsedAttributeTypeOnModuleIsKept.Foo] [module: KeptAttributeAttribute (typeof (UsedAttributeTypeOnModuleIsKept.FooAttribute))] -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] - class UsedAttributeTypeOnModuleIsKept { + class UsedAttributeTypeOnModuleIsKept + { static void Main () { var str = typeof (FooAttribute).ToString (); @@ -17,7 +19,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (Attribute))] - public class FooAttribute : Attribute { + public class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnParameterIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnParameterIsKept.cs index 4fb4b134b..1c4e60666 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnParameterIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnParameterIsKept.cs @@ -2,9 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] - class UsedAttributeTypeOnParameterIsKept { + class UsedAttributeTypeOnParameterIsKept + { static void Main () { new Bar ().Method ("Hello"); @@ -13,7 +15,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] - class Bar { + class Bar + { [Kept] public void Method ([Foo] [KeptAttributeAttribute (typeof (FooAttribute))] string arg) { @@ -22,8 +25,9 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] - [KeptBaseType (typeof(Attribute))] - class FooAttribute : Attribute { + [KeptBaseType (typeof (Attribute))] + class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnPropertyIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnPropertyIsKept.cs index 8932d7252..b255ffc23 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnPropertyIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnPropertyIsKept.cs @@ -2,9 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] - class UsedAttributeTypeOnPropertyIsKept { + class UsedAttributeTypeOnPropertyIsKept + { static void Main () { var bar = new Bar (); @@ -15,7 +17,8 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] - class Bar { + class Bar + { [Foo] [Kept] [KeptBackingField] @@ -25,8 +28,9 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [Kept] [KeptMember (".ctor()")] - [KeptBaseType (typeof(Attribute))] - class FooAttribute : Attribute { + [KeptBaseType (typeof (Attribute))] + class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnTypeIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnTypeIsKept.cs index 04dba4d26..07fc53cc4 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnTypeIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UsedAttributeTypeOnTypeIsKept.cs @@ -2,10 +2,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { +namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed +{ [SetupLinkerArgument ("--used-attrs-only", "true")] - class UsedAttributeTypeOnTypeIsKept { + class UsedAttributeTypeOnTypeIsKept + { static void Main () { var tmp = new Bar (); @@ -16,13 +18,15 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (FooAttribute))] [Foo] - class Bar { + class Bar + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (Attribute))] - class FooAttribute : Attribute { + class FooAttribute : Attribute + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedMethodAreKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedMethodAreKept.cs index 6ffa3845a..31b1d4c38 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedMethodAreKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedMethodAreKept.cs @@ -3,9 +3,11 @@ using System.Security.Permissions; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes { +namespace Mono.Linker.Tests.Cases.Attributes +{ [SetupLinkerArgument ("--strip-security", "false")] - class SecurityAttributesOnUsedMethodAreKept { + class SecurityAttributesOnUsedMethodAreKept + { static void Main () { new Foo ().Method (); @@ -13,7 +15,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [SecurityPermission (SecurityAction.LinkDemand)] [Kept] [KeptSecurity (typeof (SecurityPermissionAttribute))] diff --git a/test/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedTypeAreKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedTypeAreKept.cs index 080fe2096..526df81ca 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedTypeAreKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedTypeAreKept.cs @@ -3,9 +3,11 @@ using System.Security.Permissions; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Attributes { - [SetupLinkerArgument("--strip-security", "false")] - class SecurityAttributesOnUsedTypeAreKept { +namespace Mono.Linker.Tests.Cases.Attributes +{ + [SetupLinkerArgument ("--strip-security", "false")] + class SecurityAttributesOnUsedTypeAreKept + { static void Main () { new Foo (); @@ -15,7 +17,8 @@ namespace Mono.Linker.Tests.Cases.Attributes { [Kept] [KeptMember (".ctor()")] [KeptSecurity (typeof (SecurityPermissionAttribute))] - class Foo { + class Foo + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Attributes/TypeUsedInObjectArrayConstructorArgumentOnAttributeIsKept.cs b/test/Mono.Linker.Tests.Cases/Attributes/TypeUsedInObjectArrayConstructorArgumentOnAttributeIsKept.cs index ff0678459..763ae29e9 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/TypeUsedInObjectArrayConstructorArgumentOnAttributeIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/TypeUsedInObjectArrayConstructorArgumentOnAttributeIsKept.cs @@ -1,25 +1,31 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Attributes { +namespace Mono.Linker.Tests.Cases.Attributes +{ [Foo (EnumThatShouldBeKept.Two)] [KeptAttributeAttribute (typeof (FooAttribute))] - public class TypeUsedInObjectArrayConstructorArgumentOnAttributeIsKept { - public static void Main () { + public class TypeUsedInObjectArrayConstructorArgumentOnAttributeIsKept + { + public static void Main () + { } } [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { + class FooAttribute : Attribute + { [Kept] - public FooAttribute ([KeptAttributeAttribute (typeof (ParamArrayAttribute))] params object[] parameters) { + public FooAttribute ([KeptAttributeAttribute (typeof (ParamArrayAttribute))] params object[] parameters) + { } } [Kept] [KeptMember ("value__")] [KeptBaseType (typeof (Enum))] - enum EnumThatShouldBeKept { + enum EnumThatShouldBeKept + { [Kept] One = 1, [Kept] diff --git a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSource.cs b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSource.cs index 868ac6d35..f5ad74025 100644 --- a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSource.cs +++ b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSource.cs @@ -3,14 +3,16 @@ using System.Diagnostics.Tracing; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { +namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif [SetupLinkerArgument ("--exclude-feature", "etw")] // Keep framework code that calls EventSource methods like OnEventCommand [SetupLinkerCoreAction ("skip")] - public class BaseRemovedEventSource { + public class BaseRemovedEventSource + { public static void Main () { var b = CustomCtorEventSource.Log.IsEnabled (); @@ -24,9 +26,11 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { [KeptMember (".ctor()")] [KeptMember (".cctor()")] [EventSource (Name = "MyCompany")] - class CustomCtorEventSource : EventSource { - public class Keywords { - public const EventKeywords Page = (EventKeywords)1; + class CustomCtorEventSource : EventSource + { + public class Keywords + { + public const EventKeywords Page = (EventKeywords) 1; public int Unused; } @@ -35,7 +39,7 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { public static CustomCtorEventSource Log = new MyEventSourceBasedOnCustomCtorEventSource (1); [Kept] - [ExpectedInstructionSequence (new [] + [ExpectedInstructionSequence (new[] { "ldarg.0", "call", @@ -47,7 +51,7 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { } [Kept] - [ExpectedInstructionSequence (new [] + [ExpectedInstructionSequence (new[] { "ldstr", "newobj", @@ -63,7 +67,7 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { } [Kept] - [ExpectedInstructionSequence (new [] + [ExpectedInstructionSequence (new[] { "ldstr", "newobj", @@ -82,7 +86,8 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { [Kept] [KeptBaseType (typeof (CustomCtorEventSource))] - class MyEventSourceBasedOnCustomCtorEventSource : CustomCtorEventSource { + class MyEventSourceBasedOnCustomCtorEventSource : CustomCtorEventSource + { [Kept] public MyEventSourceBasedOnCustomCtorEventSource (int value) : base (value) { diff --git a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSourceEmptyBody.cs b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSourceEmptyBody.cs index 05fc018c6..4270de35c 100644 --- a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSourceEmptyBody.cs +++ b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSourceEmptyBody.cs @@ -2,14 +2,16 @@ using System.Diagnostics.Tracing; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { +namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif [SetupLinkerArgument ("--exclude-feature", "etw")] // Keep framework code that calls EventSource methods like OnEventCommand [SetupLinkerCoreAction ("skip")] - public class BaseRemovedEventSourceEmptyBody { + public class BaseRemovedEventSourceEmptyBody + { public static void Main () { var b = CustomCtorEventSourceEmptyBody.Log.IsEnabled (); @@ -17,15 +19,17 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { CustomCtorEventSourceEmptyBody.Log.SomeMethod (); } } - + [Kept] [KeptBaseType (typeof (EventSource))] [KeptMember (".ctor()")] [KeptMember (".cctor()")] [EventSource (Name = "MyCompany")] - class CustomCtorEventSourceEmptyBody : EventSource { - public class Keywords { - public const EventKeywords Page = (EventKeywords)1; + class CustomCtorEventSourceEmptyBody : EventSource + { + public class Keywords + { + public const EventKeywords Page = (EventKeywords) 1; public int Unused; } @@ -34,7 +38,7 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { public static CustomCtorEventSourceEmptyBody Log = new MyEventSourceBasedOnCustomCtorEventSourceEmptyBody (1); [Kept] - [ExpectedInstructionSequence (new [] + [ExpectedInstructionSequence (new[] { "ldarg.0", "call", @@ -52,7 +56,7 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { } [Kept] - [ExpectedInstructionSequence (new [] + [ExpectedInstructionSequence (new[] { "ldstr", "newobj", @@ -71,7 +75,8 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { [Kept] [KeptBaseType (typeof (CustomCtorEventSourceEmptyBody))] - class MyEventSourceBasedOnCustomCtorEventSourceEmptyBody : CustomCtorEventSourceEmptyBody { + class MyEventSourceBasedOnCustomCtorEventSourceEmptyBody : CustomCtorEventSourceEmptyBody + { [Kept] public MyEventSourceBasedOnCustomCtorEventSourceEmptyBody (int value) : base (value) { diff --git a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/CustomEventSource.cs b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/CustomEventSource.cs index 8286f22c5..ebeb48c1c 100644 --- a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/CustomEventSource.cs +++ b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/CustomEventSource.cs @@ -2,8 +2,10 @@ using System.Diagnostics.Tracing; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { - public class CustomEventSource { +namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW +{ + public class CustomEventSource + { public static void Main () { var b = MyCompanyEventSource.Log.IsEnabled (); @@ -20,19 +22,19 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { class MyCompanyEventSource : EventSource { [Kept] - public class Keywords + public class Keywords { [Kept] - public const EventKeywords Page = (EventKeywords)1; + public const EventKeywords Page = (EventKeywords) 1; public int Unused; } [Kept] - public class Tasks + public class Tasks { [Kept] - public const EventTask Page = (EventTask)1; + public const EventTask Page = (EventTask) 1; public int Unused; } diff --git a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/Excluded.cs b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/Excluded.cs index 59be7a22d..9c0a38a25 100644 --- a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/Excluded.cs +++ b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/Excluded.cs @@ -3,7 +3,8 @@ using System.Diagnostics.Tracing; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { +namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif @@ -12,7 +13,7 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { [SetupLinkerCoreAction ("skip")] // Used to avoid different compilers generating different IL which can mess up the instruction asserts [SetupCompileArgument ("/optimize+")] - public class Excluded + public class Excluded { public static void Main () { @@ -27,9 +28,11 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { [KeptMember (".ctor()")] [KeptMember (".cctor()")] [EventSource (Name = "MyCompany")] - class RemovedEventSource : EventSource { - public class Keywords { - public const EventKeywords Page = (EventKeywords)1; + class RemovedEventSource : EventSource + { + public class Keywords + { + public const EventKeywords Page = (EventKeywords) 1; public int Unused; } @@ -38,7 +41,7 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { public static RemovedEventSource Log = new RemovedEventSource (); [Kept] - [ExpectedInstructionSequence (new [] + [ExpectedInstructionSequence (new[] { "ldstr", "newobj", @@ -54,7 +57,7 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { } [Kept] - [ExpectedInstructionSequence (new [] + [ExpectedInstructionSequence (new[] { "ldstr", "newobj", diff --git a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/LocalsOfModifiedMethodAreRemoved.cs b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/LocalsOfModifiedMethodAreRemoved.cs index 06ba2b79f..7ba06e22a 100644 --- a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/LocalsOfModifiedMethodAreRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/LocalsOfModifiedMethodAreRemoved.cs @@ -2,7 +2,8 @@ using System.Diagnostics.Tracing; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { +namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif @@ -11,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { [SetupLinkerCoreAction ("skip")] // Used to avoid different compilers generating different IL which can mess up the instruction asserts [SetupCompileArgument ("/optimize+")] - public class LocalsOfModifiedMethodAreRemoved { + public class LocalsOfModifiedMethodAreRemoved + { public static void Main () { var b = LocalsAreCleared_RemovedEventSource.Log.IsEnabled (); @@ -19,22 +21,25 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { LocalsAreCleared_RemovedEventSource.Log.SomeMethod (); } - public class ClassForLocal { + public class ClassForLocal + { } public static void CallsToForceALocal (int arg1, int arg2, int arg3) { } } - + [Kept] [KeptBaseType (typeof (EventSource))] [KeptMember (".ctor()")] [KeptMember (".cctor()")] [EventSource (Name = "MyCompany")] - class LocalsAreCleared_RemovedEventSource : EventSource { - public class Keywords { - public const EventKeywords Page = (EventKeywords)1; + class LocalsAreCleared_RemovedEventSource : EventSource + { + public class Keywords + { + public const EventKeywords Page = (EventKeywords) 1; public int Unused; } @@ -52,7 +57,7 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { LocalsOfModifiedMethodAreRemoved.CallsToForceALocal (1, 3, 4); LocalsOfModifiedMethodAreRemoved.CallsToForceALocal (1, 4, 4); var hashcode = tmp.GetHashCode (); - LocalsOfModifiedMethodAreRemoved.CallsToForceALocal(1, hashcode, 3); + LocalsOfModifiedMethodAreRemoved.CallsToForceALocal (1, hashcode, 3); } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/NonEventWithLog.cs b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/NonEventWithLog.cs index e6f76bf95..f9ff78fee 100644 --- a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/NonEventWithLog.cs +++ b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/NonEventWithLog.cs @@ -3,14 +3,16 @@ using System.Diagnostics.Tracing; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { +namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif [SetupLinkerArgument ("--exclude-feature", "etw")] // Used to avoid different compilers generating different IL which can mess up the instruction asserts [SetupCompileArgument ("/optimize+")] - public class NonEventWithLog { + public class NonEventWithLog + { public static void Main () { var n = new NonEventWithLogSource (); @@ -23,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { [KeptMember (".ctor()")] [EventSource (Name = "MyCompany")] - class NonEventWithLogSource : EventSource { + class NonEventWithLogSource : EventSource + { [NonEvent] [Kept] @@ -34,7 +37,7 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { } [Kept] - [ExpectedInstructionSequence (new [] + [ExpectedInstructionSequence (new[] { "ldstr", "newobj", diff --git a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/StubbedMethodWithExceptionHandlers.cs b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/StubbedMethodWithExceptionHandlers.cs index 68ca8f37c..ac0d4b08e 100644 --- a/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/StubbedMethodWithExceptionHandlers.cs +++ b/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/StubbedMethodWithExceptionHandlers.cs @@ -3,7 +3,8 @@ using System.Diagnostics.Tracing; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { +namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif @@ -12,7 +13,8 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { [SetupLinkerCoreAction ("skip")] // Used to avoid different compilers generating different IL which can mess up the instruction asserts [SetupCompileArgument ("/optimize+")] - public class StubbedMethodWithExceptionHandlers { + public class StubbedMethodWithExceptionHandlers + { public static void Main () { var b = StubbedMethodWithExceptionHandlers_RemovedEventSource.Log.IsEnabled (); @@ -20,15 +22,17 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { StubbedMethodWithExceptionHandlers_RemovedEventSource.Log.SomeMethod (); } } - + [Kept] [KeptBaseType (typeof (EventSource))] [KeptMember (".ctor()")] [KeptMember (".cctor()")] [EventSource (Name = "MyCompany")] - class StubbedMethodWithExceptionHandlers_RemovedEventSource : EventSource { - public class Keywords { - public const EventKeywords Page = (EventKeywords)1; + class StubbedMethodWithExceptionHandlers_RemovedEventSource : EventSource + { + public class Keywords + { + public const EventKeywords Page = (EventKeywords) 1; public int Unused; } @@ -37,7 +41,7 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { public static StubbedMethodWithExceptionHandlers_RemovedEventSource Log = new StubbedMethodWithExceptionHandlers_RemovedEventSource (); [Kept] - [ExpectedInstructionSequence (new [] + [ExpectedInstructionSequence (new[] { "ldstr", "newobj", @@ -60,7 +64,7 @@ namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW { } [Kept] - [ExpectedInstructionSequence (new [] + [ExpectedInstructionSequence (new[] { "ldstr", "newobj", diff --git a/test/Mono.Linker.Tests.Cases/Basic/ComplexNestedClassesHasUnusedRemoved.cs b/test/Mono.Linker.Tests.Cases/Basic/ComplexNestedClassesHasUnusedRemoved.cs index fbdbee204..f5a138c10 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/ComplexNestedClassesHasUnusedRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/ComplexNestedClassesHasUnusedRemoved.cs @@ -1,23 +1,30 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - class ComplexNestedClassesHasUnusedRemoved { +namespace Mono.Linker.Tests.Cases.Basic +{ + class ComplexNestedClassesHasUnusedRemoved + { public static void Main () { new A.AB.ABD (); } [Kept] - public class A { + public class A + { [Kept] - public class AB { - public class ABC { + public class AB + { + public class ABC + { } [Kept] - [KeptMember(".ctor()")] - public class ABD { - public class ABDE { + [KeptMember (".ctor()")] + public class ABD + { + public class ABDE + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Basic/InitializerForArrayIsKept.cs b/test/Mono.Linker.Tests.Cases/Basic/InitializerForArrayIsKept.cs index 7d461c741..5ba4c25d1 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/InitializerForArrayIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/InitializerForArrayIsKept.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - public class InitializerForArrayIsKept { +namespace Mono.Linker.Tests.Cases.Basic +{ + public class InitializerForArrayIsKept + { public static void Main () { Method1 (); @@ -13,27 +15,27 @@ namespace Mono.Linker.Tests.Cases.Basic { [KeptInitializerData] static void Method1 () { - Helper (new [] {1, 2, 3}); - Helper (new [] {1, 2, 3, 4}); - Helper (new [] {3, 4, 5}); + Helper (new[] { 1, 2, 3 }); + Helper (new[] { 1, 2, 3, 4 }); + Helper (new[] { 3, 4, 5 }); } [Kept] [KeptInitializerData] static void Method2 () { - Helper (new [] {10, 11, 12}); + Helper (new[] { 10, 11, 12 }); } - + [Kept] [KeptInitializerData] static void Method3 () { - Helper (new [] {10, 11, 12}); + Helper (new[] { 10, 11, 12 }); } [Kept] - static void Helper<T> (T [] arr) + static void Helper<T> (T[] arr) { } } diff --git a/test/Mono.Linker.Tests.Cases/Basic/InstantiatedTypeWithOverridesFromObject.cs b/test/Mono.Linker.Tests.Cases/Basic/InstantiatedTypeWithOverridesFromObject.cs index aca4cf892..c29d053a2 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/InstantiatedTypeWithOverridesFromObject.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/InstantiatedTypeWithOverridesFromObject.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - public class InstantiatedTypeWithOverridesFromObject { +namespace Mono.Linker.Tests.Cases.Basic +{ + public class InstantiatedTypeWithOverridesFromObject + { public static void Main () { var f = new Foo (); @@ -9,7 +11,8 @@ namespace Mono.Linker.Tests.Cases.Basic { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] ~Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Basic/InterfaceMethodImplementedOnBaseClassDoesNotGetStripped.cs b/test/Mono.Linker.Tests.Cases/Basic/InterfaceMethodImplementedOnBaseClassDoesNotGetStripped.cs index fa0b762a8..fd9559f06 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/InterfaceMethodImplementedOnBaseClassDoesNotGetStripped.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/InterfaceMethodImplementedOnBaseClassDoesNotGetStripped.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - class InterfaceMethodImplementedOnBaseClassDoesNotGetStripped { +namespace Mono.Linker.Tests.Cases.Basic +{ + class InterfaceMethodImplementedOnBaseClassDoesNotGetStripped + { public static void Main () { I1 i1 = new Derived (); i1.Used (); } - public interface I1 { + public interface I1 + { void Unused (); [Kept] @@ -16,7 +19,8 @@ namespace Mono.Linker.Tests.Cases.Basic { } [KeptMember (".ctor()")] - public class Base { + public class Base + { public void Unused () { } @@ -31,7 +35,8 @@ namespace Mono.Linker.Tests.Cases.Basic { [KeptMember (".ctor()")] [KeptBaseType (typeof (Base))] [KeptInterface (typeof (I1))] - public class Derived : Base, I1 { + public class Derived : Base, I1 + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Basic/MultiLevelNestedClassesAllRemovedWhenNonUsed.cs b/test/Mono.Linker.Tests.Cases/Basic/MultiLevelNestedClassesAllRemovedWhenNonUsed.cs index dd5f8628e..27eb971e4 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/MultiLevelNestedClassesAllRemovedWhenNonUsed.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/MultiLevelNestedClassesAllRemovedWhenNonUsed.cs @@ -1,17 +1,23 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - class MultiLevelNestedClassesAllRemovedWhenNonUsed { +namespace Mono.Linker.Tests.Cases.Basic +{ + class MultiLevelNestedClassesAllRemovedWhenNonUsed + { public static void Main () { } - public class A { - public class AB { - public class ABC { + public class A + { + public class AB + { + public class ABC + { } - public class ABD { + public class ABD + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Basic/NestedDelegateInvokeMethodsPreserved.cs b/test/Mono.Linker.Tests.Cases/Basic/NestedDelegateInvokeMethodsPreserved.cs index c3e231781..f1c81b64e 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/NestedDelegateInvokeMethodsPreserved.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/NestedDelegateInvokeMethodsPreserved.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - class NestedDelegateInvokeMethodsPreserved { +namespace Mono.Linker.Tests.Cases.Basic +{ + class NestedDelegateInvokeMethodsPreserved + { [Kept] static B.Delegate @delegate; @@ -11,7 +13,8 @@ namespace Mono.Linker.Tests.Cases.Basic { } [Kept] - public class B { + public class B + { [Kept] [KeptMember ("Invoke()")] [KeptMember ("BeginInvoke(System.AsyncCallback,System.Object)")] diff --git a/test/Mono.Linker.Tests.Cases/Basic/NeverInstantiatedTypeWithOverridesFromObject.cs b/test/Mono.Linker.Tests.Cases/Basic/NeverInstantiatedTypeWithOverridesFromObject.cs index 5303fe69f..62f31c427 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/NeverInstantiatedTypeWithOverridesFromObject.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/NeverInstantiatedTypeWithOverridesFromObject.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - public class NeverInstantiatedTypeWithOverridesFromObject { +namespace Mono.Linker.Tests.Cases.Basic +{ + public class NeverInstantiatedTypeWithOverridesFromObject + { public static void Main () { typeof (Foo).ToString (); } [Kept] - class Foo { + class Foo + { ~Foo () { // Finalize shouldn't be empty diff --git a/test/Mono.Linker.Tests.Cases/Basic/UninvokedInterfaceMemberGetsRemoved.cs b/test/Mono.Linker.Tests.Cases/Basic/UninvokedInterfaceMemberGetsRemoved.cs index fb03b0f6d..98dc68f9a 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UninvokedInterfaceMemberGetsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UninvokedInterfaceMemberGetsRemoved.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - class UninvokedInterfaceMemberGetsRemoved { +namespace Mono.Linker.Tests.Cases.Basic +{ + class UninvokedInterfaceMemberGetsRemoved + { public static void Main () { I i = new B (); @@ -9,14 +11,16 @@ namespace Mono.Linker.Tests.Cases.Basic { } [Kept] - interface I { + interface I + { void Method (); } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (I))] - class B : I { + class B : I + { public void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Basic/UnusedClassGetsRemoved.cs b/test/Mono.Linker.Tests.Cases/Basic/UnusedClassGetsRemoved.cs index 85d60e33d..466114046 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UnusedClassGetsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UnusedClassGetsRemoved.cs @@ -1,10 +1,13 @@ -namespace Mono.Linker.Tests.Cases.Basic { - public class UnusedClassGetsRemoved { +namespace Mono.Linker.Tests.Cases.Basic +{ + public class UnusedClassGetsRemoved + { public static void Main () { } } - class Unused { + class Unused + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Basic/UnusedDelegateGetsRemoved.cs b/test/Mono.Linker.Tests.Cases/Basic/UnusedDelegateGetsRemoved.cs index d366e718e..0af0ef7aa 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UnusedDelegateGetsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UnusedDelegateGetsRemoved.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Basic { - class UnusedDelegateGetsRemoved { +namespace Mono.Linker.Tests.Cases.Basic +{ + class UnusedDelegateGetsRemoved + { static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Basic/UnusedEnumGetsRemoved.cs b/test/Mono.Linker.Tests.Cases/Basic/UnusedEnumGetsRemoved.cs index e646cfe63..ccf3246a5 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UnusedEnumGetsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UnusedEnumGetsRemoved.cs @@ -1,12 +1,15 @@ using System; -namespace Mono.Linker.Tests.Cases.Basic { - class UnusedEnumGetsRemoved { +namespace Mono.Linker.Tests.Cases.Basic +{ + class UnusedEnumGetsRemoved + { static void Main () { } - enum Unused { + enum Unused + { One, Two, Three diff --git a/test/Mono.Linker.Tests.Cases/Basic/UnusedEventGetsRemoved.cs b/test/Mono.Linker.Tests.Cases/Basic/UnusedEventGetsRemoved.cs index ed9279d08..0332b049c 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UnusedEventGetsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UnusedEventGetsRemoved.cs @@ -1,8 +1,10 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - class UnusedEventGetsRemoved { +namespace Mono.Linker.Tests.Cases.Basic +{ + class UnusedEventGetsRemoved + { public static void Main () { var tmp = new Foo (); diff --git a/test/Mono.Linker.Tests.Cases/Basic/UnusedFieldGetsRemoved.cs b/test/Mono.Linker.Tests.Cases/Basic/UnusedFieldGetsRemoved.cs index 6edcf5729..87726f771 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UnusedFieldGetsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UnusedFieldGetsRemoved.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - class UnusedFieldGetsRemoved { +namespace Mono.Linker.Tests.Cases.Basic +{ + class UnusedFieldGetsRemoved + { public static void Main () { new B ().Method (); } [KeptMember (".ctor()")] - class B { + class B + { public int _unused; [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Basic/UnusedFieldsOfStructsAreKept.cs b/test/Mono.Linker.Tests.Cases/Basic/UnusedFieldsOfStructsAreKept.cs index a4443a7ff..fb300fe6a 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UnusedFieldsOfStructsAreKept.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UnusedFieldsOfStructsAreKept.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - public class UnusedFieldsOfStructsAreKept { +namespace Mono.Linker.Tests.Cases.Basic +{ + public class UnusedFieldsOfStructsAreKept + { public static void Main () { A a = new A (); @@ -14,7 +16,8 @@ namespace Mono.Linker.Tests.Cases.Basic { } [Kept] - struct A { + struct A + { [Kept] private int UnusedField1; [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Basic/UnusedMethodGetsRemoved.cs b/test/Mono.Linker.Tests.Cases/Basic/UnusedMethodGetsRemoved.cs index eaded4de5..036acf27d 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UnusedMethodGetsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UnusedMethodGetsRemoved.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - class UnusedMethodGetsRemoved { +namespace Mono.Linker.Tests.Cases.Basic +{ + class UnusedMethodGetsRemoved + { public static void Main () { new UnusedMethodGetsRemoved.B ().Method (); } [KeptMember (".ctor()")] - class B { + class B + { public void Unused () { } diff --git a/test/Mono.Linker.Tests.Cases/Basic/UnusedNestedClassGetsRemoved.cs b/test/Mono.Linker.Tests.Cases/Basic/UnusedNestedClassGetsRemoved.cs index 7ff2fc3a6..ab6f27f84 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UnusedNestedClassGetsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UnusedNestedClassGetsRemoved.cs @@ -1,11 +1,14 @@ -namespace Mono.Linker.Tests.Cases.Basic { - public class UnusedNestedClassGetsRemoved { +namespace Mono.Linker.Tests.Cases.Basic +{ + public class UnusedNestedClassGetsRemoved + { public static void Main () { } - class Unused { + class Unused + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Basic/UnusedPropertyGetsRemoved.cs b/test/Mono.Linker.Tests.Cases/Basic/UnusedPropertyGetsRemoved.cs index 63d82842e..863866b0b 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UnusedPropertyGetsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UnusedPropertyGetsRemoved.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - class UnusedPropertyGetsRemoved { +namespace Mono.Linker.Tests.Cases.Basic +{ + class UnusedPropertyGetsRemoved + { public static void Main () { new UnusedPropertyGetsRemoved.B ().Method (); } - [KeptMember(".ctor()")] - class B { + [KeptMember (".ctor()")] + class B + { public int Unused { get; set; } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Basic/UnusedPropertySetterRemoved.cs b/test/Mono.Linker.Tests.Cases/Basic/UnusedPropertySetterRemoved.cs index 9bf680e77..92a4d26d1 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UnusedPropertySetterRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UnusedPropertySetterRemoved.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - class UnusedPropertySetterRemoved { +namespace Mono.Linker.Tests.Cases.Basic +{ + class UnusedPropertySetterRemoved + { public static void Main () { var val = new UnusedPropertySetterRemoved.B ().PartiallyUsed; } [KeptMember (".ctor()")] - class B { + class B + { [Kept] // FIXME: Should be removed [KeptBackingField] public int PartiallyUsed { [Kept] get; set; } diff --git a/test/Mono.Linker.Tests.Cases/Basic/UsedEnumIsKept.cs b/test/Mono.Linker.Tests.Cases/Basic/UsedEnumIsKept.cs index 5320ce63d..ac8526ba8 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UsedEnumIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UsedEnumIsKept.cs @@ -2,8 +2,10 @@ using System.Reflection; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - class UsedEnumIsKept { +namespace Mono.Linker.Tests.Cases.Basic +{ + class UsedEnumIsKept + { static void Main () { // Use all of the values in case we implement a feature in the future that removes unused values @@ -24,8 +26,9 @@ namespace Mono.Linker.Tests.Cases.Basic { [Kept] [KeptMember ("value__")] - [KeptBaseType (typeof(Enum))] - enum Used { + [KeptBaseType (typeof (Enum))] + enum Used + { [Kept] One, diff --git a/test/Mono.Linker.Tests.Cases/Basic/UsedEventIsKept.cs b/test/Mono.Linker.Tests.Cases/Basic/UsedEventIsKept.cs index 0ff3cd573..d729d3ccb 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UsedEventIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UsedEventIsKept.cs @@ -1,10 +1,12 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { +namespace Mono.Linker.Tests.Cases.Basic +{ [KeptDelegateCacheField ("0")] [KeptDelegateCacheField ("1")] - class UsedEventIsKept { + class UsedEventIsKept + { public static void Main () { var tmp = new Foo (); @@ -20,9 +22,10 @@ namespace Mono.Linker.Tests.Cases.Basic { } [KeptMember (".ctor()")] - public class Foo { + public class Foo + { [Kept] - [KeptBaseType (typeof(MulticastDelegate))] + [KeptBaseType (typeof (MulticastDelegate))] [KeptMember (".ctor(System.Object,System.IntPtr)")] [KeptMember ("Invoke()")] [KeptMember ("BeginInvoke(System.AsyncCallback,System.Object)")] diff --git a/test/Mono.Linker.Tests.Cases/Basic/UsedEventOnInterfaceIsKept.cs b/test/Mono.Linker.Tests.Cases/Basic/UsedEventOnInterfaceIsKept.cs index 828a76dac..099b92ab2 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UsedEventOnInterfaceIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UsedEventOnInterfaceIsKept.cs @@ -1,9 +1,11 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { +namespace Mono.Linker.Tests.Cases.Basic +{ [KeptDelegateCacheField ("0")] - class UsedEventOnInterfaceIsKept { + class UsedEventOnInterfaceIsKept + { static void Main () { IFoo bar = new Bar (); @@ -18,7 +20,8 @@ namespace Mono.Linker.Tests.Cases.Basic { } [Kept] - interface IFoo { + interface IFoo + { [Kept] [KeptEventAddMethod] [KeptEventRemoveMethod] @@ -27,7 +30,8 @@ namespace Mono.Linker.Tests.Cases.Basic { [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class Bar : IFoo { + class Bar : IFoo + { [Kept] [KeptBackingField] [KeptEventAddMethod] @@ -37,7 +41,8 @@ namespace Mono.Linker.Tests.Cases.Basic { [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class Jar : IFoo { + class Jar : IFoo + { [Kept] [KeptBackingField] [KeptEventAddMethod] diff --git a/test/Mono.Linker.Tests.Cases/Basic/UsedEventOnInterfaceIsRemovedWhenUsedFromClass.cs b/test/Mono.Linker.Tests.Cases/Basic/UsedEventOnInterfaceIsRemovedWhenUsedFromClass.cs index edff204d6..464db7008 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UsedEventOnInterfaceIsRemovedWhenUsedFromClass.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UsedEventOnInterfaceIsRemovedWhenUsedFromClass.cs @@ -1,9 +1,11 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { +namespace Mono.Linker.Tests.Cases.Basic +{ [KeptDelegateCacheField ("0")] - class UsedEventOnInterfaceIsRemovedWhenUsedFromClass { + class UsedEventOnInterfaceIsRemovedWhenUsedFromClass + { static void Main () { var bar = new Bar (); @@ -17,12 +19,14 @@ namespace Mono.Linker.Tests.Cases.Basic { { } - interface IFoo { + interface IFoo + { event EventHandler Ping; } [KeptMember (".ctor()")] - class Bar : IFoo { + class Bar : IFoo + { [Kept] [KeptBackingField] [KeptEventAddMethod] @@ -31,7 +35,8 @@ namespace Mono.Linker.Tests.Cases.Basic { } [KeptMember (".ctor()")] - class Jar : IFoo { + class Jar : IFoo + { public event EventHandler Ping; } } diff --git a/test/Mono.Linker.Tests.Cases/Basic/UsedGenericInterfaceIsKept.cs b/test/Mono.Linker.Tests.Cases/Basic/UsedGenericInterfaceIsKept.cs index 11ff80990..1e49ef2e4 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UsedGenericInterfaceIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UsedGenericInterfaceIsKept.cs @@ -7,7 +7,7 @@ namespace Mono.Linker.Tests.Cases.Basic public static void Main () { A<int> a = new A<int> (); - var t = typeof (I<>).ToString(); + var t = typeof (I<>).ToString (); } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Basic/UsedInterfaceIsKept.cs b/test/Mono.Linker.Tests.Cases/Basic/UsedInterfaceIsKept.cs index e399d2c9b..6015b4df0 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UsedInterfaceIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UsedInterfaceIsKept.cs @@ -7,7 +7,7 @@ namespace Mono.Linker.Tests.Cases.Basic public static void Main () { A a = new A (); - var t = typeof (I).ToString(); + var t = typeof (I).ToString (); } [Kept] @@ -19,7 +19,7 @@ namespace Mono.Linker.Tests.Cases.Basic [Kept] interface I - { + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Basic/UsedPropertyIsKept.cs b/test/Mono.Linker.Tests.Cases/Basic/UsedPropertyIsKept.cs index 8adc71f27..3487743db 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UsedPropertyIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UsedPropertyIsKept.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Basic { - class UsedPropertyIsKept { +namespace Mono.Linker.Tests.Cases.Basic +{ + class UsedPropertyIsKept + { public static void Main () { var obj = new B (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Basic { } [KeptMember (".ctor()")] - class B { + class B + { [Kept] [KeptBackingField] public int Prop { [Kept] get; [Kept] set; } diff --git a/test/Mono.Linker.Tests.Cases/Basic/UsedStructIsKept.cs b/test/Mono.Linker.Tests.Cases/Basic/UsedStructIsKept.cs index 4af518fed..d5a1dfde5 100644 --- a/test/Mono.Linker.Tests.Cases/Basic/UsedStructIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Basic/UsedStructIsKept.cs @@ -2,8 +2,9 @@ namespace Mono.Linker.Tests.Cases.Basic { - class UsedStructIsKept { - public static void Main() + class UsedStructIsKept + { + public static void Main () { A a; a.MethodVerifiedByKeptMember (); @@ -12,7 +13,8 @@ namespace Mono.Linker.Tests.Cases.Basic [Kept] // This KeptMember is here to make sure the test framework's support of KeptMember on value types is working correctly [KeptMember ("MethodVerifiedByKeptMember()")] - struct A { + struct A + { public void MethodVerifiedByKeptMember () { } diff --git a/test/Mono.Linker.Tests.Cases/CodegenAnnotation/ReflectionBlockedTest.cs b/test/Mono.Linker.Tests.Cases/CodegenAnnotation/ReflectionBlockedTest.cs index 399c72101..60c3f229d 100644 --- a/test/Mono.Linker.Tests.Cases/CodegenAnnotation/ReflectionBlockedTest.cs +++ b/test/Mono.Linker.Tests.Cases/CodegenAnnotation/ReflectionBlockedTest.cs @@ -5,28 +5,28 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.CodegenAnnotation { - [SetupLinkerArgument("--explicit-reflection")] + [SetupLinkerArgument ("--explicit-reflection")] public class ReflectionBlockedTest { [KeptAttributeAttribute ("System.Runtime.CompilerServices.DisablePrivateReflectionAttribute")] - public static void Main() + public static void Main () { - var obj = new A(); - var method = typeof(A).GetMethod("FooPrivRefl", BindingFlags.NonPublic); + var obj = new A (); + var method = typeof (A).GetMethod ("FooPrivRefl", BindingFlags.NonPublic); method.Invoke (obj, new object[] { }); obj.FooPub (); - var obj2 = new All(); + var obj2 = new All (); obj2.FooPub (); } [Kept] - [KeptAttributeAttribute("System.Runtime.CompilerServices.DisablePrivateReflectionAttribute")] + [KeptAttributeAttribute ("System.Runtime.CompilerServices.DisablePrivateReflectionAttribute")] public class All { [Kept] - private int FooPrivSpecializable() + private int FooPrivSpecializable () { return 42; } @@ -34,11 +34,11 @@ namespace Mono.Linker.Tests.Cases.CodegenAnnotation [Kept] public int FooPub () { - return FooPrivSpecializable(); + return FooPrivSpecializable (); } [Kept] - public All() + public All () { } } @@ -47,10 +47,9 @@ namespace Mono.Linker.Tests.Cases.CodegenAnnotation public class A { [Kept] - private int Field - { + private int Field { [Kept] - [KeptAttributeAttribute("System.Runtime.CompilerServices.DisablePrivateReflectionAttribute")] + [KeptAttributeAttribute ("System.Runtime.CompilerServices.DisablePrivateReflectionAttribute")] get { return 42; } @@ -58,20 +57,20 @@ namespace Mono.Linker.Tests.Cases.CodegenAnnotation [Kept] [KeptAttributeAttribute ("System.Runtime.CompilerServices.DisablePrivateReflectionAttribute")] - public int FooPub() + public int FooPub () { - return FooPrivSpecializable(); + return FooPrivSpecializable (); } [Kept] - private int FooPrivRefl() + private int FooPrivRefl () { return this.Field; } [Kept] - [KeptAttributeAttribute("System.Runtime.CompilerServices.DisablePrivateReflectionAttribute")] - private int FooPrivSpecializable() + [KeptAttributeAttribute ("System.Runtime.CompilerServices.DisablePrivateReflectionAttribute")] + private int FooPrivSpecializable () { return 42; } diff --git a/test/Mono.Linker.Tests.Cases/CommandLine/Dependencies/CustomStepDummy.cs b/test/Mono.Linker.Tests.Cases/CommandLine/Dependencies/CustomStepDummy.cs index 8713dc2c1..2ceed46ae 100644 --- a/test/Mono.Linker.Tests.Cases/CommandLine/Dependencies/CustomStepDummy.cs +++ b/test/Mono.Linker.Tests.Cases/CommandLine/Dependencies/CustomStepDummy.cs @@ -6,7 +6,7 @@ namespace CustomStep { public class CustomStepDummy : IStep { - public void Process(LinkContext context) + public void Process (LinkContext context) { context.LogMessage ("Custom step added."); } diff --git a/test/Mono.Linker.Tests.Cases/CommandLine/Dependencies/CustomStepUser.cs b/test/Mono.Linker.Tests.Cases/CommandLine/Dependencies/CustomStepUser.cs index e14b60d7b..af9665693 100644 --- a/test/Mono.Linker.Tests.Cases/CommandLine/Dependencies/CustomStepUser.cs +++ b/test/Mono.Linker.Tests.Cases/CommandLine/Dependencies/CustomStepUser.cs @@ -6,7 +6,7 @@ namespace CustomStep { public class CustomStepUser : IStep { - public void Process(LinkContext context) + public void Process (LinkContext context) { if (context.TryGetCustomData ("NewKey", out var value)) context.LogMessage ("Custom step added with custom data of " + value); diff --git a/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/DefaultMvidBehavior.cs b/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/DefaultMvidBehavior.cs index c7af96f74..676c382fd 100644 --- a/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/DefaultMvidBehavior.cs +++ b/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/DefaultMvidBehavior.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.CommandLine.Mvid { - public class DefaultMvidBehavior { +namespace Mono.Linker.Tests.Cases.CommandLine.Mvid +{ + public class DefaultMvidBehavior + { public static void Main () { Method (); diff --git a/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/DeterministicMvidWorks.cs b/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/DeterministicMvidWorks.cs index 34292b175..d3aa2377f 100644 --- a/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/DeterministicMvidWorks.cs +++ b/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/DeterministicMvidWorks.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.CommandLine.Mvid { +namespace Mono.Linker.Tests.Cases.CommandLine.Mvid +{ [SetupLinkerArgument ("--deterministic")] - public class DeterministicMvidWorks { + public class DeterministicMvidWorks + { public static void Main () { Method (); diff --git a/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/NewMvidWorks.cs b/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/NewMvidWorks.cs index b11b762c0..9f295972f 100644 --- a/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/NewMvidWorks.cs +++ b/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/NewMvidWorks.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.CommandLine.Mvid { +namespace Mono.Linker.Tests.Cases.CommandLine.Mvid +{ [SetupLinkerArgument ("--new-mvid", "true")] - public class NewMvidWorks { + public class NewMvidWorks + { public static void Main () { Method (); diff --git a/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/RetainMvid.cs b/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/RetainMvid.cs index 0b866f223..90474f5bc 100644 --- a/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/RetainMvid.cs +++ b/test/Mono.Linker.Tests.Cases/CommandLine/Mvid/RetainMvid.cs @@ -1,7 +1,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.CommandLine.Mvid { +namespace Mono.Linker.Tests.Cases.CommandLine.Mvid +{ [SetupLinkerArgument ("--new-mvid", "false")] public class RetainMvid { diff --git a/test/Mono.Linker.Tests.Cases/CommandLine/ResponseFilesWork.cs b/test/Mono.Linker.Tests.Cases/CommandLine/ResponseFilesWork.cs index 6f65a2d52..eb250ea87 100644 --- a/test/Mono.Linker.Tests.Cases/CommandLine/ResponseFilesWork.cs +++ b/test/Mono.Linker.Tests.Cases/CommandLine/ResponseFilesWork.cs @@ -2,12 +2,14 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.CommandLine { +namespace Mono.Linker.Tests.Cases.CommandLine +{ /// <summary> /// This test will use only keep used attributes, which is disabled by default, to infer that the rsp file worked /// </summary> [SetupLinkerResponseFileAttribute ("Dependencies/ResponseFilesWork.rsp")] - public class ResponseFilesWork { + public class ResponseFilesWork + { public static void Main () { new Bar (); @@ -16,10 +18,12 @@ namespace Mono.Linker.Tests.Cases.CommandLine { [Kept] [KeptMember (".ctor()")] [Foo] - class Bar { + class Bar + { } - class FooAttribute : Attribute { + class FooAttribute : Attribute + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/ComponentModel/CustomTypeConvertor.cs b/test/Mono.Linker.Tests.Cases/ComponentModel/CustomTypeConvertor.cs index 4f94ed07e..2d6328746 100644 --- a/test/Mono.Linker.Tests.Cases/ComponentModel/CustomTypeConvertor.cs +++ b/test/Mono.Linker.Tests.Cases/ComponentModel/CustomTypeConvertor.cs @@ -16,7 +16,7 @@ namespace Mono.Linker.Tests.Cases.ComponentModel [KeptBaseType (typeof (TypeConverter))] class Custom1 : TypeConverter { - [Kept] + [Kept] public Custom1 (Type type) { } @@ -54,7 +54,7 @@ namespace Mono.Linker.Tests.Cases.ComponentModel [Reference ("System.dll")] public class CustomTypeConvertor - { + { public static void Main () { var tc1 = TypeDescriptor.GetConverter (typeof (CustomDataType)); diff --git a/test/Mono.Linker.Tests.Cases/ComponentModel/TypeDescriptionProviderAttributeOnType.cs b/test/Mono.Linker.Tests.Cases/ComponentModel/TypeDescriptionProviderAttributeOnType.cs index 5b9aeba0e..07de3e5f8 100644 --- a/test/Mono.Linker.Tests.Cases/ComponentModel/TypeDescriptionProviderAttributeOnType.cs +++ b/test/Mono.Linker.Tests.Cases/ComponentModel/TypeDescriptionProviderAttributeOnType.cs @@ -24,11 +24,11 @@ namespace Mono.Linker.Tests.Cases.ComponentModel { } } - } + } [Reference ("System.dll")] public class TypeDescriptionProviderAttributeOnType - { + { public static void Main () { var r1 = new CustomTypeDescriptionProvider_1 (); diff --git a/test/Mono.Linker.Tests.Cases/CoreLink/CanIncludeI18nAssemblies.cs b/test/Mono.Linker.Tests.Cases/CoreLink/CanIncludeI18nAssemblies.cs index 92001b04e..702711fc4 100644 --- a/test/Mono.Linker.Tests.Cases/CoreLink/CanIncludeI18nAssemblies.cs +++ b/test/Mono.Linker.Tests.Cases/CoreLink/CanIncludeI18nAssemblies.cs @@ -1,26 +1,28 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.CoreLink { +namespace Mono.Linker.Tests.Cases.CoreLink +{ #if NETCOREAPP [IgnoreTestCase ("Don't try to compile with mcs on .NET Core")] #endif [SetupLinkerCoreAction ("link")] [Il8n ("all")] - + // i18n assemblies should only be included when processing mono class libs. By forcing this test to use mcs, // we can ensure the test will be ignored when the test runs against .net fw assemblies. [SetupCSharpCompilerToUse ("mcs")] - + [KeptAssembly ("I18N.dll")] [KeptAssembly ("I18N.CJK.dll")] [KeptAssembly ("I18N.MidEast.dll")] [KeptAssembly ("I18N.Other.dll")] [KeptAssembly ("I18N.Rare.dll")] [KeptAssembly ("I18N.West.dll")] - + [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - public class CanIncludeI18nAssemblies { + public class CanIncludeI18nAssemblies + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs b/test/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs index 8a3d66e18..133e92b68 100644 --- a/test/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs +++ b/test/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs @@ -13,7 +13,7 @@ namespace Mono.Linker.Tests.Cases.CoreLink [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] class CopyOfCoreLibrariesKeepsUnusedTypes { - public static void Main() + public static void Main () { } } diff --git a/test/Mono.Linker.Tests.Cases/CoreLink/DelegateAndMulticastDelegateKeepInstantiatedReqs.cs b/test/Mono.Linker.Tests.Cases/CoreLink/DelegateAndMulticastDelegateKeepInstantiatedReqs.cs index 08b429106..a44e6806f 100644 --- a/test/Mono.Linker.Tests.Cases/CoreLink/DelegateAndMulticastDelegateKeepInstantiatedReqs.cs +++ b/test/Mono.Linker.Tests.Cases/CoreLink/DelegateAndMulticastDelegateKeepInstantiatedReqs.cs @@ -3,7 +3,8 @@ using System.Runtime.Serialization; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.CoreLink { +namespace Mono.Linker.Tests.Cases.CoreLink +{ /// <summary> /// Delegate and is created from /// </summary> @@ -16,16 +17,17 @@ namespace Mono.Linker.Tests.Cases.CoreLink { [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (Delegate), "GetHashCode()")] [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (Delegate), "Equals(System.Object)")] - [KeptInterfaceOnTypeInAssembly(PlatformAssemblies.CoreLib, typeof (Delegate), PlatformAssemblies.CoreLib, typeof (ICloneable))] + [KeptInterfaceOnTypeInAssembly (PlatformAssemblies.CoreLib, typeof (Delegate), PlatformAssemblies.CoreLib, typeof (ICloneable))] #if NETCOREAPP [KeptInterfaceOnTypeInAssembly(PlatformAssemblies.CoreLib, typeof (Delegate), "System.Runtime.dll", typeof (ISerializable))] #else - [KeptInterfaceOnTypeInAssembly(PlatformAssemblies.CoreLib, typeof (Delegate), PlatformAssemblies.CoreLib, typeof (ISerializable))] + [KeptInterfaceOnTypeInAssembly (PlatformAssemblies.CoreLib, typeof (Delegate), PlatformAssemblies.CoreLib, typeof (ISerializable))] #endif // Fails due to Runtime critical type System.Reflection.CustomAttributeData not found. - [SkipPeVerify(SkipPeVerifyForToolchian.Pedump)] - public class DelegateAndMulticastDelegateKeepInstantiatedReqs { + [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] + public class DelegateAndMulticastDelegateKeepInstantiatedReqs + { public static void Main () { typeof (MulticastDelegate).ToString (); @@ -33,7 +35,7 @@ namespace Mono.Linker.Tests.Cases.CoreLink { // Cause the interfaces to be marked in order to eliminate the possibility of them being removed // due to no code path marking the interface type typeof (ISerializable).ToString (); - typeof (ICloneable).ToString(); + typeof (ICloneable).ToString (); } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/CoreLink/InstantiatedStructWithOverridesFromObject.cs b/test/Mono.Linker.Tests.Cases/CoreLink/InstantiatedStructWithOverridesFromObject.cs index 0293abf4b..d8255fe44 100644 --- a/test/Mono.Linker.Tests.Cases/CoreLink/InstantiatedStructWithOverridesFromObject.cs +++ b/test/Mono.Linker.Tests.Cases/CoreLink/InstantiatedStructWithOverridesFromObject.cs @@ -1,11 +1,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.CoreLink { +namespace Mono.Linker.Tests.Cases.CoreLink +{ [SetupLinkerCoreAction ("link")] // Need to skip due to `Runtime critical type System.Reflection.CustomAttributeData not found` failure [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - public class InstantiatedStructWithOverridesFromObject { + public class InstantiatedStructWithOverridesFromObject + { public static void Main () { HelperToUseFoo (new Foo ()); @@ -27,7 +29,8 @@ namespace Mono.Linker.Tests.Cases.CoreLink { } [Kept] - struct Foo { + struct Foo + { [Kept] public override bool Equals (object obj) { diff --git a/test/Mono.Linker.Tests.Cases/CoreLink/InstantiatedTypeWithOverridesFromObject.cs b/test/Mono.Linker.Tests.Cases/CoreLink/InstantiatedTypeWithOverridesFromObject.cs index 0af5194e8..bb20020a0 100644 --- a/test/Mono.Linker.Tests.Cases/CoreLink/InstantiatedTypeWithOverridesFromObject.cs +++ b/test/Mono.Linker.Tests.Cases/CoreLink/InstantiatedTypeWithOverridesFromObject.cs @@ -1,11 +1,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.CoreLink { +namespace Mono.Linker.Tests.Cases.CoreLink +{ [SetupLinkerCoreAction ("link")] // Need to skip due to `Runtime critical type System.Reflection.CustomAttributeData not found` failure [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - public class InstantiatedTypeWithOverridesFromObject { + public class InstantiatedTypeWithOverridesFromObject + { public static void Main () { var f = new Foo (); @@ -13,7 +15,8 @@ namespace Mono.Linker.Tests.Cases.CoreLink { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] ~Foo () { diff --git a/test/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedMethods.cs b/test/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedMethods.cs index c7e323031..d96e64d1c 100644 --- a/test/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedMethods.cs +++ b/test/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedMethods.cs @@ -25,8 +25,9 @@ namespace Mono.Linker.Tests.Cases.CoreLink // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - class LinkingOfCoreLibrariesRemovesUnusedMethods { - public static void Main() + class LinkingOfCoreLibrariesRemovesUnusedMethods + { + public static void Main () { Stack stack = new Stack (2); stack.Push (1); diff --git a/test/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedTypes.cs b/test/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedTypes.cs index 89cc1ddf8..c15f2c534 100644 --- a/test/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedTypes.cs +++ b/test/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedTypes.cs @@ -3,9 +3,10 @@ using System.Collections.Generic; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.CoreLink { +namespace Mono.Linker.Tests.Cases.CoreLink +{ [SetupLinkerCoreAction ("link")] - [Reference("System.dll")] + [Reference ("System.dll")] [KeptAssembly (PlatformAssemblies.CoreLib)] // We can't check everything that should be removed, but we should be able to check a few niche things that @@ -18,7 +19,7 @@ namespace Mono.Linker.Tests.Cases.CoreLink { [KeptTypeInAssembly ("System.Collections.dll", typeof (System.Collections.Generic.SortedList<,>))] [RemovedTypeInAssembly ("System.Collections.dll", typeof (System.Collections.Generic.SortedDictionary<,>))] #else - [KeptAssembly("System.dll")] + [KeptAssembly ("System.dll")] [KeptTypeInAssembly ("System.dll", typeof (System.Collections.Generic.SortedList<,>))] [RemovedTypeInAssembly ("System.dll", typeof (System.Collections.Generic.SortedDictionary<,>))] #endif @@ -27,17 +28,18 @@ namespace Mono.Linker.Tests.Cases.CoreLink { [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] // All sorts of stuff is flagged as invalid even in the original System.dll and System.Configuration.dll for mono class libraries - [SkipPeVerify("System.dll")] - [SkipPeVerify("System.Configuration.dll")] + [SkipPeVerify ("System.dll")] + [SkipPeVerify ("System.Configuration.dll")] // System.Core.dll is referenced by System.dll in the .NET FW class libraries. Our GetType reflection marking code // detects a GetType("SHA256CryptoServiceProvider") in System.dll, which then causes a type in System.Core.dll to be marked. // PeVerify fails on the original GAC copy of System.Core.dll so it's expected that it will also fail on the stripped version we output [SkipPeVerify ("System.Core.dll")] - class LinkingOfCoreLibrariesRemovesUnusedTypes { + class LinkingOfCoreLibrariesRemovesUnusedTypes + { public static void Main () { // Use something from system that would normally be removed if we didn't use it - OtherMethods2 (new SortedList<string, string>()); + OtherMethods2 (new SortedList<string, string> ()); } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/CoreLink/NeverInstantiatedTypeWithOverridesFromObject.cs b/test/Mono.Linker.Tests.Cases/CoreLink/NeverInstantiatedTypeWithOverridesFromObject.cs index 9d1627aff..8d1b596e4 100644 --- a/test/Mono.Linker.Tests.Cases/CoreLink/NeverInstantiatedTypeWithOverridesFromObject.cs +++ b/test/Mono.Linker.Tests.Cases/CoreLink/NeverInstantiatedTypeWithOverridesFromObject.cs @@ -1,18 +1,21 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.CoreLink { +namespace Mono.Linker.Tests.Cases.CoreLink +{ [SetupLinkerCoreAction ("link")] // Need to skip due to `Runtime critical type System.Reflection.CustomAttributeData not found` failure [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - public class NeverInstantiatedTypeWithOverridesFromObject { + public class NeverInstantiatedTypeWithOverridesFromObject + { public static void Main () { typeof (Foo).ToString (); } [Kept] - class Foo { + class Foo + { ~Foo () { // Finalize shouldn't be empty diff --git a/test/Mono.Linker.Tests.Cases/CoreLink/NoSecurityPlusOnlyKeepUsedRemovesAllSecurityAttributesFromCoreLibraries.cs b/test/Mono.Linker.Tests.Cases/CoreLink/NoSecurityPlusOnlyKeepUsedRemovesAllSecurityAttributesFromCoreLibraries.cs index d57bf41cc..aaf41b317 100644 --- a/test/Mono.Linker.Tests.Cases/CoreLink/NoSecurityPlusOnlyKeepUsedRemovesAllSecurityAttributesFromCoreLibraries.cs +++ b/test/Mono.Linker.Tests.Cases/CoreLink/NoSecurityPlusOnlyKeepUsedRemovesAllSecurityAttributesFromCoreLibraries.cs @@ -4,7 +4,8 @@ using System.Security.Permissions; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.CoreLink { +namespace Mono.Linker.Tests.Cases.CoreLink +{ [SetupLinkerCoreAction ("link")] [SetupLinkerArgument ("--strip-security", "true")] [SetupLinkerArgument ("--used-attrs-only", "true")] @@ -31,7 +32,8 @@ namespace Mono.Linker.Tests.Cases.CoreLink { // detects a GetType("SHA256CryptoServiceProvider") in System.dll, which then causes a type in System.Core.dll to be marked. // PeVerify fails on the original GAC copy of System.Core.dll so it's expected that it will also fail on the stripped version we output [SkipPeVerify ("System.Core.dll")] - public class NoSecurityPlusOnlyKeepUsedRemovesAllSecurityAttributesFromCoreLibraries { + public class NoSecurityPlusOnlyKeepUsedRemovesAllSecurityAttributesFromCoreLibraries + { public static void Main () { // Use something that has security attributes to make this test more meaningful diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/ApplyTypeAnnotations.cs b/test/Mono.Linker.Tests.Cases/DataFlow/ApplyTypeAnnotations.cs index bb8b246fa..bc9aed4ce 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/ApplyTypeAnnotations.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/ApplyTypeAnnotations.cs @@ -104,9 +104,9 @@ namespace Mono.Linker.Tests.Cases.DataFlow private static void RequireCombination ( [KeptAttributeAttribute(typeof(DynamicallyAccessedMembersAttribute))] [DynamicallyAccessedMembers( - DynamicallyAccessedMemberKinds.DefaultConstructor | - DynamicallyAccessedMemberKinds.PublicFields | - DynamicallyAccessedMemberKinds.PublicMethods | + DynamicallyAccessedMemberKinds.DefaultConstructor | + DynamicallyAccessedMemberKinds.PublicFields | + DynamicallyAccessedMemberKinds.PublicMethods | DynamicallyAccessedMemberKinds.PublicProperties)] Type type) { diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/AttributeConstructorDataflow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/AttributeConstructorDataflow.cs index 47cb0b934..9387ea5cc 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/AttributeConstructorDataflow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/AttributeConstructorDataflow.cs @@ -14,22 +14,22 @@ namespace Mono.Linker.Tests.Cases.DataFlow [Kept] class AttributeConstructorDataflow { - [KeptAttributeAttribute(typeof(KeepsPublicConstructorAttribute))] + [KeptAttributeAttribute (typeof (KeepsPublicConstructorAttribute))] [KeptAttributeAttribute (typeof (KeepsPublicMethodsAttribute))] - [KeepsPublicConstructor(typeof(ClassWithKeptPublicConstructor))] - [KeepsPublicMethods("Mono.Linker.Tests.Cases.DataFlow.AttributeConstructorDataflow+ClassWithKeptPublicMethods")] - public static void Main() + [KeepsPublicConstructor (typeof (ClassWithKeptPublicConstructor))] + [KeepsPublicMethods ("Mono.Linker.Tests.Cases.DataFlow.AttributeConstructorDataflow+ClassWithKeptPublicMethods")] + public static void Main () { typeof (AttributeConstructorDataflow).GetMethod ("Main").GetCustomAttribute (typeof (KeepsPublicConstructorAttribute)); typeof (AttributeConstructorDataflow).GetMethod ("Main").GetCustomAttribute (typeof (KeepsPublicMethodsAttribute)); } [Kept] - [KeptBaseType(typeof(Attribute))] + [KeptBaseType (typeof (Attribute))] class KeepsPublicConstructorAttribute : Attribute { [Kept] - public KeepsPublicConstructorAttribute( + public KeepsPublicConstructorAttribute ( [KeptAttributeAttribute(typeof(DynamicallyAccessedMembersAttribute))] [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.PublicConstructors)] Type type) @@ -38,7 +38,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow } [Kept] - [KeptBaseType(typeof(Attribute))] + [KeptBaseType (typeof (Attribute))] class KeepsPublicMethodsAttribute : Attribute { [Kept] @@ -54,19 +54,19 @@ namespace Mono.Linker.Tests.Cases.DataFlow class ClassWithKeptPublicConstructor { [Kept] - public ClassWithKeptPublicConstructor(int unused) { } + public ClassWithKeptPublicConstructor (int unused) { } - private ClassWithKeptPublicConstructor(short unused) { } + private ClassWithKeptPublicConstructor (short unused) { } - public void Method() { } + public void Method () { } } [Kept] class ClassWithKeptPublicMethods { [Kept] - public static void KeptMethod() { } - static void Method() { } + public static void KeptMethod () { } + static void Method () { } } } } diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs index e7585bcec..e5a9d169e 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs @@ -17,7 +17,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow [KeptAttributeAttribute (typeof (KeepsPublicConstructorsAttribute))] [KeptAttributeAttribute (typeof (KeepsPublicMethodsAttribute))] [KeepsPublicConstructors (Type = typeof (ClassWithKeptPublicConstructor))] - [KeepsPublicMethods("Mono.Linker.Tests.Cases.DataFlow.AttributeFieldDataflow+ClassWithKeptPublicMethods")] + [KeepsPublicMethods ("Mono.Linker.Tests.Cases.DataFlow.AttributeFieldDataflow+ClassWithKeptPublicMethods")] public static void Main () { typeof (AttributeFieldDataflow).GetMethod ("Main").GetCustomAttribute (typeof (KeepsPublicConstructorsAttribute)); @@ -40,7 +40,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow } [Kept] - [KeptBaseType(typeof(Attribute))] + [KeptBaseType (typeof (Attribute))] class KeepsPublicMethodsAttribute : Attribute { [Kept] @@ -67,8 +67,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow class ClassWithKeptPublicMethods { [Kept] - public static void KeptMethod() { } - static void Method() { } + public static void KeptMethod () { } + static void Method () { } } } } diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs index 993a24c87..f2694905f 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs @@ -17,7 +17,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow [KeptAttributeAttribute (typeof (KeepsPublicConstructorsAttribute))] [KeptAttributeAttribute (typeof (KeepsPublicMethodsAttribute))] [KeepsPublicConstructors (Type = typeof (ClassWithKeptPublicConstructor))] - [KeepsPublicMethods("Mono.Linker.Tests.Cases.DataFlow.AttributePropertyDataflow+ClassWithKeptPublicMethods")] + [KeepsPublicMethods ("Mono.Linker.Tests.Cases.DataFlow.AttributePropertyDataflow+ClassWithKeptPublicMethods")] public static void Main () { typeof (AttributePropertyDataflow).GetMethod ("Main").GetCustomAttribute (typeof (KeepsPublicConstructorsAttribute)); @@ -41,7 +41,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow } [Kept] - [KeptBaseType(typeof(Attribute))] + [KeptBaseType (typeof (Attribute))] class KeepsPublicMethodsAttribute : Attribute { [Kept] @@ -68,8 +68,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow class ClassWithKeptPublicMethods { [Kept] - public static void KeptMethod() { } - static void Method() { } + public static void KeptMethod () { } + static void Method () { } } } } diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs index 7d7e3a011..c010e80cd 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs @@ -15,7 +15,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow [Kept] class ByRefDataflow { - public static void Main() + public static void Main () { { Type t = typeof (ClassPassedToMethodTakingTypeByRef); @@ -41,21 +41,21 @@ namespace Mono.Linker.Tests.Cases.DataFlow static Type s_typeWithDefaultConstructor; [Kept] - [UnrecognizedReflectionAccessPattern (typeof (ByRefDataflow), nameof (MethodWithRefParameter), new string [] { "System.Type&" })] - public static void PassRefToField() + [UnrecognizedReflectionAccessPattern (typeof (ByRefDataflow), nameof (MethodWithRefParameter), new string[] { "System.Type&" })] + public static void PassRefToField () { MethodWithRefParameter (ref s_typeWithDefaultConstructor); } [Kept] - [UnrecognizedReflectionAccessPattern (typeof (ByRefDataflow), nameof (MethodWithRefParameter), new string [] { "System.Type&" })] - public static void PassRefToParameter(Type parameter) + [UnrecognizedReflectionAccessPattern (typeof (ByRefDataflow), nameof (MethodWithRefParameter), new string[] { "System.Type&" })] + public static void PassRefToParameter (Type parameter) { MethodWithRefParameter (ref parameter); } [Kept] - public static void MethodWithRefParameter( + public static void MethodWithRefParameter ( [KeptAttributeAttribute(typeof(DynamicallyAccessedMembersAttribute))] [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.PublicMethods)] ref Type type) @@ -67,8 +67,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow class ClassPassedToMethodTakingTypeByRef { [Kept] - public static void KeptMethod() { } - internal static void RemovedMethod() { } + public static void KeptMethod () { } + internal static void RemovedMethod () { } } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/FieldDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/FieldDataFlow.cs index b4d25ba0e..d26143acc 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/FieldDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/FieldDataFlow.cs @@ -32,19 +32,19 @@ namespace Mono.Linker.Tests.Cases.DataFlow instance.WriteToStaticFieldOnADifferentClass (); } - [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.DefaultConstructor)] + [DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.DefaultConstructor)] Type _typeWithDefaultConstructor; [DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.DefaultConstructor)] static Type _staticTypeWithDefaultConstructor; - [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequirePublicConstructors), new Type [] { typeof (Type) }, + [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequirePublicConstructors), new Type[] { typeof (Type) }, "The field 'System.Type Mono.Linker.Tests.Cases.DataFlow.FieldDataFlow::_typeWithDefaultConstructor' " + "with dynamically accessed member kinds 'DefaultConstructor' is passed into " + "the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.FieldDataFlow::RequirePublicConstructors(System.Type)' " + "which requires dynamically accessed member kinds `PublicConstructors`. " + "To fix this add DynamicallyAccessedMembersAttribute to it and specify at least these member kinds 'PublicConstructors'.")] - [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequireConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequireConstructors), new Type[] { typeof (Type) })] private void ReadFromInstanceField () { RequireDefaultConstructor (_typeWithDefaultConstructor); @@ -53,7 +53,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireNothing (_typeWithDefaultConstructor); } - [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (WriteToInstanceField), new Type [] { })] + [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (WriteToInstanceField), new Type[] { })] private void WriteToInstanceField () { _typeWithDefaultConstructor = GetTypeWithDefaultConstructor (); @@ -62,8 +62,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow _typeWithDefaultConstructor = GetUnkownType (); } - [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] - [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequireConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequireConstructors), new Type[] { typeof (Type) })] private void ReadFromInstanceFieldOnADifferentClass () { var store = new TypeStore (); @@ -74,7 +74,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireNothing (store._typeWithDefaultConstructor); } - [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (WriteToInstanceFieldOnADifferentClass), new Type [] { })] + [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (WriteToInstanceFieldOnADifferentClass), new Type[] { })] private void WriteToInstanceFieldOnADifferentClass () { var store = new TypeStore (); @@ -85,8 +85,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow store._typeWithDefaultConstructor = GetUnkownType (); } - [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] - [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequireConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequireConstructors), new Type[] { typeof (Type) })] private void ReadFromStaticField () { RequireDefaultConstructor (_staticTypeWithDefaultConstructor); @@ -95,7 +95,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireNothing (_staticTypeWithDefaultConstructor); } - [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (WriteToStaticField), new Type [] { })] + [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (WriteToStaticField), new Type[] { })] private void WriteToStaticField () { _staticTypeWithDefaultConstructor = GetTypeWithDefaultConstructor (); @@ -104,8 +104,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow _staticTypeWithDefaultConstructor = GetUnkownType (); } - [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] - [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequireConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (RequireConstructors), new Type[] { typeof (Type) })] private void ReadFromStaticFieldOnADifferentClass () { RequireDefaultConstructor (TypeStore._staticTypeWithDefaultConstructor); @@ -114,7 +114,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireNothing (TypeStore._staticTypeWithDefaultConstructor); } - [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (WriteToStaticFieldOnADifferentClass), new Type [] { })] + [UnrecognizedReflectionAccessPattern (typeof (FieldDataFlow), nameof (WriteToStaticFieldOnADifferentClass), new Type[] { })] private void WriteToStaticFieldOnADifferentClass () { TypeStore._staticTypeWithDefaultConstructor = GetTypeWithDefaultConstructor (); diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/GetTypeDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/GetTypeDataFlow.cs index 6e527181f..633edeaf9 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/GetTypeDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/GetTypeDataFlow.cs @@ -34,8 +34,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow // Type.GetType over two params } - [UnrecognizedReflectionAccessPattern (typeof (GetTypeDataFlow), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] - [UnrecognizedReflectionAccessPattern (typeof (GetTypeDataFlow), nameof (RequireConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (GetTypeDataFlow), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (GetTypeDataFlow), nameof (RequireConstructors), new Type[] { typeof (Type) })] static void TestDefaultConstructor () { Type type = Type.GetType (GetStringTypeWithDefaultConstructor ()); @@ -45,7 +45,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireNothing (type); } - [UnrecognizedReflectionAccessPattern (typeof (GetTypeDataFlow), nameof (RequireConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (GetTypeDataFlow), nameof (RequireConstructors), new Type[] { typeof (Type) })] static void TestPublicConstructors () { Type type = Type.GetType (GetStringTypeWithPublicConstructors ()); @@ -65,13 +65,13 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireNothing (type); } - [UnrecognizedReflectionAccessPattern (typeof (Type), nameof (GetType), new Type [] { typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (Type), nameof (GetType), new Type[] { typeof (string) })] static void TestUnknownType () { Type type = Type.GetType (GetStringUnkownType ()); } - [UnrecognizedReflectionAccessPattern (typeof (GetTypeDataFlow), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (GetTypeDataFlow), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] static void TestTypeNameFromParameter ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.DefaultConstructor)] string typeName) @@ -79,10 +79,10 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequirePublicConstructors (Type.GetType (typeName)); } - [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.DefaultConstructor)] + [DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.DefaultConstructor)] static string _typeNameWithDefaultConstructor; - [UnrecognizedReflectionAccessPattern (typeof (GetTypeDataFlow), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (GetTypeDataFlow), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] static void TestTypeNameFromField () { RequirePublicConstructors (Type.GetType (_typeNameWithDefaultConstructor)); @@ -94,47 +94,47 @@ namespace Mono.Linker.Tests.Cases.DataFlow { string typeName = null; switch (_switchOnField) { - case 0: // valid - typeName = "Mono.Linker.Tests.Cases.DataFlow.GetTypeDataFlow"; - break; - case 1: // null - typeName = null; - break; - case 2: // invalid - typeName = "UnknownType"; - break; - case 3: // invalid second - typeName = "AnotherUnknownType"; - break; + case 0: // valid + typeName = "Mono.Linker.Tests.Cases.DataFlow.GetTypeDataFlow"; + break; + case 1: // null + typeName = null; + break; + case 2: // invalid + typeName = "UnknownType"; + break; + case 3: // invalid second + typeName = "AnotherUnknownType"; + break; } Type.GetType (typeName); } - [UnrecognizedReflectionAccessPattern (typeof (GetTypeDataFlow), nameof (RequireConstructors), new Type [] { typeof (Type) }, + [UnrecognizedReflectionAccessPattern (typeof (GetTypeDataFlow), nameof (RequireConstructors), new Type[] { typeof (Type) }, "The method return value with dynamically accessed member kinds 'DefaultConstructor' is passed into " + "the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.GetTypeDataFlow::RequireConstructors(System.Type)' " + "which requires dynamically accessed member kinds `Constructors`. " + "To fix this add DynamicallyAccessedMembersAttribute to it and specify at least these member kinds 'Constructors'.")] - [UnrecognizedReflectionAccessPattern (typeof (Type), nameof (Type.GetType), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (Type), nameof (Type.GetType), new Type[] { typeof (string) }, "Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Void Mono.Linker.Tests.Cases.DataFlow.GetTypeDataFlow::TestMultipleMixedValues()' " + "was detected with unknown value for the type name.")] static void TestMultipleMixedValues () { string typeName = null; switch (_switchOnField) { - case 0: - typeName = GetStringTypeWithDefaultConstructor (); - break; - case 1: - typeName = GetStringTypeWithConstructors (); - break; - case 2: - typeName = "Mono.Linker.Tests.Cases.DataFlow.GetTypeDataFlow"; - break; - case 3: - typeName = GetStringUnkownType (); - break; + case 0: + typeName = GetStringTypeWithDefaultConstructor (); + break; + case 1: + typeName = GetStringTypeWithConstructors (); + break; + case 2: + typeName = "Mono.Linker.Tests.Cases.DataFlow.GetTypeDataFlow"; + break; + case 3: + typeName = GetStringUnkownType (); + break; } RequireConstructors (Type.GetType (typeName)); diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/JsonAnnotations.cs b/test/Mono.Linker.Tests.Cases/DataFlow/JsonAnnotations.cs index fa344561f..fb3584d30 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/JsonAnnotations.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/JsonAnnotations.cs @@ -15,7 +15,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow [SetupLinkerAttributeDefinitionsFile ("JsonAnnotations.json")] class JsonAnnotations { - public static void Main() + public static void Main () { var instance = new JsonAnnotations (); @@ -29,8 +29,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow Type PropertyWithDefaultConstructor { get; set; } - [UnrecognizedReflectionAccessPattern (typeof (JsonAnnotations), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] - [UnrecognizedReflectionAccessPattern (typeof (JsonAnnotations), nameof (RequireConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (JsonAnnotations), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (JsonAnnotations), nameof (RequireConstructors), new Type[] { typeof (Type) })] private void ReadFromInstanceField () { RequireDefaultConstructor (_typeWithDefaultConstructor); @@ -38,7 +38,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireConstructors (_typeWithDefaultConstructor); } - [UnrecognizedReflectionAccessPattern (typeof (JsonAnnotations), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (JsonAnnotations), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] private void TwoAnnotatedParameters ( Type type, Type type2) @@ -49,15 +49,15 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequirePublicConstructors (type2); } - [UnrecognizedReflectionAccessPattern (typeof (JsonAnnotations), nameof (ReturnConstructorsFailure), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (JsonAnnotations), nameof (ReturnConstructorsFailure), new Type[] { typeof (Type) })] private Type ReturnConstructorsFailure ( Type defaultConstructorType) { return defaultConstructorType; } - [UnrecognizedReflectionAccessPattern (typeof (JsonAnnotations), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] - [UnrecognizedReflectionAccessPattern (typeof (JsonAnnotations), nameof (RequireConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (JsonAnnotations), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (JsonAnnotations), nameof (RequireConstructors), new Type[] { typeof (Type) })] private void ReadFromInstanceProperty () { RequireDefaultConstructor (PropertyWithDefaultConstructor); diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs index cbd110385..819d5ca24 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs @@ -37,13 +37,13 @@ namespace Mono.Linker.Tests.Cases.DataFlow TestBackwardsEdgeLoop (); } - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithMethods()' " + "with dynamically accessed member kinds 'Methods' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireFields(System.String)' " + "which requires dynamically accessed member kinds `Fields`. " + "To fix this add DynamicallyAccessedMembersAttribute to it and specify at least these member kinds 'Fields'.")] - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithFields()' " + "with dynamically accessed member kinds 'Fields' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireMethods(System.String)' " + @@ -56,18 +56,18 @@ namespace Mono.Linker.Tests.Cases.DataFlow goto End; str = GetWithFields (); - End: + End: RequireFields (str); // warns for GetWithMethods RequireMethods (str); // warns for GetWithFields } - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithMethods()' " + "with dynamically accessed member kinds 'Methods' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireFields(System.String)' " + "which requires dynamically accessed member kinds `Fields`. " + "To fix this add DynamicallyAccessedMembersAttribute to it and specify at least these member kinds 'Fields'.")] - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithFields()' " + "with dynamically accessed member kinds 'Fields' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireMethods(System.String)' " + @@ -83,13 +83,13 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireMethods (str); // warns for GetWithFields } - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithMethods()' " + "with dynamically accessed member kinds 'Methods' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireFields(System.String)' " + "which requires dynamically accessed member kinds `Fields`. " + "To fix this add DynamicallyAccessedMembersAttribute to it and specify at least these member kinds 'Fields'.")] - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithFields()' " + "with dynamically accessed member kinds 'Fields' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireMethods(System.String)' " + @@ -109,19 +109,19 @@ namespace Mono.Linker.Tests.Cases.DataFlow static int _switchOnField; - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithFields()' " + "with dynamically accessed member kinds 'Fields' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireMethods(System.String)' " + "which requires dynamically accessed member kinds `Methods`. " + "To fix this add DynamicallyAccessedMembersAttribute to it and specify at least these member kinds 'Methods'.")] - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithPublicMethods()' " + "with dynamically accessed member kinds 'PublicMethods' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireMethods(System.String)' " + "which requires dynamically accessed member kinds `Methods`. " + "To fix this add DynamicallyAccessedMembersAttribute to it and specify at least these member kinds 'Methods'.")] - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithConstructors()' " + "with dynamically accessed member kinds 'Constructors' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireMethods(System.String)' " + @@ -147,13 +147,13 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireMethods (str); // warns for GetWithFields, GetWithPublicMethods, and GetWithConstructors } - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithMethods()' " + "with dynamically accessed member kinds 'Methods' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireFields(System.String)' " + "which requires dynamically accessed member kinds `Fields`. " + "To fix this add DynamicallyAccessedMembersAttribute to it and specify at least these member kinds 'Fields'.")] - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithFields()' " + "with dynamically accessed member kinds 'Fields' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireMethods(System.String)' " + @@ -173,13 +173,13 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireMethods (str); // warns for GetWithFields } - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithMethods()' " + "with dynamically accessed member kinds 'Methods' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireFields(System.String)' " + "which requires dynamically accessed member kinds `Fields`. " + "To fix this add DynamicallyAccessedMembersAttribute to it and specify at least these member kinds 'Fields'.")] - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithFields()' " + "with dynamically accessed member kinds 'Fields' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireMethods(System.String)' " + @@ -198,13 +198,13 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireMethods (str); // warns for GetWithFields } - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithMethods()' " + "with dynamically accessed member kinds 'Methods' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireFields(System.String)' " + "which requires dynamically accessed member kinds `Fields`. " + "To fix this add DynamicallyAccessedMembersAttribute to it and specify at least these member kinds 'Fields'.")] - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type [] { typeof (string) }, + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type[] { typeof (string) }, "The return value of method 'System.String Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::GetWithFields()' " + "with dynamically accessed member kinds 'Fields' " + "is passed into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.LocalDataFlow::RequireMethods(System.String)' " + @@ -224,7 +224,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireMethods (str); // warns for GetWithFields } - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type [] { typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type[] { typeof (string) })] public static void TestBranchGoto () { string str = GetWithMethods (); @@ -232,11 +232,11 @@ namespace Mono.Linker.Tests.Cases.DataFlow goto End; str = GetWithFields (); RequireFields (str); // produces a warning - End: + End: return; } - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type [] { typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type[] { typeof (string) })] public static void TestBranchIf () { string str = GetWithMethods (); @@ -246,7 +246,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow } } - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type [] { typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type[] { typeof (string) })] public static void TestBranchIfElse () { string str; @@ -261,11 +261,11 @@ namespace Mono.Linker.Tests.Cases.DataFlow } } - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type [] { typeof (string) })] - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequirePublicMethods), new Type [] { typeof (string) })] - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireConstructors), new Type [] { typeof (string) })] - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireConstructors), new Type [] { typeof (string) })] - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireConstructors), new Type [] { typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireMethods), new Type[] { typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequirePublicMethods), new Type[] { typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireConstructors), new Type[] { typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireConstructors), new Type[] { typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireConstructors), new Type[] { typeof (string) })] public static void TestBranchSwitch () { string str = null; @@ -289,7 +289,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow } } - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type [] { typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type[] { typeof (string) })] public static void TestBranchTry () { string str = GetWithMethods (); @@ -303,7 +303,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow } } - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type [] { typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type[] { typeof (string) })] public static void TestBranchCatch () { string str = GetWithMethods (); @@ -316,7 +316,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow } } - [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type [] { typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (LocalDataFlow), nameof (RequireFields), new Type[] { typeof (string) })] public static void TestBranchFinally () { string str = GetWithMethods (); @@ -349,11 +349,11 @@ namespace Mono.Linker.Tests.Cases.DataFlow { string str = null; goto ForwardTarget; - BackwardTarget: + BackwardTarget: RequireMethods (str); // should warn for the value that comes from GetWithFields, but it doesn't. return; - ForwardTarget: + ForwardTarget: str = GetWithFields (); goto BackwardTarget; } @@ -381,23 +381,27 @@ namespace Mono.Linker.Tests.Cases.DataFlow { } - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.Fields)] - public static string GetWithFields () { + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.Fields)] + public static string GetWithFields () + { return null; } - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.Methods)] - public static string GetWithMethods () { + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.Methods)] + public static string GetWithMethods () + { return null; } - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.PublicMethods)] - public static string GetWithPublicMethods () { + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.PublicMethods)] + public static string GetWithPublicMethods () + { return null; } - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.Constructors)] - public static string GetWithConstructors () { + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.Constructors)] + public static string GetWithConstructors () + { return null; } } diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlowKeptMembers.cs b/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlowKeptMembers.cs index 94738961f..82edc7f32 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlowKeptMembers.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlowKeptMembers.cs @@ -29,7 +29,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow goto End; t = typeof (BranchMergeGotoType2); - End: + End: RequireFields (t); // keeps fields for both types } @@ -129,7 +129,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow goto End; t = typeof (BranchGotoType2); RequireFields (t); - End: + End: return; } diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/MethodParametersDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/MethodParametersDataFlow.cs index 22ccca8b7..45c721e0a 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/MethodParametersDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/MethodParametersDataFlow.cs @@ -27,7 +27,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow LongWriteToParameterOnStaticMethod (0, 0, 0, 0, null); instance.InstanceMethod (typeof (TestType)); instance.TwoAnnotatedParameters (typeof (TestType), typeof (TestType)); - instance.TwoAnnotatedParametersIntoOneValue(typeof (TestType), typeof (TestType)); + instance.TwoAnnotatedParametersIntoOneValue (typeof (TestType), typeof (TestType)); instance.NoAnnotation (typeof (TestType)); instance.UnknownValue (); instance.AnnotatedValueToUnAnnotatedParameter (typeof (TestType)); @@ -38,13 +38,13 @@ namespace Mono.Linker.Tests.Cases.DataFlow } // Validate the error message when annotated parameter is passed to another annotated parameter - [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequirePublicConstructors), new Type [] { typeof (Type) }, + [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequirePublicConstructors), new Type[] { typeof (Type) }, "The parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.MethodParametersDataFlow::DefaultConstructorParameter(System.Type)' " + "with dynamically accessed member kinds 'DefaultConstructor' is passed into the parameter 'type' " + "of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.MethodParametersDataFlow::RequirePublicConstructors(System.Type)' " + "which requires dynamically accessed member kinds `PublicConstructors`. " + "To fix this add DynamicallyAccessedMembersAttribute to it and specify at least these member kinds 'PublicConstructors'.")] - [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequireConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequireConstructors), new Type[] { typeof (Type) })] private static void DefaultConstructorParameter ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.DefaultConstructor)] Type type) @@ -54,7 +54,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireConstructors (type); } - [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequireConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequireConstructors), new Type[] { typeof (Type) })] private static void PublicConstructorsParameter ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.PublicConstructors)] Type type) @@ -74,7 +74,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireConstructors (type); } - [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] private void InstanceMethod ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.DefaultConstructor)] Type type) @@ -83,7 +83,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequirePublicConstructors (type); } - [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (WriteToParameterOnInstanceMethod), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (WriteToParameterOnInstanceMethod), new Type[] { typeof (Type) })] private void WriteToParameterOnInstanceMethod ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.Constructors)] Type type) @@ -91,7 +91,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow type = ReturnThingsWithDefaultConstructor (); } - [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (WriteToParameterOnStaticMethod), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (WriteToParameterOnStaticMethod), new Type[] { typeof (Type) })] private static void WriteToParameterOnStaticMethod ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.Constructors)] Type type) @@ -99,7 +99,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow type = ReturnThingsWithDefaultConstructor (); } - [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (LongWriteToParameterOnInstanceMethod), new Type [] { typeof(int), typeof (int), typeof (int), typeof (int), typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (LongWriteToParameterOnInstanceMethod), new Type[] { typeof (int), typeof (int), typeof (int), typeof (int), typeof (Type) })] private void LongWriteToParameterOnInstanceMethod ( int a, int b, int c, int d, [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.Constructors)] @@ -108,7 +108,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow type = ReturnThingsWithDefaultConstructor (); } - [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (LongWriteToParameterOnStaticMethod), new Type [] { typeof (int), typeof (int), typeof (int), typeof (int), typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (LongWriteToParameterOnStaticMethod), new Type[] { typeof (int), typeof (int), typeof (int), typeof (int), typeof (Type) })] private static void LongWriteToParameterOnStaticMethod ( int a, int b, int c, int d, [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.Constructors)] @@ -118,12 +118,12 @@ namespace Mono.Linker.Tests.Cases.DataFlow } [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.DefaultConstructor)] - static private Type ReturnThingsWithDefaultConstructor() + static private Type ReturnThingsWithDefaultConstructor () { return null; } - [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] private void TwoAnnotatedParameters ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.DefaultConstructor)] Type type, @@ -136,7 +136,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequirePublicConstructors (type2); } - [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] private void TwoAnnotatedParametersIntoOneValue ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.DefaultConstructor)] Type type, @@ -149,7 +149,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow } // Validate the error message for the case of unannotated method return value passed to an annotated parameter. - [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequireDefaultConstructor), new Type [] { typeof (Type) }, + [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequireDefaultConstructor), new Type[] { typeof (Type) }, "The parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.MethodParametersDataFlow::NoAnnotation(System.Type)' " + "with dynamically accessed member kinds 'None' is passed into " + "the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.MethodParametersDataFlow::RequireDefaultConstructor(System.Type)' " + @@ -161,16 +161,16 @@ namespace Mono.Linker.Tests.Cases.DataFlow } // Validate error message when untracable value is passed to an annotated parameter. - [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequireDefaultConstructor), new Type [] { typeof (Type) }, + [UnrecognizedReflectionAccessPattern (typeof (MethodParametersDataFlow), nameof (RequireDefaultConstructor), new Type[] { typeof (Type) }, "A value from unknown source is passed " + "into the parameter 'type' of method 'System.Void Mono.Linker.Tests.Cases.DataFlow.MethodParametersDataFlow::RequireDefaultConstructor(System.Type)' " + "which requires dynamically accessed member kinds `DefaultConstructor`. " + "It's not possible to guarantee that these requirements are met by the application.")] private void UnknownValue () { - var array = new object [1]; - array [0] = this.GetType (); - RequireDefaultConstructor ((Type)array [0]); + var array = new object[1]; + array[0] = this.GetType (); + RequireDefaultConstructor ((Type) array[0]); } [RecognizedReflectionAccessPattern] @@ -184,7 +184,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow [RecognizedReflectionAccessPattern] private void UnknownValueToUnAnnotatedParameter () { - RequireNothing (this.GetType()); + RequireNothing (this.GetType ()); } [RecognizedReflectionAccessPattern] @@ -224,7 +224,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow class TestType { - public TestType() { } + public TestType () { } public TestType (int arg) { } private TestType (int arg1, int arg2) { } } diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs index 2ab732604..a4d036181 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs @@ -16,7 +16,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow [SkipKeptItemsValidation] public class MethodReturnParameterDataFlow { - public static void Main() + public static void Main () { var instance = new MethodReturnParameterDataFlow (); @@ -50,20 +50,20 @@ namespace Mono.Linker.Tests.Cases.DataFlow Type constructorsType) { switch (GetHashCode ()) { - case 1: - return defaultConstructorType; - case 2: - return publicConstructorsType; - case 3: - return constructorsType; - case 4: - return typeof (TestType); - default: - return null; + case 1: + return defaultConstructorType; + case 2: + return publicConstructorsType; + case 3: + return constructorsType; + case 4: + return typeof (TestType); + default: + return null; } } - [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (ReturnDefaultConstructorFromUnknownType), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (ReturnDefaultConstructorFromUnknownType), new Type[] { typeof (Type) })] [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.DefaultConstructor)] private Type ReturnDefaultConstructorFromUnknownType (Type unknownType) { @@ -85,7 +85,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow } // Validate error message when insufficiently annotated value is returned from a method - [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (ReturnPublicConstructorsFailure), new Type [] { typeof (Type) }, + [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (ReturnPublicConstructorsFailure), new Type[] { typeof (Type) }, "The parameter 'defaultConstructorType' of method 'System.Type Mono.Linker.Tests.Cases.DataFlow.MethodReturnParameterDataFlow::ReturnPublicConstructorsFailure(System.Type)' " + "with dynamically accessed member kinds 'DefaultConstructor' is " + "passed into the return value of method 'System.Type Mono.Linker.Tests.Cases.DataFlow.MethodReturnParameterDataFlow::ReturnPublicConstructorsFailure(System.Type)' " + @@ -99,7 +99,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow return defaultConstructorType; } - [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (ReturnConstructorsFailure), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (ReturnConstructorsFailure), new Type[] { typeof (Type) })] [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.Constructors)] private Type ReturnConstructorsFailure ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.PublicConstructors)] @@ -108,9 +108,9 @@ namespace Mono.Linker.Tests.Cases.DataFlow return publicConstructorsType; } - [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] - [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (RequireConstructors), new Type [] { typeof (Type) })] - private void PropagateReturnDefaultConstructor() + [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (RequireConstructors), new Type[] { typeof (Type) })] + private void PropagateReturnDefaultConstructor () { Type t = ReturnDefaultConstructor (typeof (TestType), typeof (TestType), typeof (TestType)); RequireDefaultConstructor (t); @@ -119,8 +119,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireNothing (t); } - [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (RequirePublicConstructors), new Type [] { typeof (Type) })] - [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (RequireConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (RequirePublicConstructors), new Type[] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (RequireConstructors), new Type[] { typeof (Type) })] private void PropagateReturnDefaultConstructorFromConstant () { Type t = ReturnDefaultConstructorFromConstant (); diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs index f1ef1d0b8..90ad367f5 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs @@ -22,7 +22,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow PropagateToThisWithSetters (); } - [UnrecognizedReflectionAccessPattern (typeof (TypeTest), nameof (TypeTest.RequireThisMethods), new Type [] { }, + [UnrecognizedReflectionAccessPattern (typeof (TypeTest), nameof (TypeTest.RequireThisMethods), new Type[] { }, "The return value of method 'System.TypeTest Mono.Linker.Tests.Cases.DataFlow.MethodThisDataFlow::GetWithPublicMethods()' " + "with dynamically accessed member kinds 'PublicMethods' " + "is passed into the implicit 'this' parameter of method 'System.Void System.TypeTest::RequireThisMethods()' " + @@ -37,7 +37,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow GetWithMethods ().RequireThisMethods (); } - [UnrecognizedReflectionAccessPattern (typeof (TypeTest), "get_" + nameof (TypeTest.PropertyRequireThisMethods), new Type [] { }, + [UnrecognizedReflectionAccessPattern (typeof (TypeTest), "get_" + nameof (TypeTest.PropertyRequireThisMethods), new Type[] { }, "The return value of method 'System.TypeTest Mono.Linker.Tests.Cases.DataFlow.MethodThisDataFlow::GetWithPublicMethods()' " + "with dynamically accessed member kinds 'PublicMethods' " + "is passed into the implicit 'this' parameter of method 'System.Object System.TypeTest::get_PropertyRequireThisMethods()' " + @@ -52,7 +52,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow _ = GetWithMethods ().PropertyRequireThisMethods; } - [UnrecognizedReflectionAccessPattern (typeof (TypeTest), "set_" + nameof (TypeTest.PropertyRequireThisMethods), new Type [] { typeof(Object) }, + [UnrecognizedReflectionAccessPattern (typeof (TypeTest), "set_" + nameof (TypeTest.PropertyRequireThisMethods), new Type[] { typeof (Object) }, "The return value of method 'System.TypeTest Mono.Linker.Tests.Cases.DataFlow.MethodThisDataFlow::GetWithPublicMethods()' " + "with dynamically accessed member kinds 'PublicMethods' " + "is passed into the implicit 'this' parameter of method 'System.Void System.TypeTest::set_PropertyRequireThisMethods(System.Object)' " + @@ -85,7 +85,7 @@ namespace System class TypeTest : Type { [DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.PublicMethods)] - [UnrecognizedReflectionAccessPattern (typeof (TypeTest), nameof (RequireMethods), new Type [] { typeof (Type) }, + [UnrecognizedReflectionAccessPattern (typeof (TypeTest), nameof (RequireMethods), new Type[] { typeof (Type) }, "The implicit 'this' parameter of method 'System.Void System.TypeTest::RequireThisPublicMethods()' " + "with dynamically accessed member kinds 'PublicMethods' " + "is passed into the parameter 'type' of method 'System.Void System.TypeTest::RequireMethods(System.Type)' " + @@ -157,17 +157,17 @@ namespace System public override string Name => throw new NotImplementedException (); - public override ConstructorInfo [] GetConstructors (BindingFlags bindingAttr) + public override ConstructorInfo[] GetConstructors (BindingFlags bindingAttr) { throw new NotImplementedException (); } - public override object [] GetCustomAttributes (bool inherit) + public override object[] GetCustomAttributes (bool inherit) { throw new NotImplementedException (); } - public override object [] GetCustomAttributes (Type attributeType, bool inherit) + public override object[] GetCustomAttributes (Type attributeType, bool inherit) { throw new NotImplementedException (); } @@ -182,7 +182,7 @@ namespace System throw new NotImplementedException (); } - public override EventInfo [] GetEvents (BindingFlags bindingAttr) + public override EventInfo[] GetEvents (BindingFlags bindingAttr) { throw new NotImplementedException (); } @@ -192,7 +192,7 @@ namespace System throw new NotImplementedException (); } - public override FieldInfo [] GetFields (BindingFlags bindingAttr) + public override FieldInfo[] GetFields (BindingFlags bindingAttr) { throw new NotImplementedException (); } @@ -202,17 +202,17 @@ namespace System throw new NotImplementedException (); } - public override Type [] GetInterfaces () + public override Type[] GetInterfaces () { throw new NotImplementedException (); } - public override MemberInfo [] GetMembers (BindingFlags bindingAttr) + public override MemberInfo[] GetMembers (BindingFlags bindingAttr) { throw new NotImplementedException (); } - public override MethodInfo [] GetMethods (BindingFlags bindingAttr) + public override MethodInfo[] GetMethods (BindingFlags bindingAttr) { throw new NotImplementedException (); } @@ -222,17 +222,17 @@ namespace System throw new NotImplementedException (); } - public override Type [] GetNestedTypes (BindingFlags bindingAttr) + public override Type[] GetNestedTypes (BindingFlags bindingAttr) { throw new NotImplementedException (); } - public override PropertyInfo [] GetProperties (BindingFlags bindingAttr) + public override PropertyInfo[] GetProperties (BindingFlags bindingAttr) { throw new NotImplementedException (); } - public override object InvokeMember (string name, BindingFlags invokeAttr, Binder binder, object target, object [] args, ParameterModifier [] modifiers, CultureInfo culture, string [] namedParameters) + public override object InvokeMember (string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) { throw new NotImplementedException (); } @@ -247,17 +247,17 @@ namespace System throw new NotImplementedException (); } - protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type [] types, ParameterModifier [] modifiers) + protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { throw new NotImplementedException (); } - protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type [] types, ParameterModifier [] modifiers) + protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { throw new NotImplementedException (); } - protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type [] types, ParameterModifier [] modifiers) + protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) { throw new NotImplementedException (); } diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs index 676ba6523..99e47f754 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs @@ -40,7 +40,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow [DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.PublicConstructors)] static Type StaticPropertyWithPublicConstructor { get; set; } - [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), nameof (RequireConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), nameof (RequireConstructors), new Type[] { typeof (Type) })] private void ReadFromInstanceProperty () { RequireDefaultConstructor (PropertyWithPublicConstructor); @@ -49,7 +49,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireNothing (PropertyWithPublicConstructor); } - [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), nameof (RequireConstructors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), nameof (RequireConstructors), new Type[] { typeof (Type) })] private void ReadFromStaticProperty () { RequireDefaultConstructor (StaticPropertyWithPublicConstructor); @@ -58,8 +58,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow RequireNothing (StaticPropertyWithPublicConstructor); } - [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), "set_" + nameof (PropertyWithPublicConstructor), new Type [] { typeof (Type) })] - [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), "set_" + nameof (PropertyWithPublicConstructor), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), "set_" + nameof (PropertyWithPublicConstructor), new Type[] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), "set_" + nameof (PropertyWithPublicConstructor), new Type[] { typeof (Type) })] private void WriteToInstanceProperty () { PropertyWithPublicConstructor = GetTypeWithDefaultConstructor (); @@ -68,8 +68,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow PropertyWithPublicConstructor = GetUnkownType (); } - [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), "set_" + nameof (StaticPropertyWithPublicConstructor), new Type [] { typeof (Type) })] - [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), "set_" + nameof (StaticPropertyWithPublicConstructor), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), "set_" + nameof (StaticPropertyWithPublicConstructor), new Type[] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), "set_" + nameof (StaticPropertyWithPublicConstructor), new Type[] { typeof (Type) })] private void WriteToStaticProperty () { StaticPropertyWithPublicConstructor = GetTypeWithDefaultConstructor (); @@ -102,7 +102,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow return _fieldWithPublicConstructors; } - [UnrecognizedReflectionAccessPattern(typeof (PropertyDataFlow), "set_" + nameof (PropertyDefaultConstructorWithExplicitAccessors), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), "set_" + nameof (PropertyDefaultConstructorWithExplicitAccessors), new Type[] { typeof (Type) })] [param: DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.DefaultConstructor)] set { _fieldWithPublicConstructors = value; @@ -110,7 +110,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow } Type PropertyConstructorsWithExplicitAccessors { - [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), "get_" + nameof (PropertyConstructorsWithExplicitAccessors), new Type [] { })] + [UnrecognizedReflectionAccessPattern (typeof (PropertyDataFlow), "get_" + nameof (PropertyConstructorsWithExplicitAccessors), new Type[] { })] [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberKinds.Constructors)] get { return _fieldWithPublicConstructors; diff --git a/test/Mono.Linker.Tests.Cases/Generics/CorrectOverloadedMethodGetsStrippedInGenericClass.cs b/test/Mono.Linker.Tests.Cases/Generics/CorrectOverloadedMethodGetsStrippedInGenericClass.cs index 362c3bb3d..0da7862c2 100644 --- a/test/Mono.Linker.Tests.Cases/Generics/CorrectOverloadedMethodGetsStrippedInGenericClass.cs +++ b/test/Mono.Linker.Tests.Cases/Generics/CorrectOverloadedMethodGetsStrippedInGenericClass.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Generics { - class CorrectOverloadedMethodGetsStrippedInGenericClass { +namespace Mono.Linker.Tests.Cases.Generics +{ + class CorrectOverloadedMethodGetsStrippedInGenericClass + { public static void Main () { // Call overloaded method through the abstract base class @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Generics { } [KeptMember (".ctor()")] - public abstract class GenericClassWithTwoOverloadedAbstractMethods<T> { + public abstract class GenericClassWithTwoOverloadedAbstractMethods<T> + { public abstract string OverloadedMethod (T thing); // Don't call this one, it should be stripped [Kept] @@ -19,7 +22,8 @@ namespace Mono.Linker.Tests.Cases.Generics { [KeptMember (".ctor()")] [KeptBaseType (typeof (GenericClassWithTwoOverloadedAbstractMethods<System.Single>))] - public class SpecializedClassWithTwoOverloadedVirtualMethods : GenericClassWithTwoOverloadedAbstractMethods<float> { + public class SpecializedClassWithTwoOverloadedVirtualMethods : GenericClassWithTwoOverloadedAbstractMethods<float> + { // Don't call this one, it should be stripped public override string OverloadedMethod (float thing) { diff --git a/test/Mono.Linker.Tests.Cases/Generics/DerivedClassWithMethodOfSameNameAsBaseButDifferentNumberOfGenericParametersUnusedBaseWillGetStripped.cs b/test/Mono.Linker.Tests.Cases/Generics/DerivedClassWithMethodOfSameNameAsBaseButDifferentNumberOfGenericParametersUnusedBaseWillGetStripped.cs index b13f8267e..9a58584d9 100644 --- a/test/Mono.Linker.Tests.Cases/Generics/DerivedClassWithMethodOfSameNameAsBaseButDifferentNumberOfGenericParametersUnusedBaseWillGetStripped.cs +++ b/test/Mono.Linker.Tests.Cases/Generics/DerivedClassWithMethodOfSameNameAsBaseButDifferentNumberOfGenericParametersUnusedBaseWillGetStripped.cs @@ -1,8 +1,10 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Generics { - class DerivedClassWithMethodOfSameNameAsBaseButDifferentNumberOfGenericParametersUnusedBaseWillGetStripped { - public static void Main (string [] args) +namespace Mono.Linker.Tests.Cases.Generics +{ + class DerivedClassWithMethodOfSameNameAsBaseButDifferentNumberOfGenericParametersUnusedBaseWillGetStripped + { + public static void Main (string[] args) { MyDerived obj = new MyDerived (); obj.Method<int, int> (1); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Generics { [Kept] [KeptMember (".ctor()")] - class MyBase { + class MyBase + { public virtual T Method<T> (T arg1) { return arg1; @@ -19,7 +22,8 @@ namespace Mono.Linker.Tests.Cases.Generics { [KeptMember (".ctor()")] [KeptBaseType (typeof (MyBase))] - class MyDerived : MyBase { + class MyDerived : MyBase + { [Kept] public virtual T Method<T, K> (T arg1) { diff --git a/test/Mono.Linker.Tests.Cases/Generics/GenericInstanceInterfaceMethodImplementedWithDifferentGenericArgumentNameDoesNotGetStripped.cs b/test/Mono.Linker.Tests.Cases/Generics/GenericInstanceInterfaceMethodImplementedWithDifferentGenericArgumentNameDoesNotGetStripped.cs index 4a912d678..068189694 100644 --- a/test/Mono.Linker.Tests.Cases/Generics/GenericInstanceInterfaceMethodImplementedWithDifferentGenericArgumentNameDoesNotGetStripped.cs +++ b/test/Mono.Linker.Tests.Cases/Generics/GenericInstanceInterfaceMethodImplementedWithDifferentGenericArgumentNameDoesNotGetStripped.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Generics { - class GenericInstanceInterfaceMethodImplementedWithDifferentGenericArgumentNameDoesNotGetStripped { +namespace Mono.Linker.Tests.Cases.Generics +{ + class GenericInstanceInterfaceMethodImplementedWithDifferentGenericArgumentNameDoesNotGetStripped + { public static void Main () { ISomething it = new Concrete (); @@ -9,17 +11,20 @@ namespace Mono.Linker.Tests.Cases.Generics { } [Kept] - public class GenericType<T> { + public class GenericType<T> + { } - public interface ISomething { + public interface ISomething + { [Kept] GenericType<TInInterface> ShouldNotGetStripped<TInInterface> (); } [KeptMember (".ctor()")] [KeptInterface (typeof (ISomething))] - public class Concrete : ISomething { + public class Concrete : ISomething + { [Kept] public GenericType<TInConcrete> ShouldNotGetStripped<TInConcrete> () { diff --git a/test/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameter.cs b/test/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameter.cs index 5f8a4389e..da2d562b0 100644 --- a/test/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameter.cs +++ b/test/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameter.cs @@ -1,23 +1,27 @@ using System.Collections.Generic; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Generics { - class MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameter { - public static void Main (string [] args) +namespace Mono.Linker.Tests.Cases.Generics +{ + class MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameter + { + public static void Main (string[] args) { Derived<int, int> tmp = new Derived<int, int> (); tmp.Method<int> (null); } [KeptMember (".ctor()")] - public abstract class Base<TSource> { + public abstract class Base<TSource> + { [Kept] public abstract TResult1 Method<TResult1> (IDictionary<TSource, TResult1> arg); } [KeptMember (".ctor()")] [KeptBaseType (typeof (Base<>), "TResult1")] - public class Derived<TSource, TResult1> : Base<TResult1> { + public class Derived<TSource, TResult1> : Base<TResult1> + { [Kept] public override TResult2 Method<TResult2> (IDictionary<TResult1, TResult2> arg) { diff --git a/test/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase.cs b/test/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase.cs index 37d1305dc..f737196de 100644 --- a/test/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase.cs +++ b/test/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase.cs @@ -1,19 +1,23 @@ using System.Collections.Generic; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Generics { - class MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase { - public static void Main (string [] args) +namespace Mono.Linker.Tests.Cases.Generics +{ + class MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase + { + public static void Main (string[] args) { Derived<int, int> tmp = new Derived<int, int> (); tmp.Method<int> (null); } [Kept] - public class Base<TSource> { + public class Base<TSource> + { [KeptMember (".ctor()")] - public abstract class Nested { + public abstract class Nested + { [Kept] public abstract TResult1 Method<TResult1> (IDictionary<TSource, TResult1> arg); } @@ -21,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Generics { [KeptMember (".ctor()")] [KeptBaseType (typeof (Base<>.Nested), "TResult1")] - public class Derived<TSource, TResult1> : Base<TResult1>.Nested { + public class Derived<TSource, TResult1> : Base<TResult1>.Nested + { [Kept] public override TResult2 Method<TResult2> (IDictionary<TResult1, TResult2> arg) { diff --git a/test/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase2.cs b/test/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase2.cs index f6e1370a3..8bd0af0dd 100644 --- a/test/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase2.cs +++ b/test/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase2.cs @@ -1,19 +1,23 @@ using System.Collections.Generic; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Generics { - class MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase2 { - public static void Main (string [] args) +namespace Mono.Linker.Tests.Cases.Generics +{ + class MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameterNestedCase2 + { + public static void Main (string[] args) { Derived<int, int> tmp = new Derived<int, int> (); tmp.Method<int> (null); } [Kept] - public class Base<TSource> { + public class Base<TSource> + { [KeptMember (".ctor()")] - public abstract class Nested<T1, T2, T3> { + public abstract class Nested<T1, T2, T3> + { [Kept] public abstract TResult1 Method<TResult1> (IDictionary<TSource, TResult1> arg); } @@ -21,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Generics { [KeptMember (".ctor()")] [KeptBaseType (typeof (Base<>.Nested<,,>), "TResult1", typeof (int), typeof (int), typeof (string))] - public class Derived<TSource, TResult1> : Base<TResult1>.Nested<int, int, string> { + public class Derived<TSource, TResult1> : Base<TResult1>.Nested<int, int, string> + { [Kept] public override TResult2 Method<TResult2> (IDictionary<TResult1, TResult2> arg) { diff --git a/test/Mono.Linker.Tests.Cases/Generics/NewConstraintOnClass.cs b/test/Mono.Linker.Tests.Cases/Generics/NewConstraintOnClass.cs index 2d644e5c3..ae4991e16 100644 --- a/test/Mono.Linker.Tests.Cases/Generics/NewConstraintOnClass.cs +++ b/test/Mono.Linker.Tests.Cases/Generics/NewConstraintOnClass.cs @@ -30,7 +30,7 @@ namespace Mono.Linker.Tests.Cases.Generics [Kept] [KeptMember (".ctor()")] - class G1<T> where T : G1Ctor, new () + class G1<T> where T : G1Ctor, new() { } } diff --git a/test/Mono.Linker.Tests.Cases/Generics/OverrideWithAnotherVirtualMethodOfSameNameWithDifferentParameterType.cs b/test/Mono.Linker.Tests.Cases/Generics/OverrideWithAnotherVirtualMethodOfSameNameWithDifferentParameterType.cs index ba81282b8..8b67e179d 100644 --- a/test/Mono.Linker.Tests.Cases/Generics/OverrideWithAnotherVirtualMethodOfSameNameWithDifferentParameterType.cs +++ b/test/Mono.Linker.Tests.Cases/Generics/OverrideWithAnotherVirtualMethodOfSameNameWithDifferentParameterType.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Generics { - class OverrideWithAnotherVirtualMethodOfSameNameWithDifferentParameterType { - public static void Main (string [] args) +namespace Mono.Linker.Tests.Cases.Generics +{ + class OverrideWithAnotherVirtualMethodOfSameNameWithDifferentParameterType + { + public static void Main (string[] args) { new Derived<double, int> ().Method (1.0); } [KeptMember (".ctor()")] - public class Base<S> { + public class Base<S> + { [Kept] public virtual S Method (S arg) { @@ -18,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Generics { [KeptMember (".ctor()")] [KeptBaseType (typeof (Base<>), "K")] - public class Derived<K, S> : Base<K> { + public class Derived<K, S> : Base<K> + { [Kept] public override K Method (K arg) { diff --git a/test/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInGenericClassIsNotStripped.cs b/test/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInGenericClassIsNotStripped.cs index 908e0d50d..bd64bd73f 100644 --- a/test/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInGenericClassIsNotStripped.cs +++ b/test/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInGenericClassIsNotStripped.cs @@ -1,13 +1,16 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Generics { - public class UsedOverloadedGenericMethodInGenericClassIsNotStripped { +namespace Mono.Linker.Tests.Cases.Generics +{ + public class UsedOverloadedGenericMethodInGenericClassIsNotStripped + { public static void Main () { B<int>.Method (true); } - class B<TBase> { + class B<TBase> + { [Kept] public static void Method<T> (T value) { diff --git a/test/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInstanceInGenericClassIsNotStripped.cs b/test/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInstanceInGenericClassIsNotStripped.cs index a565d4cf5..5ddd31ea0 100644 --- a/test/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInstanceInGenericClassIsNotStripped.cs +++ b/test/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInstanceInGenericClassIsNotStripped.cs @@ -1,13 +1,16 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Generics { - public class UsedOverloadedGenericMethodInstanceInGenericClassIsNotStripped { +namespace Mono.Linker.Tests.Cases.Generics +{ + public class UsedOverloadedGenericMethodInstanceInGenericClassIsNotStripped + { public static void Main () { B<int>.Method (1); } - class B<TBase> { + class B<TBase> + { public static void Method<T> (T value) { } diff --git a/test/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodWithNoParametersIsNotStripped.cs b/test/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodWithNoParametersIsNotStripped.cs index 52e1ff7b2..99e462bf9 100644 --- a/test/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodWithNoParametersIsNotStripped.cs +++ b/test/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodWithNoParametersIsNotStripped.cs @@ -1,13 +1,16 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Generics { - public class UsedOverloadedGenericMethodWithNoParametersIsNotStripped { +namespace Mono.Linker.Tests.Cases.Generics +{ + public class UsedOverloadedGenericMethodWithNoParametersIsNotStripped + { public static void Main () { B.Call<string, int> (); } - public class B { + public class B + { public static void Method<T> () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly2_Base.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly2_Base.cs index 22b9f378f..ee5b3a26e 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly2_Base.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly2_Base.cs @@ -1,10 +1,14 @@ -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies { - public class TypeWithBaseInCopiedAssembly2_Base { - public abstract class Base : IBase { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies +{ + public class TypeWithBaseInCopiedAssembly2_Base + { + public abstract class Base : IBase + { public abstract void Method (); } - - public interface IBase { + + public interface IBase + { void Method (); } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly3_Base.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly3_Base.cs index 6e6f39d15..a549cb14d 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly3_Base.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly3_Base.cs @@ -1,6 +1,9 @@ -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies { - public class TypeWithBaseInCopiedAssembly3_Base { - public abstract class Base { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies +{ + public class TypeWithBaseInCopiedAssembly3_Base + { + public abstract class Base + { public abstract void Method (); } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly4_Base.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly4_Base.cs index 60b64a755..125b8553d 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly4_Base.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly4_Base.cs @@ -1,10 +1,14 @@ -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies { - public class TypeWithBaseInCopiedAssembly4_Base { - public abstract class Base { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies +{ + public class TypeWithBaseInCopiedAssembly4_Base + { + public abstract class Base + { public abstract void Method (); } - public class Base2 : Base { + public class Base2 : Base + { public override void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly6_Base.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly6_Base.cs index 8c12c7322..63c3306d4 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly6_Base.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly6_Base.cs @@ -1,10 +1,14 @@ -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies { - public class TypeWithBaseInCopiedAssembly6_Base { - public abstract class Base { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies +{ + public class TypeWithBaseInCopiedAssembly6_Base + { + public abstract class Base + { public abstract void Method (); } - - public interface IBase { + + public interface IBase + { void Method (); } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly_Base.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly_Base.cs index e2e3b8fa3..67db14291 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly_Base.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/Dependencies/TypeWithBaseInCopiedAssembly_Base.cs @@ -1,8 +1,10 @@ -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies { - public class TypeWithBaseInCopiedAssembly_Base { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies +{ + public class TypeWithBaseInCopiedAssembly_Base + { public abstract class Base { - public abstract void Method(); + public abstract void Method (); } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/CanDisableOverrideRemoval.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/CanDisableOverrideRemoval.cs index b1ce753f3..697f86d00 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/CanDisableOverrideRemoval.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/CanDisableOverrideRemoval.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval +{ [SetupLinkerArgument ("--disable-opt", "overrideremoval")] - public class CanDisableOverrideRemoval { + public class CanDisableOverrideRemoval + { public static void Main () { Base b = HelperToMarkFooAndRequireBase (); @@ -17,7 +19,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid } [Kept] - class Base { + class Base + { [Kept] public virtual void Method () { @@ -26,7 +29,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptBaseType (typeof (Base))] - class Foo : Base { + class Foo : Base + { [Kept] public override void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfAbstractIsKept.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfAbstractIsKept.cs index 9cbb14504..7bf782a21 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfAbstractIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfAbstractIsKept.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval { - public class OverrideOfAbstractIsKept { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval +{ + public class OverrideOfAbstractIsKept + { public static void Main () { Base b = HelperToMarkFooAndRequireBase (); @@ -15,24 +17,28 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid } [Kept] - abstract class Base { + abstract class Base + { [Kept] public abstract void Method (); } - + [Kept] - [KeptBaseType (typeof(Base))] - abstract class Base2 : Base { + [KeptBaseType (typeof (Base))] + abstract class Base2 : Base + { } [Kept] [KeptBaseType (typeof (Base2))] - abstract class Base3 : Base2 { + abstract class Base3 : Base2 + { } [Kept] [KeptBaseType (typeof (Base3))] - class Foo : Base3 { + class Foo : Base3 + { [Kept] public override void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfAbstractIsKeptNonEmpty.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfAbstractIsKeptNonEmpty.cs index 39299f902..b2a3d5f2b 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfAbstractIsKeptNonEmpty.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfAbstractIsKeptNonEmpty.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class OverrideOfAbstractIsKeptNonEmpty { + public class OverrideOfAbstractIsKeptNonEmpty + { public static void Main () { Base b = HelperToMarkFooAndRequireBase (); @@ -17,24 +19,28 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid } [Kept] - abstract class Base { + abstract class Base + { [Kept] public abstract void Method (); } - + [Kept] - [KeptBaseType (typeof(Base))] - abstract class Base2 : Base { + [KeptBaseType (typeof (Base))] + abstract class Base2 : Base + { } [Kept] [KeptBaseType (typeof (Base2))] - abstract class Base3 : Base2 { + abstract class Base3 : Base2 + { } [Kept] [KeptBaseType (typeof (Base3))] - class Foo : Base3 { + class Foo : Base3 + { [Kept] [ExpectBodyModified] public override void Method () @@ -42,7 +48,7 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid Other (); } - static void Other() + static void Other () { } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfVirtualCanBeRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfVirtualCanBeRemoved.cs index 6277e8338..d356a4586 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfVirtualCanBeRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfVirtualCanBeRemoved.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval { - public class OverrideOfVirtualCanBeRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval +{ + public class OverrideOfVirtualCanBeRemoved + { public static void Main () { Base b = HelperToMarkFooAndRequireBase (); @@ -15,7 +17,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid } [Kept] - class Base { + class Base + { [Kept] public virtual void Method () { @@ -24,7 +27,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptBaseType (typeof (Base))] - class Foo : Base { + class Foo : Base + { public override void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfVirtualCanBeRemoved2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfVirtualCanBeRemoved2.cs index 4bb4df93c..9e86edbb0 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfVirtualCanBeRemoved2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfVirtualCanBeRemoved2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval { - public class OverrideOfVirtualCanBeRemoved2 { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval +{ + public class OverrideOfVirtualCanBeRemoved2 + { public static void Main () { Base b = HelperToMarkFooAndRequireBase (); @@ -15,11 +17,12 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid } [Kept] - abstract class Base { + abstract class Base + { [Kept] public abstract void Method (); } - + [Kept] [KeptBaseType (typeof (Base))] abstract class Base2 : Base @@ -28,7 +31,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptBaseType (typeof (Base2))] - class Base3 : Base2 { + class Base3 : Base2 + { [Kept] public override void Method () { @@ -37,7 +41,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptBaseType (typeof (Base3))] - class Foo : Base3 { + class Foo : Base3 + { public override void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfVirtualCanBeRemoved3.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfVirtualCanBeRemoved3.cs index 1f376e05c..46fa14569 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfVirtualCanBeRemoved3.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideOfVirtualCanBeRemoved3.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval { - public class OverrideOfVirtualCanBeRemoved3 { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval +{ + public class OverrideOfVirtualCanBeRemoved3 + { public static void Main () { - HelperToMarkFoo2AndRequireBase(); + HelperToMarkFoo2AndRequireBase (); Base b = HelperToMarkFooAndRequireBase (); b.Method (); } @@ -14,7 +16,7 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid { return null; } - + [Kept] static Foo2 HelperToMarkFoo2AndRequireBase () { @@ -22,7 +24,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid } [Kept] - class Base { + class Base + { [Kept] public virtual void Method () { @@ -31,7 +34,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptBaseType (typeof (Base))] - class Foo : Base { + class Foo : Base + { public override void Method () { } @@ -39,7 +43,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptBaseType (typeof (Foo))] - class Foo2 : Foo { + class Foo2 : Foo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideThatAlsoFulfilsInterface.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideThatAlsoFulfilsInterface.cs index 428310dad..232babdf0 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideThatAlsoFulfilsInterface.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/OverrideThatAlsoFulfilsInterface.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval { - public class OverrideThatAlsoFulfilsInterface { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval +{ + public class OverrideThatAlsoFulfilsInterface + { public static void Main () { Base b = HelperToMarkFooAndRequireBase (); @@ -25,7 +27,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid } [Kept] - class Base { + class Base + { [Kept] public virtual void Method () { @@ -33,7 +36,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Method (); } @@ -41,7 +45,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class Bar : IFoo { + class Bar : IFoo + { [Kept] public void Method () { @@ -50,7 +55,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptBaseType (typeof (Base))] - class Foo : Base, IFoo { + class Foo : Base, IFoo + { public override void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/PreservesOverriddenMethodOverrideOfUsedVirtualStillRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/PreservesOverriddenMethodOverrideOfUsedVirtualStillRemoved.cs index d21678797..6cfa000bf 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/PreservesOverriddenMethodOverrideOfUsedVirtualStillRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/PreservesOverriddenMethodOverrideOfUsedVirtualStillRemoved.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval { - public class PreservesOverriddenMethodOverrideOfUsedVirtualStillRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval +{ + public class PreservesOverriddenMethodOverrideOfUsedVirtualStillRemoved + { public static void Main () { Base j = new Jar (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptMember (".ctor()")] - abstract class Base { + abstract class Base + { [Kept] public abstract void Foo (); @@ -22,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptBaseType (typeof (Base))] - class Bar : Base { + class Bar : Base + { [Kept] public override void Foo () { @@ -36,7 +40,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (Base))] - class Jar : Base { + class Jar : Base + { [Kept] public override void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/PreservesOverriddenMethodOverrideOfUsedVirtualStillRemoved2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/PreservesOverriddenMethodOverrideOfUsedVirtualStillRemoved2.cs index a1ddd7c30..9fede77ea 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/PreservesOverriddenMethodOverrideOfUsedVirtualStillRemoved2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NoKeptCtor/OverrideRemoval/PreservesOverriddenMethodOverrideOfUsedVirtualStillRemoved2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval { - public class PreservesOverriddenMethodOverrideOfUsedVirtualStillRemoved2 { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval +{ + public class PreservesOverriddenMethodOverrideOfUsedVirtualStillRemoved2 + { public static void Main () { Base j = new Jar (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptMember (".ctor()")] - abstract class Base { + abstract class Base + { [Kept] public abstract void Foo (); @@ -31,7 +34,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptBaseType (typeof (Base2))] - class Bar : Base2 { + class Bar : Base2 + { [Kept] public override void Foo () { @@ -45,7 +49,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.Overrid [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (Base2))] - class Jar : Base2 { + class Jar : Base2 + { [Kept] public override void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly.cs index c55a4b349..05e580904 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly.cs @@ -2,11 +2,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor +{ [SetupLinkerAction ("copy", "base")] - [SetupCompileBefore ("base.dll", new [] {typeof (TypeWithBaseInCopiedAssembly_Base)})] + [SetupCompileBefore ("base.dll", new[] { typeof (TypeWithBaseInCopiedAssembly_Base) })] [KeptMemberInAssembly ("base.dll", typeof (TypeWithBaseInCopiedAssembly_Base.Base), "Method()")] - public class NeverInstantiatedTypeWithBaseInCopiedAssembly { + public class NeverInstantiatedTypeWithBaseInCopiedAssembly + { public static void Main () { Helper (null); @@ -19,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor { [Kept] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly_Base.Base))] - class Foo : TypeWithBaseInCopiedAssembly_Base.Base { + class Foo : TypeWithBaseInCopiedAssembly_Base.Base + { [Kept] public override void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly2.cs index e659a8544..674831a94 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly2.cs @@ -2,12 +2,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor +{ [SetupLinkerAction ("copy", "base2")] - [SetupCompileBefore ("base2.dll", new [] { typeof (TypeWithBaseInCopiedAssembly2_Base)})] + [SetupCompileBefore ("base2.dll", new[] { typeof (TypeWithBaseInCopiedAssembly2_Base) })] [KeptMemberInAssembly ("base2.dll", typeof (TypeWithBaseInCopiedAssembly2_Base.Base), "Method()")] [KeptMemberInAssembly ("base2.dll", typeof (TypeWithBaseInCopiedAssembly2_Base.IBase), "Method()")] - public class NeverInstantiatedTypeWithBaseInCopiedAssembly2 { + public class NeverInstantiatedTypeWithBaseInCopiedAssembly2 + { public static void Main () { Helper (null); @@ -20,7 +22,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor { [Kept] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly2_Base.Base))] - class Foo : TypeWithBaseInCopiedAssembly2_Base.Base { + class Foo : TypeWithBaseInCopiedAssembly2_Base.Base + { [Kept] public override void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly3.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly3.cs index 7eb99e773..f54a7571a 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly3.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly3.cs @@ -2,11 +2,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor +{ [SetupLinkerAction ("copy", "base3")] - [SetupCompileBefore ("base3.dll", new [] {typeof (TypeWithBaseInCopiedAssembly3_Base)})] + [SetupCompileBefore ("base3.dll", new[] { typeof (TypeWithBaseInCopiedAssembly3_Base) })] [KeptMemberInAssembly ("base3.dll", typeof (TypeWithBaseInCopiedAssembly3_Base.Base), "Method()")] - public class NeverInstantiatedTypeWithBaseInCopiedAssembly3 { + public class NeverInstantiatedTypeWithBaseInCopiedAssembly3 + { public static void Main () { Helper (null); @@ -19,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor { [Kept] [KeptBaseType (typeof (Base2))] - class Foo : Base2 { + class Foo : Base2 + { // This method can be removed because the type is never instantiated and the base class // will keep it's override in order to keep the IL valid public override void Method () diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly4.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly4.cs index 1eb532a7f..5199685ea 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly4.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly4.cs @@ -2,11 +2,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor +{ [SetupLinkerAction ("copy", "base4")] - [SetupCompileBefore ("base4.dll", new [] {typeof (TypeWithBaseInCopiedAssembly4_Base)})] + [SetupCompileBefore ("base4.dll", new[] { typeof (TypeWithBaseInCopiedAssembly4_Base) })] [KeptMemberInAssembly ("base4.dll", typeof (TypeWithBaseInCopiedAssembly4_Base.Base), "Method()")] - public class NeverInstantiatedTypeWithBaseInCopiedAssembly4 { + public class NeverInstantiatedTypeWithBaseInCopiedAssembly4 + { public static void Main () { Helper (null); @@ -19,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor { [Kept] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly4_Base.Base2))] - class Foo : TypeWithBaseInCopiedAssembly4_Base.Base2 { + class Foo : TypeWithBaseInCopiedAssembly4_Base.Base2 + { // This method can be removed because the type is never instantiated and the base class // overrides the original abstract method public override void Method () diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly5.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly5.cs index c802d4f99..ec3312afd 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly5.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly5.cs @@ -2,11 +2,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor +{ [SetupLinkerAction ("copy", "base5")] - [SetupCompileBefore ("base5.dll", new [] {typeof (TypeWithBaseInCopiedAssembly4_Base)})] + [SetupCompileBefore ("base5.dll", new[] { typeof (TypeWithBaseInCopiedAssembly4_Base) })] [KeptMemberInAssembly ("base5.dll", typeof (TypeWithBaseInCopiedAssembly4_Base.Base), "Method()")] - public class NeverInstantiatedTypeWithBaseInCopiedAssembly5 { + public class NeverInstantiatedTypeWithBaseInCopiedAssembly5 + { public static void Main () { Helper (null, null); @@ -19,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor { [Kept] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly4_Base.Base2))] - class Foo : TypeWithBaseInCopiedAssembly4_Base.Base2 { + class Foo : TypeWithBaseInCopiedAssembly4_Base.Base2 + { // This method can be removed because the type is never instantiated and the base class // overrides the original abstract method public override void Method () @@ -28,7 +31,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor { } [Kept] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly4_Base.Base2))] - class Bar : TypeWithBaseInCopiedAssembly4_Base.Base2 { + class Bar : TypeWithBaseInCopiedAssembly4_Base.Base2 + { // This method can be removed because the type is never instantiated and the base class // overrides the original abstract method public override void Method () diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly6.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly6.cs index 26822469f..f03cc0fb5 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly6.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly6.cs @@ -2,12 +2,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor +{ [SetupLinkerAction ("copy", "base6")] - [SetupCompileBefore ("base6.dll", new [] { typeof (TypeWithBaseInCopiedAssembly6_Base)})] + [SetupCompileBefore ("base6.dll", new[] { typeof (TypeWithBaseInCopiedAssembly6_Base) })] [KeptMemberInAssembly ("base6.dll", typeof (TypeWithBaseInCopiedAssembly6_Base.Base), "Method()")] [KeptMemberInAssembly ("base6.dll", typeof (TypeWithBaseInCopiedAssembly6_Base.IBase), "Method()")] - public class NeverInstantiatedTypeWithBaseInCopiedAssembly6 { + public class NeverInstantiatedTypeWithBaseInCopiedAssembly6 + { public static void Main () { Helper (null); @@ -20,7 +22,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NotKeptCtor { [Kept] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly6_Base.Base))] - class Foo : TypeWithBaseInCopiedAssembly6_Base.Base, TypeWithBaseInCopiedAssembly6_Base.IBase { + class Foo : TypeWithBaseInCopiedAssembly6_Base.Base, TypeWithBaseInCopiedAssembly6_Base.IBase + { // Must be kept because there is an abstract base method [Kept] public override void Method () diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly.cs index 234bcccb8..a239b57db 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly.cs @@ -2,11 +2,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses +{ [SetupLinkerAction ("copy", "base")] - [SetupCompileBefore ("base.dll", new [] {typeof (TypeWithBaseInCopiedAssembly_Base)})] + [SetupCompileBefore ("base.dll", new[] { typeof (TypeWithBaseInCopiedAssembly_Base) })] [KeptMemberInAssembly ("base.dll", typeof (TypeWithBaseInCopiedAssembly_Base.Base), "Method()")] - public class TypeWithBaseInCopiedAssembly { + public class TypeWithBaseInCopiedAssembly + { public static void Main () { new Foo (); @@ -15,7 +17,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly_Base.Base))] - class Foo : TypeWithBaseInCopiedAssembly_Base.Base { + class Foo : TypeWithBaseInCopiedAssembly_Base.Base + { [Kept] public override void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly2.cs index acbec20fe..534ead4d3 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly2.cs @@ -2,12 +2,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses +{ [SetupLinkerAction ("copy", "base2")] - [SetupCompileBefore ("base2.dll", new [] { typeof (TypeWithBaseInCopiedAssembly2_Base)})] + [SetupCompileBefore ("base2.dll", new[] { typeof (TypeWithBaseInCopiedAssembly2_Base) })] [KeptMemberInAssembly ("base2.dll", typeof (TypeWithBaseInCopiedAssembly2_Base.Base), "Method()")] - [KeptMemberInAssembly ("base2.dll", typeof(TypeWithBaseInCopiedAssembly2_Base.IBase), "Method()")] - public class TypeWithBaseInCopiedAssembly2 { + [KeptMemberInAssembly ("base2.dll", typeof (TypeWithBaseInCopiedAssembly2_Base.IBase), "Method()")] + public class TypeWithBaseInCopiedAssembly2 + { public static void Main () { new Foo (); @@ -16,7 +18,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly2_Base.Base))] - class Foo : TypeWithBaseInCopiedAssembly2_Base.Base { + class Foo : TypeWithBaseInCopiedAssembly2_Base.Base + { [Kept] public override void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly3.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly3.cs index 17bf06475..bb2d0fa14 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly3.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly3.cs @@ -2,11 +2,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses +{ [SetupLinkerAction ("copy", "base3")] - [SetupCompileBefore ("base3.dll", new [] {typeof (TypeWithBaseInCopiedAssembly3_Base)})] + [SetupCompileBefore ("base3.dll", new[] { typeof (TypeWithBaseInCopiedAssembly3_Base) })] [KeptMemberInAssembly ("base3.dll", typeof (TypeWithBaseInCopiedAssembly3_Base.Base), "Method()")] - public class TypeWithBaseInCopiedAssembly3 { + public class TypeWithBaseInCopiedAssembly3 + { public static void Main () { new Foo (); @@ -15,7 +17,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (Base2))] - class Foo : Base2 { + class Foo : Base2 + { [Kept] public override void Method () { @@ -25,7 +28,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly3_Base.Base))] - class Base2 : TypeWithBaseInCopiedAssembly3_Base.Base { + class Base2 : TypeWithBaseInCopiedAssembly3_Base.Base + { [Kept] public override void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly4.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly4.cs index 3c95a907d..c24123691 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly4.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly4.cs @@ -2,11 +2,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses +{ [SetupLinkerAction ("copy", "base4")] - [SetupCompileBefore ("base4.dll", new [] {typeof (TypeWithBaseInCopiedAssembly4_Base)})] + [SetupCompileBefore ("base4.dll", new[] { typeof (TypeWithBaseInCopiedAssembly4_Base) })] [KeptMemberInAssembly ("base4.dll", typeof (TypeWithBaseInCopiedAssembly4_Base.Base), "Method()")] - public class TypeWithBaseInCopiedAssembly4 { + public class TypeWithBaseInCopiedAssembly4 + { public static void Main () { new Foo (); @@ -15,7 +17,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly4_Base.Base2))] - class Foo : TypeWithBaseInCopiedAssembly4_Base.Base2 { + class Foo : TypeWithBaseInCopiedAssembly4_Base.Base2 + { [Kept] public override void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly5.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly5.cs index 8311ca706..d3bcf9176 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly5.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly5.cs @@ -2,11 +2,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses +{ [SetupLinkerAction ("copy", "base5")] - [SetupCompileBefore ("base5.dll", new [] {typeof (TypeWithBaseInCopiedAssembly4_Base)})] + [SetupCompileBefore ("base5.dll", new[] { typeof (TypeWithBaseInCopiedAssembly4_Base) })] [KeptMemberInAssembly ("base5.dll", typeof (TypeWithBaseInCopiedAssembly4_Base.Base), "Method()")] - public class TypeWithBaseInCopiedAssembly5 { + public class TypeWithBaseInCopiedAssembly5 + { public static void Main () { new Foo (); @@ -16,17 +18,19 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly4_Base.Base2))] - class Foo : TypeWithBaseInCopiedAssembly4_Base.Base2 { + class Foo : TypeWithBaseInCopiedAssembly4_Base.Base2 + { [Kept] public override void Method () { } } - + [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly4_Base.Base2))] - class Bar : TypeWithBaseInCopiedAssembly4_Base.Base2 { + class Bar : TypeWithBaseInCopiedAssembly4_Base.Base2 + { [Kept] public override void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly6.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly6.cs index 650c4bb97..5066a0037 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly6.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/TypeWithBaseInCopiedAssembly6.cs @@ -2,12 +2,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses +{ [SetupLinkerAction ("copy", "base6")] - [SetupCompileBefore ("base6.dll", new [] { typeof (TypeWithBaseInCopiedAssembly6_Base)})] + [SetupCompileBefore ("base6.dll", new[] { typeof (TypeWithBaseInCopiedAssembly6_Base) })] [KeptMemberInAssembly ("base6.dll", typeof (TypeWithBaseInCopiedAssembly6_Base.Base), "Method()")] [KeptMemberInAssembly ("base6.dll", typeof (TypeWithBaseInCopiedAssembly6_Base.IBase), "Method()")] - public class TypeWithBaseInCopiedAssembly6 { + public class TypeWithBaseInCopiedAssembly6 + { public static void Main () { Helper (new Foo ()); @@ -22,7 +24,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { [KeptMember (".ctor()")] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly6_Base.Base))] [KeptInterface (typeof (TypeWithBaseInCopiedAssembly6_Base.IBase))] - class Foo : TypeWithBaseInCopiedAssembly6_Base.Base, TypeWithBaseInCopiedAssembly6_Base.IBase { + class Foo : TypeWithBaseInCopiedAssembly6_Base.Base, TypeWithBaseInCopiedAssembly6_Base.IBase + { [Kept] public override void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UnusedAbstractMethodRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UnusedAbstractMethodRemoved.cs index 452493a97..b5b2a4c9c 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UnusedAbstractMethodRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UnusedAbstractMethodRemoved.cs @@ -1,21 +1,25 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { - public class UnusedAbstractMethodRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses +{ + public class UnusedAbstractMethodRemoved + { public static void Main () { var tmp = new B (); } [KeptMember (".ctor()")] - abstract class Base { + abstract class Base + { public abstract void Call (); } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (Base))] - class B : Base { + class B : Base + { public override void Call () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UnusedVirtualMethodRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UnusedVirtualMethodRemoved.cs index 82f5d6729..1fbc769d7 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UnusedVirtualMethodRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UnusedVirtualMethodRemoved.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { - public class UnusedVirtualMethodRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses +{ + public class UnusedVirtualMethodRemoved + { public static void Main () { var tmp = new B (); } [KeptMember (".ctor()")] - abstract class Base { + abstract class Base + { public virtual void Call () { } @@ -17,7 +20,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (Base))] - class B : Base { + class B : Base + { public override void Call () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UsedOverrideOfAbstractMethodIsKept.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UsedOverrideOfAbstractMethodIsKept.cs index f2362aef6..a76b3feed 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UsedOverrideOfAbstractMethodIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UsedOverrideOfAbstractMethodIsKept.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { - public class UsedOverrideOfAbstractMethodIsKept { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses +{ + public class UsedOverrideOfAbstractMethodIsKept + { public static void Main () { var tmp = new B (); @@ -9,7 +11,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { } [KeptMember (".ctor()")] - abstract class Base { + abstract class Base + { [Kept] public abstract void Call (); } @@ -17,7 +20,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (Base))] - class B : Base { + class B : Base + { [Kept] public override void Call () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UsedOverrideOfVirtualMethodIsKept.cs b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UsedOverrideOfVirtualMethodIsKept.cs index e27049e36..7612c805e 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UsedOverrideOfVirtualMethodIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.AbstractClasses/UsedOverrideOfVirtualMethodIsKept.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { - public class UsedOverrideOfVirtualMethodIsKept { +namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses +{ + public class UsedOverrideOfVirtualMethodIsKept + { public static void Main () { var tmp = new B (); @@ -9,7 +11,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { } [KeptMember (".ctor()")] - abstract class Base { + abstract class Base + { [Kept] public virtual void Call () { @@ -19,7 +22,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (Base))] - class B : Base { + class B : Base + { [Kept] public override void Call () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Complex/NoKeptCtor/OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Complex/NoKeptCtor/OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved.cs index 2461fa5ba..6a3e9ade7 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Complex/NoKeptCtor/OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Complex/NoKeptCtor/OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Complex.NoKeptCtor { - public class OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.Complex.NoKeptCtor +{ + public class OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved + { public static void Main () { Foo b = HelperToMarkFooAndRequireBase (); @@ -16,25 +18,27 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Complex.NoKeptCtor { } [Kept] - static void HelperToMarkIBar() + static void HelperToMarkIBar () { - GetAnIBar().Method(); + GetAnIBar ().Method (); } [Kept] - static IBar GetAnIBar() + static IBar GetAnIBar () { return null; } [Kept] - abstract class Base { + abstract class Base + { public abstract void Method (); } [Kept] [KeptBaseType (typeof (Base))] - class Foo : Base, IBar { + class Foo : Base, IBar + { public override void Method () { UsedByOverride (); @@ -46,7 +50,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Complex.NoKeptCtor { } [Kept] - interface IBar { + interface IBar + { [Kept] void Method (); } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Complex/NoKeptCtor/OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Complex/NoKeptCtor/OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved2.cs index bddcd0459..daef4a248 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Complex/NoKeptCtor/OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Complex/NoKeptCtor/OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Complex.NoKeptCtor { - public class OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Complex.NoKeptCtor +{ + public class OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved2 + { public static void Main () { Foo b = null; @@ -16,25 +18,27 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Complex.NoKeptCtor { } [Kept] - static void HelperToMarkIBar() + static void HelperToMarkIBar () { - GetAnIBar().Method(); + GetAnIBar ().Method (); } [Kept] - static IBar GetAnIBar() + static IBar GetAnIBar () { return null; } [Kept] - abstract class Base { + abstract class Base + { public abstract void Method (); } [Kept] [KeptBaseType (typeof (Base))] - class Foo : Base, IBar { + class Foo : Base, IBar + { public override void Method () { UsedByOverride (); @@ -46,7 +50,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Complex.NoKeptCtor { } [Kept] - interface IBar { + interface IBar + { [Kept] void Method (); } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/CanDisableUnusedInterfaces.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/CanDisableUnusedInterfaces.cs index 45286fa5e..c5b80afbf 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/CanDisableUnusedInterfaces.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/CanDisableUnusedInterfaces.cs @@ -1,21 +1,25 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces +{ [SetupLinkerArgument ("--disable-opt", "unusedinterfaces")] - public class CanDisableUnusedInterfaces { + public class CanDisableUnusedInterfaces + { public static void Main () { IFoo i = new A (); i.Foo (); } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } [Kept] - interface IBar { + interface IBar + { // interface methods may still be removed void Bar (); } @@ -23,7 +27,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces { [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] [KeptInterface (typeof (IBar))] - class A : IFoo, IBar { + class A : IFoo, IBar + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy.cs index 72d30becd..de1a710ab 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy.cs @@ -1,10 +1,13 @@ -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies { - public class InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies +{ + public class InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy + { public static void ToKeepReferenceAtCompileTime () { } - - public class A : InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link.IFoo { + + public class A : InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link.IFoo + { void InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link.IFoo.Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link.cs index cf093a8d7..b4eb14368 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link.cs @@ -1,6 +1,9 @@ -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies { - public class InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link { - public interface IFoo { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies +{ + public class InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link + { + public interface IFoo + { void Method (); } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy.cs index 62eb61d3a..1c9535eae 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy.cs @@ -1,10 +1,13 @@ -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies { - public class InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies +{ + public class InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy + { public static void ToKeepReferenceAtCompileTime () { } - - public class A : InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link.IFoo { + + public class A : InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link.IFoo + { public void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link.cs index a03e2708f..cf6a32bf0 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link.cs @@ -1,6 +1,9 @@ -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies { - public class InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link { - public interface IFoo { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies +{ + public class InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link + { + public interface IFoo + { void Method (); } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed_Lib.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed_Lib.cs index e4ca903cb..4b6ec7990 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed_Lib.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/Dependencies/InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed_Lib.cs @@ -4,7 +4,7 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies { public interface IFoo { - bool ExplicitMethod(); + bool ExplicitMethod (); } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/InterfaceOnUninstantiatedTypeRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/InterfaceOnUninstantiatedTypeRemoved.cs index e07ec42f3..6b2cbd511 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/InterfaceOnUninstantiatedTypeRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/InterfaceOnUninstantiatedTypeRemoved.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces +{ [SetupLinkerArgument ("--disable-opt", "unusedinterfaces")] - public class InterfaceOnUninstantiatedTypeRemoved { + public class InterfaceOnUninstantiatedTypeRemoved + { public static void Main () { A a = HelperToMarkA (); @@ -13,13 +15,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } [Kept] - class A : IFoo { + class A : IFoo + { [Kept] public void Foo () { @@ -27,12 +31,14 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces { } [Kept] - static A HelperToMarkA () { + static A HelperToMarkA () + { return null; } [Kept] - static void StandaloneHelperToMarkIFoo () { + static void StandaloneHelperToMarkIFoo () + { // Reference IFoo outside Main to prevent it from being // kept by the body stack logic IFoo i = HelperToMarkIFoo (); @@ -40,7 +46,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces { } [Kept] - static IFoo HelperToMarkIFoo () { + static IFoo HelperToMarkIFoo () + { return null; } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithEvent.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithEvent.cs index 74c0f271e..dccfc6033 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithEvent.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithEvent.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ [KeptDelegateCacheField ("0")] - public class GenericInterfaceWithEvent { - public static void Main() + public class GenericInterfaceWithEvent + { + public static void Main () { IFoo<object> f = new ClassFoo (); f.Foo += EventMethod; @@ -33,7 +35,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] [KeptBackingField] [KeptEventAddMethod] @@ -45,7 +48,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<object>))] - class ClassFoo : BaseFoo, IFoo<object> { + class ClassFoo : BaseFoo, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericBaseMethod.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericBaseMethod.cs index d77720ae2..fbf09d1fe 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericBaseMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericBaseMethod.cs @@ -1,12 +1,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ // mcs silently generates an explicit interface `Method` on `FooWithBase` that calls `BaseFoo.Method`, this leads to a failure // because the explicit interface `Method` needs a `[Kept]` on it. // To work around this, use csc so that the IL that is produced matches the test assertions we define [SetupCSharpCompilerToUse ("csc")] - public class GenericInterfaceWithGenericBaseMethod { + public class GenericInterfaceWithGenericBaseMethod + { public static void Main () { IFoo<object, int> f = new FooWithBase<object, int> (); @@ -14,14 +16,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T1, T2> { + interface IFoo<T1, T2> + { [Kept] void Method (T1 arg, T2 arg2); } [Kept] [KeptMember (".ctor()")] - class BaseFoo<T1, T2> { + class BaseFoo<T1, T2> + { [Kept] public void Method (T1 arg, T2 arg2) { @@ -32,7 +36,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo<,>), "T1", "T2")] [KeptInterface (typeof (IFoo<,>), "T1", "T2")] - class FooWithBase<T1, T2> : BaseFoo<T1, T2>, IFoo<T1, T2> { + class FooWithBase<T1, T2> : BaseFoo<T1, T2>, IFoo<T1, T2> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericBaseMethodWithExplicit.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericBaseMethodWithExplicit.cs index 2add98807..35252bb27 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericBaseMethodWithExplicit.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericBaseMethodWithExplicit.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithGenericBaseMethodWithExplicit { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithGenericBaseMethodWithExplicit + { public static void Main () { IFoo<object, int> f = new FooWithBase<object, int> (); @@ -9,14 +11,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T1, T2> { + interface IFoo<T1, T2> + { [Kept] void Method (T1 arg, T2 arg2); } [Kept] [KeptMember (".ctor()")] - class BaseFoo<T1, T2> { + class BaseFoo<T1, T2> + { public void Method (T1 arg, T2 arg2) { } @@ -26,7 +30,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo<,>), "T1", "T2")] [KeptInterface (typeof (IFoo<,>), "T1", "T2")] - class FooWithBase<T1, T2> : BaseFoo<T1, T2>, IFoo<T1, T2> { + class FooWithBase<T1, T2> : BaseFoo<T1, T2>, IFoo<T1, T2> + { [Kept] void IFoo<T1, T2>.Method (T1 arg, T2 arg2) { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericMethod.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericMethod.cs index 0cace5bbd..42d62e635 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericMethod.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithGenericMethod { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithGenericMethod + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -9,18 +11,20 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<TType> { + interface IFoo<TType> + { [Kept] TMethod Method<TMethod> (TType arg); } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] public TMethod Method<TMethod> (object arg) { - return default(TMethod); + return default (TMethod); } } @@ -28,7 +32,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo, IFoo<object> { + class FooWithBase : BaseFoo, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericMethod2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericMethod2.cs index 9c4a9d63c..2ba99c07d 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericMethod2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericMethod2.cs @@ -1,27 +1,32 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithGenericMethod2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithGenericMethod2 + { public static void Main () { IFoo<object> f = new FooWithBase (); var result = f.Method<object> (null); } - + [Kept] [KeptMember (".ctor()")] - class GenericType<T> { + class GenericType<T> + { } [Kept] - interface IFoo<TType> { + interface IFoo<TType> + { [Kept] GenericType<TMethod> Method<TMethod> (GenericType<TType> arg); } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] public GenericType<TMethod> Method<TMethod> (GenericType<object> arg) { @@ -33,7 +38,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo, IFoo<object> { + class FooWithBase : BaseFoo, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericMethod3.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericMethod3.cs index f62ba7bca..2a68fcb8d 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericMethod3.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithGenericMethod3.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithGenericMethod3 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithGenericMethod3 + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -9,14 +11,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<TType> { + interface IFoo<TType> + { [Kept] void Method<TMethod> (TType arg, TMethod arg2); } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] public void Method<TMethod> (object arg, TMethod arg2) { @@ -27,7 +31,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo, IFoo<object> { + class FooWithBase : BaseFoo, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethod.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethod.cs index cb0cdb95c..ea7148263 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethod.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithMethod { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithMethod + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -9,14 +11,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (T arg); } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] public void Method (object arg) { @@ -27,7 +31,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo, IFoo<object> { + class FooWithBase : BaseFoo, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethod2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethod2.cs index 283764abf..9d0dcf395 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethod2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethod2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithMethod2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithMethod2 + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -9,18 +11,21 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - class GenericType<T> { + class GenericType<T> + { } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (GenericType<T> arg); } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] public void Method (GenericType<object> arg) { @@ -31,7 +36,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo, IFoo<object> { + class FooWithBase : BaseFoo, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethod3.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethod3.cs index 8e69856bd..ac1004cc8 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethod3.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethod3.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithMethod3 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithMethod3 + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -9,18 +11,21 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - class GenericType<T> { + class GenericType<T> + { } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (GenericType<GenericType<GenericType<T>>> arg); } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] public void Method (GenericType<GenericType<GenericType<object>>> arg) { @@ -31,7 +36,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo, IFoo<object> { + class FooWithBase : BaseFoo, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodComplex.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodComplex.cs index ece8352ce..9286f79a4 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodComplex.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodComplex.cs @@ -1,12 +1,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ // mcs silently generates an explicit interface `Method` on `FooWithBase` that calls `BaseFoo.Method`, this leads to a failure // because the explicit interface `Method` needs a `[Kept]` on it. // To work around this, use csc so that the IL that is produced matches the test assertions we define [SetupCSharpCompilerToUse ("csc")] - public class GenericInterfaceWithMethodComplex { + public class GenericInterfaceWithMethodComplex + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -14,14 +16,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (T arg, int arg2); } [Kept] [KeptMember (".ctor()")] - class BaseFoo<T1> { + class BaseFoo<T1> + { [Kept] public void Method (object arg, T1 arg2) { @@ -31,26 +35,30 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo<>), "T1")] - class BaseFoo2<T1> : BaseFoo<T1> { + class BaseFoo2<T1> : BaseFoo<T1> + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo2<>), "T1")] - class BaseFoo3<T1> : BaseFoo2<T1> { + class BaseFoo3<T1> : BaseFoo2<T1> + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo3<>), "T1")] - class BaseFoo4<T1> : BaseFoo3<T1> { + class BaseFoo4<T1> : BaseFoo3<T1> + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo4<int>))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo4<int>, IFoo<object> { + class FooWithBase : BaseFoo4<int>, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodComplex2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodComplex2.cs index 64b560f07..c121ca5a1 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodComplex2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodComplex2.cs @@ -2,12 +2,14 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ // mcs silently generates an explicit interface `Method` on `FooWithBase` that calls `BaseFoo.Method`, this leads to a failure // because the explicit interface `Method` needs a `[Kept]` on it. // To work around this, use csc so that the IL that is produced matches the test assertions we define [SetupCSharpCompilerToUse ("csc")] - public class GenericInterfaceWithMethodComplex2 { + public class GenericInterfaceWithMethodComplex2 + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -15,14 +17,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (T arg, int arg2); } [Kept] [KeptMember (".ctor()")] - class BaseFoo<T1> { + class BaseFoo<T1> + { [Kept] public void Method (object arg, T1 arg2) { @@ -38,26 +42,30 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo<>), "T1")] - class BaseFoo2<T1> : BaseFoo<T1> { + class BaseFoo2<T1> : BaseFoo<T1> + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo2<>), "T1")] - class BaseFoo3<T1> : BaseFoo2<T1> { + class BaseFoo3<T1> : BaseFoo2<T1> + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo3<>), "T1")] - class BaseFoo4<T1> : BaseFoo3<T1> { + class BaseFoo4<T1> : BaseFoo3<T1> + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo4<int>))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo4<int>, IFoo<object> { + class FooWithBase : BaseFoo4<int>, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBaseInterfaces.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBaseInterfaces.cs index ac5cc4cb4..f9b338ead 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBaseInterfaces.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBaseInterfaces.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithMethodManyBaseInterfaces { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithMethodManyBaseInterfaces + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -9,20 +11,24 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (T arg); } - - interface IFoo2<T> : IFoo<T> { + + interface IFoo2<T> : IFoo<T> + { } - - interface IFoo3<T> : IFoo2<T> { + + interface IFoo3<T> : IFoo2<T> + { } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] public void Method (object arg) { @@ -33,7 +39,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo, IFoo3<object> { + class FooWithBase : BaseFoo, IFoo3<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBases.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBases.cs index b39dfe14f..fb2ed835a 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBases.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBases.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithMethodManyBases { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithMethodManyBases + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -9,14 +11,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (T arg); } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] public void Method (object arg) { @@ -26,26 +30,30 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] - class BaseFoo2 : BaseFoo { + class BaseFoo2 : BaseFoo + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo2))] - class BaseFoo3 : BaseFoo2 { + class BaseFoo3 : BaseFoo2 + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo3))] - class BaseFoo4 : BaseFoo3 { + class BaseFoo4 : BaseFoo3 + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo4))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo4, IFoo<object> { + class FooWithBase : BaseFoo4, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBases2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBases2.cs index 4370698f0..17a59bedc 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBases2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBases2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithMethodManyBases2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithMethodManyBases2 + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -9,14 +11,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (T arg); } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { public void Method (object arg) { } @@ -25,13 +29,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] - class BaseFoo2 : BaseFoo { + class BaseFoo2 : BaseFoo + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo2))] - class BaseFoo3 : BaseFoo2 { + class BaseFoo3 : BaseFoo2 + { [Kept] public void Method (object arg) { @@ -41,14 +47,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo3))] - class BaseFoo4 : BaseFoo3 { + class BaseFoo4 : BaseFoo3 + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo4))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo4, IFoo<object> { + class FooWithBase : BaseFoo4, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBases3.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBases3.cs index fc7de4e8b..c546cdd5a 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBases3.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyBases3.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithMethodManyBases3 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithMethodManyBases3 + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -9,14 +11,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (T arg); } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] public virtual void Method (object arg) { @@ -26,13 +30,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] - class BaseFoo2 : BaseFoo { + class BaseFoo2 : BaseFoo + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo2))] - class BaseFoo3 : BaseFoo2 { + class BaseFoo3 : BaseFoo2 + { [Kept] public override void Method (object arg) { @@ -42,14 +48,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo3))] - class BaseFoo4 : BaseFoo3 { + class BaseFoo4 : BaseFoo3 + { } [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo4))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo4, IFoo<object> { + class FooWithBase : BaseFoo4, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyVariations.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyVariations.cs index 965976403..078f4b94c 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyVariations.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodManyVariations.cs @@ -1,26 +1,30 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithMethodManyVariations { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithMethodManyVariations + { public static void Main () { var fb = new FooWithBase (); IFoo<object> fo = fb; fo.Method (null); - + IFoo<int> fi = fb; fi.Method (0); } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (T arg); } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] public void Method (object arg) { @@ -55,11 +59,13 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptInterface (typeof (IFoo<int>))] [KeptInterface (typeof (IFoo<string>))] // FIXME : Should be removed [KeptInterface (typeof (IFoo<Bar>))] // FIXME : Should be removed - class FooWithBase : BaseFoo, IFoo<object>, IFoo<int>, IFoo<string>, IFoo<Bar> { + class FooWithBase : BaseFoo, IFoo<object>, IFoo<int>, IFoo<string>, IFoo<Bar> + { } [Kept] // FIXME : Should be removed - class Bar { + class Bar + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodNested.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodNested.cs index 9704459c6..7da82eb78 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodNested.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodNested.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithMethodNested { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithMethodNested + { public static void Main () { IFoo<IFoo<IFoo<IFoo<object>>>> f = new FooWithBase (); @@ -9,14 +11,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (T arg); } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] public void Method (IFoo<IFoo<IFoo<object>>> arg) { @@ -27,7 +31,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<IFoo<IFoo<IFoo<object>>>>))] - class FooWithBase : BaseFoo, IFoo<IFoo<IFoo<IFoo<object>>>> { + class FooWithBase : BaseFoo, IFoo<IFoo<IFoo<IFoo<object>>>> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodOnNoInstanceCtor.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodOnNoInstanceCtor.cs index 56e268295..b47644959 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodOnNoInstanceCtor.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodOnNoInstanceCtor.cs @@ -1,12 +1,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithMethodOnNoInstanceCtor { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithMethodOnNoInstanceCtor + { public static void Main () { - IFoo<object> f = new OtherWithFoo(); + IFoo<object> f = new OtherWithFoo (); f.Method (null); - UsedToMarkTypeOnly(null); + UsedToMarkTypeOnly (null); } [Kept] @@ -15,13 +17,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (T arg); } [Kept] - class BaseFoo { + class BaseFoo + { [Kept] public void Method (object arg) { @@ -31,13 +35,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo, IFoo<object> { + class FooWithBase : BaseFoo, IFoo<object> + { } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo<object>))] - class OtherWithFoo : IFoo<object> { + class OtherWithFoo : IFoo<object> + { [Kept] public void Method (object arg) { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodOnNoInstanceCtor2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodOnNoInstanceCtor2.cs index a20c64add..04d942029 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodOnNoInstanceCtor2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithMethodOnNoInstanceCtor2.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ /// <summary> /// Interface must remain in this case due to the possible types on the stack /// </summary> - public class GenericInterfaceWithMethodOnNoInstanceCtor2 { + public class GenericInterfaceWithMethodOnNoInstanceCtor2 + { public static void Main () { IFoo<object> f = new OtherWithFoo (); @@ -13,13 +15,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (T arg); } [Kept] - class BaseFoo { + class BaseFoo + { public void Method (object arg) { } @@ -27,7 +31,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptBaseType (typeof (BaseFoo))] - class FooWithBase : BaseFoo, IFoo<object> { + class FooWithBase : BaseFoo, IFoo<object> + { [Kept] public static void UsedToMarkTypeOnly () { @@ -37,7 +42,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo<object>))] - class OtherWithFoo : IFoo<object> { + class OtherWithFoo : IFoo<object> + { [Kept] public void Method (object arg) { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertyGetter.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertyGetter.cs index e21f2d439..dd75b0f42 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertyGetter.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertyGetter.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithPropertyGetter { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithPropertyGetter + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -9,14 +11,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] T Property { get; [Kept] set; } } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] [KeptBackingField] public object Property { get; [Kept] set; } @@ -26,7 +30,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo, IFoo<object> { + class FooWithBase : BaseFoo, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertyGetter2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertyGetter2.cs index 95cfbe973..d6ea52171 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertyGetter2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertyGetter2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithPropertyGetter2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithPropertyGetter2 + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -10,18 +12,21 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptMember (".ctor()")] - class GenericType<T> { + class GenericType<T> + { } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] GenericType<T> Property { get; [Kept] set; } } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] [KeptBackingField] public GenericType<object> Property { get; [Kept] set; } @@ -31,7 +36,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo, IFoo<object> { + class FooWithBase : BaseFoo, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertySetter.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertySetter.cs index 19233b630..9bc7ffaa2 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertySetter.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertySetter.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithPropertySetter { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithPropertySetter + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -9,14 +11,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] T Property { [Kept] get; set; } } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] [KeptBackingField] public object Property { [Kept] get; set; } @@ -26,7 +30,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo, IFoo<object> { + class FooWithBase : BaseFoo, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertySetter2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertySetter2.cs index c8907671e..897841e7d 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertySetter2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/GenericInterfaceWithPropertySetter2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class GenericInterfaceWithPropertySetter2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class GenericInterfaceWithPropertySetter2 + { public static void Main () { IFoo<object> f = new FooWithBase (); @@ -9,18 +11,21 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - class GenericType<T> { + class GenericType<T> + { } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] GenericType<T> Property { [Kept] get; set; } } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] [KeptBackingField] public GenericType<object> Property { [Kept] get; set; } @@ -30,7 +35,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo<object>))] - class FooWithBase : BaseFoo, IFoo<object> { + class FooWithBase : BaseFoo, IFoo<object> + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/InterfaceRemovedWhenMethodUsedDirectly.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/InterfaceRemovedWhenMethodUsedDirectly.cs index de61e3b3c..a78d14d4e 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/InterfaceRemovedWhenMethodUsedDirectly.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/InterfaceRemovedWhenMethodUsedDirectly.cs @@ -1,20 +1,24 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class InterfaceRemovedWhenMethodUsedDirectly { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class InterfaceRemovedWhenMethodUsedDirectly + { public static void Main () { var f = new FooWithBase (); f.Method (); } - interface IFoo { + interface IFoo + { void Method (); } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] public void Method () { @@ -24,7 +28,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] - class FooWithBase : BaseFoo, IFoo { + class FooWithBase : BaseFoo, IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleEvent.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleEvent.cs index c5ce60059..7aed0ec79 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleEvent.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleEvent.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ [KeptDelegateCacheField ("0")] - public class SimpleEvent { - public static void Main() + public class SimpleEvent + { + public static void Main () { IFoo f = new FooWithBase (); f.Foo += EventMethod; @@ -23,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro delegate void CustomDelegate (); [Kept] - interface IFoo { + interface IFoo + { [Kept] [KeptEventAddMethod] [KeptEventRemoveMethod] @@ -32,7 +35,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] [KeptBackingField] [KeptEventAddMethod] @@ -44,7 +48,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo))] - class FooWithBase : BaseFoo, IFoo { + class FooWithBase : BaseFoo, IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleMethod.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleMethod.cs index 8d0efab53..a395d4197 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleMethod.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class SimpleMethod { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class SimpleMethod + { public static void Main () { IFoo f = new FooWithBase (); @@ -9,14 +11,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Method (); } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] public void Method () { @@ -27,7 +31,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo))] - class FooWithBase : BaseFoo, IFoo { + class FooWithBase : BaseFoo, IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleMethodOnNoInstanceCtor.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleMethodOnNoInstanceCtor.cs index b232ee2ea..1e75863e8 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleMethodOnNoInstanceCtor.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleMethodOnNoInstanceCtor.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ /// <summary> /// Interface must remain in this case due to the possible types on the stack /// </summary> - public class SimpleMethodOnNoInstanceCtor { + public class SimpleMethodOnNoInstanceCtor + { public static void Main () { IFoo f = new OtherWithFoo (); @@ -18,13 +20,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Method (); } [Kept] - class BaseFoo { + class BaseFoo + { [Kept] public void Method () { @@ -34,13 +38,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo))] - class FooWithBase : BaseFoo, IFoo { + class FooWithBase : BaseFoo, IFoo + { } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class OtherWithFoo : IFoo { + class OtherWithFoo : IFoo + { [Kept] public void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleMethodOnNoInstanceCtor2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleMethodOnNoInstanceCtor2.cs index 5b83c990b..631816d05 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleMethodOnNoInstanceCtor2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleMethodOnNoInstanceCtor2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class SimpleMethodOnNoInstanceCtor2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class SimpleMethodOnNoInstanceCtor2 + { public static void Main () { IFoo f = new OtherWithFoo (); @@ -10,13 +12,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Method (); } [Kept] - class BaseFoo { + class BaseFoo + { public void Method () { } @@ -24,9 +28,10 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptBaseType (typeof (BaseFoo))] - class FooWithBase : BaseFoo, IFoo { + class FooWithBase : BaseFoo, IFoo + { [Kept] - public static void UsedToMarkTypeOnly() + public static void UsedToMarkTypeOnly () { } } @@ -34,7 +39,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class OtherWithFoo : IFoo { + class OtherWithFoo : IFoo + { [Kept] public void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleProperty.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleProperty.cs index 969746e53..20f196c7d 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleProperty.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/BaseProvidesInterfaceMember/SimpleProperty.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember { - public class SimpleProperty { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BaseProvidesInterfaceMember +{ + public class SimpleProperty + { public static void Main () { IFoo f = new FooWithBase (); @@ -9,14 +11,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro } [Kept] - interface IFoo { + interface IFoo + { [Kept] int Property { get; [Kept] set; } } [Kept] [KeptMember (".ctor()")] - class BaseFoo { + class BaseFoo + { [Kept] [KeptBackingField] public int Property { get; [Kept] set; } @@ -26,7 +30,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.BasePro [KeptMember (".ctor()")] [KeptBaseType (typeof (BaseFoo))] [KeptInterface (typeof (IFoo))] - class FooWithBase : BaseFoo, IFoo { + class FooWithBase : BaseFoo, IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplementingInterfaceMethodsNested.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplementingInterfaceMethodsNested.cs index 3a4b3b197..c449911f6 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplementingInterfaceMethodsNested.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplementingInterfaceMethodsNested.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class ClassImplementingInterfaceMethodsNested { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class ClassImplementingInterfaceMethodsNested + { public static void Main () { IFoo i = new A (); @@ -9,19 +11,22 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } - interface IBar : IFoo { + interface IBar : IFoo + { void Bar (); } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class A : IBar { + class A : IBar + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplementingInterfaceMethodsNested2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplementingInterfaceMethodsNested2.cs index aba1ed062..db1ee8d82 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplementingInterfaceMethodsNested2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplementingInterfaceMethodsNested2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class ClassImplementingInterfaceMethodsNested2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class ClassImplementingInterfaceMethodsNested2 + { public static void Main () { IBar b = new A (); @@ -10,22 +12,25 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } - + [Kept] [KeptInterface (typeof (IFoo))] - interface IBar : IFoo { + interface IBar : IFoo + { void Bar (); } - + [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IBar))] [KeptInterface (typeof (IFoo))] - class A : IBar { + class A : IBar + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass2.cs index 0d7f9353e..773d19a42 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - class ClassImplemtingInterfaceMethodsThroughBaseClass2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + class ClassImplemtingInterfaceMethodsThroughBaseClass2 + { public static void Main () { new B (); @@ -9,20 +11,23 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { i.Foo (); } - interface IFoo { + interface IFoo + { [Kept] void Foo (); } [KeptMember (".ctor()")] - class B { + class B + { [Kept] // FIXME: Should be removed public void Foo () { } } - class A : B, IFoo { + class A : B, IFoo + { //my IFoo.Foo() is actually implemented by B which doesn't know about it. } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass3.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass3.cs index 1154be592..a0aa654cd 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass3.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass3.cs @@ -1,25 +1,30 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - class ClassImplemtingInterfaceMethodsThroughBaseClass3 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + class ClassImplemtingInterfaceMethodsThroughBaseClass3 + { public static void Main () { new B ().Foo (); } - interface IFoo { + interface IFoo + { void Foo (); } [KeptMember (".ctor()")] - class B { + class B + { [Kept] public void Foo () { } } - class A : B, IFoo { + class A : B, IFoo + { //my IFoo.Foo() is actually implemented by B which doesn't know about it. } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass4.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass4.cs index 7a01c07ac..0568a083d 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass4.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass4.cs @@ -1,18 +1,22 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - class ClassImplemtingInterfaceMethodsThroughBaseClass4 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + class ClassImplemtingInterfaceMethodsThroughBaseClass4 + { public static void Main () { new A ().Foo (); } - interface IFoo { + interface IFoo + { void Foo (); } [KeptMember (".ctor()")] - class B { + class B + { [Kept] public void Foo () { @@ -21,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [KeptMember (".ctor()")] [KeptBaseType (typeof (B))] - class A : B, IFoo { + class A : B, IFoo + { //my IFoo.Foo() is actually implemented by B which doesn't know about it. } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass5.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass5.cs index f7ebfda35..c68047a41 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass5.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass5.cs @@ -1,18 +1,22 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - class ClassImplemtingInterfaceMethodsThroughBaseClass5 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + class ClassImplemtingInterfaceMethodsThroughBaseClass5 + { public static void Main () { new A (); } - interface IFoo { + interface IFoo + { void Foo (); } [KeptMember (".ctor()")] - class B { + class B + { public void Foo () { } @@ -20,7 +24,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [KeptMember (".ctor()")] [KeptBaseType (typeof (B))] - class A : B, IFoo { + class A : B, IFoo + { //my IFoo.Foo() is actually implemented by B which doesn't know about it. } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass6.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass6.cs index 1f43d756f..7e4f29dbd 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass6.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassImplemtingInterfaceMethodsThroughBaseClass6.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - class ClassImplemtingInterfaceMethodsThroughBaseClass6 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + class ClassImplemtingInterfaceMethodsThroughBaseClass6 + { public static void Main () { B tmp = new B (); @@ -9,26 +11,30 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { i.Foo (); } - interface IFoo { + interface IFoo + { [Kept] void Foo (); } [KeptMember (".ctor()")] - class B { + class B + { [Kept] // FIXME: Needs to be removed public void Foo () { } } - class A : B, IFoo { + class A : B, IFoo + { //my IFoo.Foo() is actually implemented by B which doesn't know about it. } [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class C : IFoo { + class C : IFoo + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs index 8c9212981..dae63399b 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs @@ -2,7 +2,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - class ClassUsedFromConcreteTypeHasInterfaceMethodRemoved { + class ClassUsedFromConcreteTypeHasInterfaceMethodRemoved + { public static void Main () { A a = new A (); @@ -11,14 +12,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType [Kept] [KeptMember (".ctor()")] - class A : IFoo { + class A : IFoo + { [Kept] public void Foo () { } } - public interface IFoo { + public interface IFoo + { void Foo (); } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved2.cs index f754047ca..2562faf27 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class ClassUsedFromConcreteTypeHasInterfaceMethodRemoved2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class ClassUsedFromConcreteTypeHasInterfaceMethodRemoved2 + { public static void Main () { A a = new A (); @@ -14,7 +16,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class A : IFoo { + class A : IFoo + { [Kept] public void Foo () { @@ -22,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - public interface IFoo { + public interface IFoo + { void Foo (); } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassUsedFromInterfaceHasInterfaceMethodKept.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassUsedFromInterfaceHasInterfaceMethodKept.cs index a04dcb72c..613290a62 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassUsedFromInterfaceHasInterfaceMethodKept.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ClassUsedFromInterfaceHasInterfaceMethodKept.cs @@ -2,7 +2,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - class ClassUsedFromInterfaceHasInterfaceMethodKept { + class ClassUsedFromInterfaceHasInterfaceMethodKept + { public static void Main () { IFoo a = new A (); @@ -12,7 +13,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class A : IFoo { + class A : IFoo + { [Kept] public void Foo () { @@ -20,7 +22,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType } [Kept] - public interface IFoo { + public interface IFoo + { [Kept] void Foo (); } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ExplicitInterfaceMethodWhichCreatesInstanceOfParentType.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ExplicitInterfaceMethodWhichCreatesInstanceOfParentType.cs index a9f3729d0..e7eacad3d 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ExplicitInterfaceMethodWhichCreatesInstanceOfParentType.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ExplicitInterfaceMethodWhichCreatesInstanceOfParentType.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class ExplicitInterfaceMethodWhichCreatesInstanceOfParentType { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class ExplicitInterfaceMethodWhichCreatesInstanceOfParentType + { public static void Main () { IFoo b = new B (); @@ -9,7 +11,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Method (); } @@ -17,14 +20,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class B : IFoo { + class B : IFoo + { [Kept] public void Method () { } } - - class C : IFoo { + + class C : IFoo + { void IFoo.Method () { new C (); } } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceMarkOrderingDoesNotMatter.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceMarkOrderingDoesNotMatter.cs index 6a2597c8c..c8f145f63 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceMarkOrderingDoesNotMatter.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceMarkOrderingDoesNotMatter.cs @@ -1,18 +1,20 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class InterfaceMarkOrderingDoesNotMatter { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class InterfaceMarkOrderingDoesNotMatter + { public static void Main () { CauseAToBeMarked ().AMethod (); CauseZToBeMarked ().ZMethod (); - + MMarked m = new MMarked (); B b = m; Y y = m; Nested.F f = m; - + b.BMethod (); y.YMethod (); f.FMethod (); @@ -23,7 +25,7 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { { return null; } - + [Kept] static Z CauseZToBeMarked () { @@ -31,19 +33,22 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - interface A { + interface A + { [Kept] void AMethod (); } [Kept] - interface Z { + interface Z + { [Kept] void ZMethod (); } - + [Kept] - interface C { + interface C + { [Kept] void CMethod (); } @@ -58,9 +63,10 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [KeptInterface (typeof (Y))] [KeptInterface (typeof (Z))] [KeptInterface (typeof (E))] - class MMarked : A, B, Y, Z, C, D, Nested.F, E { + class MMarked : A, B, Y, Z, C, D, Nested.F, E + { [Kept] - public void AMethod() + public void AMethod () { } @@ -101,34 +107,40 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - public static class Nested { + public static class Nested + { [Kept] - public interface F { + public interface F + { [Kept] void FMethod (); } } [Kept] - interface B { + interface B + { [Kept] void BMethod (); } [Kept] - interface Y { + interface Y + { [Kept] void YMethod (); } [Kept] - interface D { + interface D + { [Kept] void DMethod (); } [Kept] - interface E { + interface E + { [Kept] void EMethod (); } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceMarkOrderingDoesNotMatter2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceMarkOrderingDoesNotMatter2.cs index 1831dcd57..a2f3aff82 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceMarkOrderingDoesNotMatter2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceMarkOrderingDoesNotMatter2.cs @@ -15,9 +15,10 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType [KeptInterface (typeof (InterfaceMarkOrderingDoesNotMatter2_Z.E))] class InterfaceMarkOrderingDoesNotMatter2_A : InterfaceMarkOrderingDoesNotMatter2_Z.A, InterfaceMarkOrderingDoesNotMatter2_Z.B, InterfaceMarkOrderingDoesNotMatter2_Z.Y, InterfaceMarkOrderingDoesNotMatter2_Z.Z, InterfaceMarkOrderingDoesNotMatter2_Z.C, InterfaceMarkOrderingDoesNotMatter2_Z.D, - InterfaceMarkOrderingDoesNotMatter2_Z.Nested.F, InterfaceMarkOrderingDoesNotMatter2_Z.E { + InterfaceMarkOrderingDoesNotMatter2_Z.Nested.F, InterfaceMarkOrderingDoesNotMatter2_Z.E + { [Kept] - public void AMethod() + public void AMethod () { } @@ -59,84 +60,94 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType public class InterfaceMarkOrderingDoesNotMatter2 { - public static void Main() + public static void Main () { - CauseAToBeMarked().AMethod(); - CauseZToBeMarked().ZMethod(); + CauseAToBeMarked ().AMethod (); + CauseZToBeMarked ().ZMethod (); - InterfaceMarkOrderingDoesNotMatter2_A mUsedInCode = new InterfaceMarkOrderingDoesNotMatter2_A(); + InterfaceMarkOrderingDoesNotMatter2_A mUsedInCode = new InterfaceMarkOrderingDoesNotMatter2_A (); InterfaceMarkOrderingDoesNotMatter2_Z.B b = mUsedInCode; InterfaceMarkOrderingDoesNotMatter2_Z.Y y = mUsedInCode; InterfaceMarkOrderingDoesNotMatter2_Z.Nested.F f = mUsedInCode; - b.BMethod(); - y.YMethod(); - f.FMethod(); + b.BMethod (); + y.YMethod (); + f.FMethod (); } - + [Kept] static InterfaceMarkOrderingDoesNotMatter2_Z.A CauseAToBeMarked () { return null; } - + [Kept] static InterfaceMarkOrderingDoesNotMatter2_Z.Z CauseZToBeMarked () { return null; } } - + [Kept] - public class InterfaceMarkOrderingDoesNotMatter2_Z { + public class InterfaceMarkOrderingDoesNotMatter2_Z + { [Kept] - public interface A { + public interface A + { [Kept] void AMethod (); } [Kept] - public interface Z { + public interface Z + { [Kept] void ZMethod (); } - + [Kept] - public interface C { + public interface C + { [Kept] void CMethod (); } [Kept] - public static class Nested { + public static class Nested + { [Kept] - public interface F { + public interface F + { [Kept] void FMethod (); } } [Kept] - public interface B { + public interface B + { [Kept] void BMethod (); } [Kept] - public interface Y { + public interface Y + { [Kept] void YMethod (); } [Kept] - public interface D { + public interface D + { [Kept] void DMethod (); } [Kept] - public interface E { + public interface E + { [Kept] void EMethod (); } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceMarkOrderingDoesNotMatter3.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceMarkOrderingDoesNotMatter3.cs index 5c658dedc..a5b5e4039 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceMarkOrderingDoesNotMatter3.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceMarkOrderingDoesNotMatter3.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class InterfaceMarkOrderingDoesNotMatter3 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class InterfaceMarkOrderingDoesNotMatter3 + { public static void Main () { CauseAToBeMarked ().AMethod (); @@ -9,7 +11,7 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { CauseBToBeMarked ().BMethod (); CauseYToBeMarked ().YMethod (); CauseFToBeMarked ().FMethod (); - var c = CauseCToBeMarked(); + var c = CauseCToBeMarked (); } [Kept] @@ -17,31 +19,31 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { { return null; } - + [Kept] static Z CauseZToBeMarked () { return null; } - + [Kept] static B CauseBToBeMarked () { return null; } - + [Kept] static Y CauseYToBeMarked () { return null; } - + [Kept] static Nested.F CauseFToBeMarked () { return null; } - + [Kept] static C CauseCToBeMarked () { @@ -49,19 +51,22 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - interface A { + interface A + { [Kept] void AMethod (); } [Kept] - interface Z { + interface Z + { [Kept] void ZMethod (); } [Kept] - interface C { + interface C + { void CMethod (); } @@ -73,9 +78,10 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [KeptInterface (typeof (Nested.F))] [KeptInterface (typeof (Y))] [KeptInterface (typeof (Z))] - class MMarked : A, B, Y, Z, C, D, Nested.F, E { + class MMarked : A, B, Y, Z, C, D, Nested.F, E + { [Kept] - public void AMethod() + public void AMethod () { } @@ -113,31 +119,37 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - public static class Nested { + public static class Nested + { [Kept] - public interface F { + public interface F + { [Kept] void FMethod (); } } [Kept] - interface B { + interface B + { [Kept] void BMethod (); } [Kept] - interface Y { + interface Y + { [Kept] void YMethod (); } - interface D { + interface D + { void DMethod (); } - interface E { + interface E + { void EMethod (); } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyByCopiedAssembly.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyByCopiedAssembly.cs index ba22206b3..885654646 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyByCopiedAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyByCopiedAssembly.cs @@ -2,17 +2,19 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - [SetupCompileBefore ("linked.dll", new [] {typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link)})] - [SetupCompileBefore ("copy.dll", new [] {typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy)}, new [] {"linked.dll"})] +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + [SetupCompileBefore ("linked.dll", new[] { typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link) })] + [SetupCompileBefore ("copy.dll", new[] { typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy) }, new[] { "linked.dll" })] [SetupLinkerAction ("copy", "copy")] [SetupLinkerArgument ("-a", "copy")] - + [KeptTypeInAssembly ("linked.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link.IFoo))] [KeptMemberInAssembly ("copy.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy.A), "Method()")] [KeptInterfaceOnTypeInAssembly ("copy.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy.A), "linked.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link.IFoo))] - public class InterfaceTypeInOtherUsedOnlyByCopiedAssembly { + public class InterfaceTypeInOtherUsedOnlyByCopiedAssembly + { public static void Main () { InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy.ToKeepReferenceAtCompileTime (); diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit.cs index df3936a70..ee74998a0 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit.cs @@ -2,9 +2,10 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - [SetupCompileBefore ("linked.dll", new [] {typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link)})] - [SetupCompileBefore ("copy.dll", new [] {typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy)}, new [] {"linked.dll"})] +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + [SetupCompileBefore ("linked.dll", new[] { typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link) })] + [SetupCompileBefore ("copy.dll", new[] { typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy) }, new[] { "linked.dll" })] [SetupLinkerAction ("copy", "copy")] [SetupLinkerArgument ("-a", "copy")] @@ -12,7 +13,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [KeptMemberInAssembly ("linked.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link.IFoo), "Method()")] [KeptMemberInAssembly ("copy.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy.A), "Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies.InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link.IFoo.Method()")] [KeptInterfaceOnTypeInAssembly ("copy.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy.A), "linked.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link.IFoo))] - public class InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit { + public class InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit + { public static void Main () { InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy.ToKeepReferenceAtCompileTime (); diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyBySavedAssembly.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyBySavedAssembly.cs index 549ab7ecd..258a38b26 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyBySavedAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyBySavedAssembly.cs @@ -2,17 +2,19 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - [SetupCompileBefore ("linked.dll", new [] {typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link)})] - [SetupCompileBefore ("save.dll", new [] {typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy)}, new [] {"linked.dll"})] +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + [SetupCompileBefore ("linked.dll", new[] { typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link) })] + [SetupCompileBefore ("save.dll", new[] { typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy) }, new[] { "linked.dll" })] [SetupLinkerAction ("save", "save")] [SetupLinkerArgument ("-a", "save")] - + [KeptTypeInAssembly ("linked.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link.IFoo))] [KeptMemberInAssembly ("save.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy.A), "Method()")] [KeptInterfaceOnTypeInAssembly ("save.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy.A), "linked.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Link.IFoo))] - public class InterfaceTypeInOtherUsedOnlyBySavedAssembly { + public class InterfaceTypeInOtherUsedOnlyBySavedAssembly + { public static void Main () { InterfaceTypeInOtherUsedOnlyByCopiedAssembly_Copy.ToKeepReferenceAtCompileTime (); diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyBySavedAssemblyExplicit.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyBySavedAssemblyExplicit.cs index fba04116d..49808a86f 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyBySavedAssemblyExplicit.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyBySavedAssemblyExplicit.cs @@ -2,9 +2,10 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - [SetupCompileBefore ("linked.dll", new [] {typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link)})] - [SetupCompileBefore ("save.dll", new [] {typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy)}, new [] {"linked.dll"})] +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + [SetupCompileBefore ("linked.dll", new[] { typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link) })] + [SetupCompileBefore ("save.dll", new[] { typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy) }, new[] { "linked.dll" })] [SetupLinkerAction ("save", "save")] [SetupLinkerArgument ("-a", "save")] @@ -12,7 +13,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [KeptMemberInAssembly ("linked.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link.IFoo), "Method()")] [KeptMemberInAssembly ("save.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy.A), "Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies.InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link.IFoo.Method()")] [KeptInterfaceOnTypeInAssembly ("save.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy.A), "linked.dll", typeof (InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Link.IFoo))] - public class InterfaceTypeInOtherUsedOnlyBySavedAssemblyExplicit { + public class InterfaceTypeInOtherUsedOnlyBySavedAssemblyExplicit + { public static void Main () { InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy.ToKeepReferenceAtCompileTime (); diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeOnlyUsedHasInterfacesRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeOnlyUsedHasInterfacesRemoved.cs index 2a444ac3d..246c1986e 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeOnlyUsedHasInterfacesRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeOnlyUsedHasInterfacesRemoved.cs @@ -1,20 +1,25 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class InterfaceTypeOnlyUsedHasInterfacesRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class InterfaceTypeOnlyUsedHasInterfacesRemoved + { public static void Main () { var tmp = typeof (IUsed).ToString (); } - interface IRemovable1 { + interface IRemovable1 + { } - interface IRemovable2 { + interface IRemovable2 + { } [Kept] - interface IUsed : IRemovable1, IRemovable2 { + interface IUsed : IRemovable1, IRemovable2 + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceUsedOnlyAsConstraintIsKept.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceUsedOnlyAsConstraintIsKept.cs index b5fe34bd5..f8a84d687 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceUsedOnlyAsConstraintIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceUsedOnlyAsConstraintIsKept.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class InterfaceUsedOnlyAsConstraintIsKept { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class InterfaceUsedOnlyAsConstraintIsKept + { public static void Main () { var a = new A (); @@ -14,14 +16,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - interface IFoo { + interface IFoo + { void Foo (); } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class A : IFoo { + class A : IFoo + { public void Foo () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed.cs index 5a7ff36f2..6b30418d9 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed.cs @@ -2,9 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.Interfaces.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - [SetupCompileBefore("library.dll", new []{"../Dependencies/InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed_Lib.cs"})] - public class InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + [SetupCompileBefore ("library.dll", new[] { "../Dependencies/InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed_Lib.cs" })] + public class InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed + { public static void Main () { Helper (null); @@ -17,7 +19,7 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - [KeptInterface (typeof(InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed_Lib.IFoo))] + [KeptInterface (typeof (InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed_Lib.IFoo))] interface IBar : InterfaceWithInterfaceFromOtherAssemblyWhenExplicitMethodUsed_Lib.IFoo { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndAssemblyPreserveAll.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndAssemblyPreserveAll.cs index 2b4dfd2e8..7cd596e42 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndAssemblyPreserveAll.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndAssemblyPreserveAll.cs @@ -3,7 +3,7 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor { - [SetupCompileBefore ("library.dll", new [] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] [KeptInterfaceOnTypeInAssemblyAttribute ("library", "Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.Dependencies.NoInstanceCtorAndAssemblyPreserveAll_Lib/A", "library", diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveAll.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveAll.cs index 32bbe139f..28bf841f6 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveAll.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveAll.cs @@ -1,8 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor { - [SetupCompileBefore ("library.dll", new [] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor +{ + [SetupCompileBefore ("library.dll", new[] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] [KeptInterfaceOnTypeInAssembly ("library", "Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.Dependencies.NoInstanceCtorAndAssemblyPreserveAll_Lib/A", "library", @@ -17,7 +18,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInsta [KeptMemberInAssembly ("library", "Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.Dependencies.NoInstanceCtorAndAssemblyPreserveAll_Lib/A", "Bar()")] - public class NoInstanceCtorAndTypePreserveAll { + public class NoInstanceCtorAndTypePreserveAll + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFields.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFields.cs index 22b2bed90..69f9973d5 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFields.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFields.cs @@ -1,8 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor { - [SetupCompileBefore ("library.dll", new [] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor +{ + [SetupCompileBefore ("library.dll", new[] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] // The interfaces should be removed because the interface types are not marked [RemovedInterfaceOnTypeInAssembly ("library", @@ -20,14 +21,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInsta [RemovedMemberInAssembly ("library", "Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.Dependencies.NoInstanceCtorAndAssemblyPreserveAll_Lib/A", "Bar()")] - + // pedump reports this is valid with the following error. // // Assertion at metadata.c:1073, condition `index < meta->heap_blob.size' not met // // Not worried about it since this is already a niche edge case. Let's just skip verify for pedump [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - public class NoInstanceCtorAndTypePreserveFields { + public class NoInstanceCtorAndTypePreserveFields + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFieldsWithInterfacesMarked.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFieldsWithInterfacesMarked.cs index 6bcaaa651..9a03244f2 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFieldsWithInterfacesMarked.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFieldsWithInterfacesMarked.cs @@ -1,9 +1,10 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor { - [Define("IL_ASSEMBLY_COMPILED")] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor +{ + [Define ("IL_ASSEMBLY_COMPILED")] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] // Interfaces should be removed because preserve fields would not normally cause an instance ctor to be marked. This means that no instance ctor // sweeping logic should kick in and remove interfaces @@ -23,14 +24,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInsta [RemovedMemberInAssembly ("library", "Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.Dependencies.NoInstanceCtorAndAssemblyPreserveAll_Lib/A", "Bar()")] - + // pedump reports this is valid with the following error. // // Assertion at metadata.c:1073, condition `index < meta->heap_blob.size' not met // // Not worried about it since this is already a niche edge case. Let's just skip verify for pedump [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - public class NoInstanceCtorAndTypePreserveFieldsWithInterfacesMarked { + public class NoInstanceCtorAndTypePreserveFieldsWithInterfacesMarked + { public static void Main () { #if IL_ASSEMBLY_COMPILED diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethods.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethods.cs index 045aa2dcb..072a716c3 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethods.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethods.cs @@ -1,8 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor { - [SetupCompileBefore ("library.dll", new [] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor +{ + [SetupCompileBefore ("library.dll", new[] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] // The interfaces should be removed because the interface types are not marked [RemovedInterfaceOnTypeInAssembly ("library", @@ -21,7 +22,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInsta [KeptMemberInAssembly ("library", "Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.Dependencies.NoInstanceCtorAndAssemblyPreserveAll_Lib/A", "Bar()")] - public class NoInstanceCtorAndTypePreserveMethods { + public class NoInstanceCtorAndTypePreserveMethods + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethodsWithInterfacesMarked.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethodsWithInterfacesMarked.cs index 419eae41c..9b9f471c0 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethodsWithInterfacesMarked.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethodsWithInterfacesMarked.cs @@ -1,9 +1,10 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor { - [Define("IL_ASSEMBLY_COMPILED")] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor +{ + [Define ("IL_ASSEMBLY_COMPILED")] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] // Interfaces will be removed because there is no instance ctor that is marked. [RemovedInterfaceOnTypeInAssembly ("library", @@ -24,7 +25,7 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInsta "Bar()")] public class NoInstanceCtorAndTypePreserveMethodsWithInterfacesMarked { - public static void Main() + public static void Main () { // We'll mark one interface in code and one via xml, the end result should be the same #if IL_ASSEMBLY_COMPILED diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveNone.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveNone.cs index 670d45e43..ec968ced9 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveNone.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveNone.cs @@ -1,8 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor { - [SetupCompileBefore ("library.dll", new [] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor +{ + [SetupCompileBefore ("library.dll", new[] { "Dependencies/NoInstanceCtorAndAssemblyPreserveAll_Lib.il" })] [RemovedInterfaceOnTypeInAssembly ("library", "Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.Dependencies.NoInstanceCtorAndAssemblyPreserveAll_Lib/A", "library", @@ -17,7 +18,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInsta // // Not worried about it since this is already a niche edge case. Let's just skip verify for pedump [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - public class NoInstanceCtorAndTypePreserveNone { + public class NoInstanceCtorAndTypePreserveNone + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/ComInterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/ComInterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod.cs index 62da67caf..eee5d3f92 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/ComInterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/ComInterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod.cs @@ -1,8 +1,10 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class ComInterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class ComInterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod + { public static void Main () { StaticMethodOnlyUsed.StaticMethod (); @@ -10,12 +12,14 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - interface IUnusedInterface { + interface IUnusedInterface + { void Foo (); } [Kept] - class StaticMethodOnlyUsed : IUnusedInterface { + class StaticMethodOnlyUsed : IUnusedInterface + { public void Foo () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/ExplicitInterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/ExplicitInterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed.cs index f3bb78c8f..8908c6440 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/ExplicitInterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/ExplicitInterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class ExplicitInterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class ExplicitInterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed + { public static void Main () { IUsedInterface p = new UsedClass (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IUsedInterface { + interface IUsedInterface + { [Kept] void Foo (); } @@ -18,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IUsedInterface))] - class UsedClass : IUsedInterface { + class UsedClass : IUsedInterface + { [Kept] public void Foo () { @@ -26,7 +30,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - class StaticMethodOnlyUsed : IUsedInterface { + class StaticMethodOnlyUsed : IUsedInterface + { void IUsedInterface.Foo () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/GenericType.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/GenericType.cs index b6dff2fde..0abb060b7 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/GenericType.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/GenericType.cs @@ -1,22 +1,27 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class GenericType { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class GenericType + { public static void Main () { object o = new Bar<Foo> (); } [Kept] - [KeptMember(".ctor()")] - class Bar<T> { + [KeptMember (".ctor()")] + class Bar<T> + { } [Kept] - class Foo : IFoo { + class Foo : IFoo + { } - interface IFoo { + interface IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/GenericWithConstraintDoesNotCauseOtherTypesToKeepInterface.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/GenericWithConstraintDoesNotCauseOtherTypesToKeepInterface.cs index 7255cac2c..0b004bf43 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/GenericWithConstraintDoesNotCauseOtherTypesToKeepInterface.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/GenericWithConstraintDoesNotCauseOtherTypesToKeepInterface.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class GenericWithConstraintDoesNotCauseOtherTypesToKeepInterface { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class GenericWithConstraintDoesNotCauseOtherTypesToKeepInterface + { public static void Main () { Foo f = null; @@ -27,15 +29,18 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { } - + [Kept] - class Foo2 : IFoo { + class Foo2 : IFoo + { } [Kept] - interface IFoo { + interface IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed.cs index bddacb9d5..2c76dca61 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed + { public static void Main () { IUsedInterface p = new UsedClass (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IUsedInterface { + interface IUsedInterface + { [Kept] void Foo (); } @@ -18,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IUsedInterface))] - class UsedClass : IUsedInterface { + class UsedClass : IUsedInterface + { [Kept] public void Foo () { @@ -26,7 +30,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - class StaticMethodOnlyUsed : IUsedInterface { + class StaticMethodOnlyUsed : IUsedInterface + { public void Foo () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsedWithCctor.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsedWithCctor.cs index 9d79e5e0b..bf310873b 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsedWithCctor.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsedWithCctor.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsedWithCctor { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsedWithCctor + { public static void Main () { IUsedInterface p = new UsedClass (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IUsedInterface { + interface IUsedInterface + { [Kept] void Foo (); } @@ -18,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IUsedInterface))] - class UsedClass : IUsedInterface { + class UsedClass : IUsedInterface + { [Kept] public void Foo () { @@ -26,7 +30,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - class StaticMethodOnlyUsed : IUsedInterface { + class StaticMethodOnlyUsed : IUsedInterface + { [Kept] static StaticMethodOnlyUsed () { @@ -37,7 +42,7 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC static void UsedByStaticCctor () { } - + public void Foo () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceFromCopiedAssemblyCanBeRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceFromCopiedAssemblyCanBeRemoved.cs index b8001883e..77391f5e4 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceFromCopiedAssemblyCanBeRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceFromCopiedAssemblyCanBeRemoved.cs @@ -1,15 +1,18 @@ using System.Collections; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class InterfaceFromCopiedAssemblyCanBeRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class InterfaceFromCopiedAssemblyCanBeRemoved + { public static void Main () { Foo.StaticMethod (); } [Kept] - class Foo : IComparer { + class Foo : IComparer + { public int Compare (object x, object y) { throw new System.NotImplementedException (); diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod.cs index 828376342..6e4d3e4a3 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod.cs @@ -1,18 +1,22 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod + { public static void Main () { StaticMethodOnlyUsed.StaticMethod (); } - interface IUnusedInterface { + interface IUnusedInterface + { void Foo (); } [Kept] - class StaticMethodOnlyUsed : IUnusedInterface { + class StaticMethodOnlyUsed : IUnusedInterface + { public void Foo () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethodMultiple.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethodMultiple.cs index fea5b9954..5c833d82b 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethodMultiple.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethodMultiple.cs @@ -1,13 +1,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethodMultiple { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethodMultiple + { public static void Main () { IUsedInterface p = new UsedClass (); StaticMethodOnlyUsed.StaticMethod (); p.Foo (); - + // We are testing removing interfaces when no instance is created, we need to mark the interface types // so that we don't end up testing unused interface types being swept var tmp = typeof (IRemovable1).ToString (); @@ -15,23 +17,27 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IUsedInterface { + interface IUsedInterface + { [Kept] void Foo (); } [Kept] - interface IRemovable1 { + interface IRemovable1 + { } - + [Kept] - interface IRemovable2 { + interface IRemovable2 + { } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IUsedInterface))] - class UsedClass : IUsedInterface { + class UsedClass : IUsedInterface + { [Kept] public void Foo () { @@ -39,7 +45,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - class StaticMethodOnlyUsed : IUsedInterface, IRemovable1, IRemovable2 { + class StaticMethodOnlyUsed : IUsedInterface, IRemovable1, IRemovable2 + { public void Foo () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/LocalDowncastDoesNotCuaseOtherTypesToKeepInterface.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/LocalDowncastDoesNotCuaseOtherTypesToKeepInterface.cs index 00ad89fd2..89409937e 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/LocalDowncastDoesNotCuaseOtherTypesToKeepInterface.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/LocalDowncastDoesNotCuaseOtherTypesToKeepInterface.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class LocalDowncastDoesNotCuaseOtherTypesToKeepInterface { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class LocalDowncastDoesNotCuaseOtherTypesToKeepInterface + { public static void Main () { Foo f = null; @@ -23,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { [Kept] // TODO : It should be safe to stub this. It can't actually be called because no instance of Foo ever exists public void Method () { @@ -31,7 +34,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Method (); } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/ObjectHardCastedToInterface.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/ObjectHardCastedToInterface.cs index 84b9b6c16..fd4870faa 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/ObjectHardCastedToInterface.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/ObjectHardCastedToInterface.cs @@ -1,13 +1,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class ObjectHardCastedToInterface { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class ObjectHardCastedToInterface + { public static void Main () { object o = GetAnObject (); - IFoo i = (IFoo)o; + IFoo i = (IFoo) o; UseAnIFoo (i); - + // Here to mark Foo so that we can verify the interface is removed Foo.Helper (); } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/PreserveDependencyPreservesInterfaceMethod.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/PreserveDependencyPreservesInterfaceMethod.cs index f20e50010..db4a57a84 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/PreserveDependencyPreservesInterfaceMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/PreserveDependencyPreservesInterfaceMethod.cs @@ -2,23 +2,27 @@ using System.Runtime.CompilerServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ /// <summary> /// The interface can still be removed in this case because PreserveDependency is just preserving Foo() on the current type /// </summary> - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "../../../PreserveDependencies/Dependencies/PreserveDependencyAttribute.cs" })] - public class PreserveDependencyPreservesInterfaceMethod { + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "../../../PreserveDependencies/Dependencies/PreserveDependencyAttribute.cs" })] + public class PreserveDependencyPreservesInterfaceMethod + { public static void Main () { StaticMethodOnlyUsed.StaticMethod (); } - interface IUnusedInterface { + interface IUnusedInterface + { void Foo (); } [Kept] - class StaticMethodOnlyUsed : IUnusedInterface { + class StaticMethodOnlyUsed : IUnusedInterface + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasExplicitInterfaceMethodPreservedViaXml.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasExplicitInterfaceMethodPreservedViaXml.cs index fef505898..2fa2dbb5d 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasExplicitInterfaceMethodPreservedViaXml.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasExplicitInterfaceMethodPreservedViaXml.cs @@ -1,25 +1,30 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class UnusedTypeHasExplicitInterfaceMethodPreservedViaXml { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class UnusedTypeHasExplicitInterfaceMethodPreservedViaXml + { public static void Main () { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } - interface IBar { + interface IBar + { void Bar (); } [Kept] [KeptInterface (typeof (IFoo))] - class A : IBar, IFoo { - + class A : IBar, IFoo + { + // Because an explicit interface method was preserved via xml, we need to now mark the interface implementation [Kept] void IFoo.Foo () diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasExplicitInterfacePropertyPreservedViaXml.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasExplicitInterfacePropertyPreservedViaXml.cs index 500841363..55ae78580 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasExplicitInterfacePropertyPreservedViaXml.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasExplicitInterfacePropertyPreservedViaXml.cs @@ -1,26 +1,31 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class UnusedTypeHasExplicitInterfacePropertyPreservedViaXml { + public class UnusedTypeHasExplicitInterfacePropertyPreservedViaXml + { public static void Main () { } [Kept] - interface IFoo { + interface IFoo + { [Kept] int Foo { [Kept] get; [Kept] set; } } - interface IBar { + interface IBar + { int Bar { get; set; } } [Kept] [KeptInterface (typeof (IFoo))] - class A : IBar, IFoo { + class A : IBar, IFoo + { [Kept] int IFoo.Foo { [Kept] [ExpectBodyModified] get; [Kept] [ExpectBodyModified] set; } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasInterfaceMethodPreservedViaXml.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasInterfaceMethodPreservedViaXml.cs index eef586956..6f609f27d 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasInterfaceMethodPreservedViaXml.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeHasInterfaceMethodPreservedViaXml.cs @@ -1,21 +1,26 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class UnusedTypeHasInterfaceMethodPreservedViaXml { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class UnusedTypeHasInterfaceMethodPreservedViaXml + { public static void Main () { } - interface IFoo { + interface IFoo + { void Foo (); } - interface IBar { + interface IBar + { void Bar (); } [Kept] - class A : IBar, IFoo { + class A : IBar, IFoo + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeWithPreserveFields.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeWithPreserveFields.cs index 7c7b3b49a..759e39f97 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeWithPreserveFields.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeWithPreserveFields.cs @@ -1,21 +1,26 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class UnusedTypeWithPreserveFields { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class UnusedTypeWithPreserveFields + { public static void Main () { } - interface IFoo { + interface IFoo + { void Foo (); } - interface IBar { + interface IBar + { void Bar (); } [Kept] - class A : IBar, IFoo { + class A : IBar, IFoo + { public void Foo () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeWithPreserveMethods.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeWithPreserveMethods.cs index d729f60df..caeaac31b 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeWithPreserveMethods.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeWithPreserveMethods.cs @@ -1,22 +1,27 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class UnusedTypeWithPreserveMethods { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class UnusedTypeWithPreserveMethods + { public static void Main () { } - interface IFoo { + interface IFoo + { void Foo (); } - interface IBar { + interface IBar + { void Bar (); } [Kept] [KeptMember (".ctor()")] - class A : IBar, IFoo { + class A : IBar, IFoo + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeWithPreserveMethodsAndInterfaceTypeMarked.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeWithPreserveMethodsAndInterfaceTypeMarked.cs index 183bac795..b4efe2e79 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeWithPreserveMethodsAndInterfaceTypeMarked.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtor/UnusedTypeWithPreserveMethodsAndInterfaceTypeMarked.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor { - public class UnusedTypeWithPreserveMethodsAndInterfaceTypeMarked { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor +{ + public class UnusedTypeWithPreserveMethodsAndInterfaceTypeMarked + { public static void Main () { // We'll mark one interface in code and one via xml, the end result should be the same @@ -9,12 +11,14 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IFoo { + interface IFoo + { void Foo (); } [Kept] - interface IBar { + interface IBar + { void Bar (); } @@ -22,7 +26,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] [KeptInterface (typeof (IBar))] - class A : IBar, IFoo { + class A : IBar, IFoo + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ArrayWithIndexAssignedToReturnValue.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ArrayWithIndexAssignedToReturnValue.cs index 179b7577b..1c5409a02 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ArrayWithIndexAssignedToReturnValue.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ArrayWithIndexAssignedToReturnValue.cs @@ -1,11 +1,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class ArrayWithIndexAssignedToReturnValue { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class ArrayWithIndexAssignedToReturnValue + { public static void Main () { - IFoo [] arr = new IFoo [5]; - arr [0] = GetAFoo (); + IFoo[] arr = new IFoo[5]; + arr[0] = GetAFoo (); } [Kept] @@ -16,11 +18,13 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { } [Kept] - interface IFoo { + interface IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/FieldDowncastedToInterface.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/FieldDowncastedToInterface.cs index 84ff1a1c7..98fc4db72 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/FieldDowncastedToInterface.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/FieldDowncastedToInterface.cs @@ -1,12 +1,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class FieldDowncastedToInterface { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class FieldDowncastedToInterface + { [Kept] private static Foo f; [Kept] private static IFoo i; - + public static void Main () { f = null; @@ -16,7 +18,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { [Kept] // TODO : It should be safe to stub this. It can't actually be called because no instance of Foo ever exists public void Method () { @@ -24,7 +27,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Method (); } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericType.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericType.cs index 7e8e8ffa9..9f895a88a 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericType.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericType.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class GenericType { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class GenericType + { public static void Main () { Foo f = null; @@ -10,8 +12,9 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - [KeptMember(".ctor()")] - class Bar<T> { + [KeptMember (".ctor()")] + class Bar<T> + { [Kept] public void Method (T arg) { @@ -20,11 +23,13 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { } [Kept] - interface IFoo { + interface IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericTypeWithConstraint.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericTypeWithConstraint.cs index 48051732a..b4a4987e7 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericTypeWithConstraint.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericTypeWithConstraint.cs @@ -1,24 +1,29 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class GenericTypeWithConstraint { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class GenericTypeWithConstraint + { public static void Main () { object o = new Bar<Foo> (); } [Kept] - [KeptMember(".ctor()")] - class Bar<T> where T : IFoo { + [KeptMember (".ctor()")] + class Bar<T> where T : IFoo + { } [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { } [Kept] - interface IFoo { + interface IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericTypeWithConstraint2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericTypeWithConstraint2.cs index 0fb889ae8..2d74534ba 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericTypeWithConstraint2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericTypeWithConstraint2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class GenericTypeWithConstraint2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class GenericTypeWithConstraint2 + { public static void Main () { Foo f = null; @@ -9,7 +11,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - static class Bar<T> where T : IFoo { + static class Bar<T> where T : IFoo + { [Kept] public static void Helper (T arg) { @@ -18,11 +21,13 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { } [Kept] - interface IFoo { + interface IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericTypeWithConstraint3.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericTypeWithConstraint3.cs index bc170287e..90545fa1c 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericTypeWithConstraint3.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/GenericTypeWithConstraint3.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class GenericTypeWithConstraint3 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class GenericTypeWithConstraint3 + { public static void Main () { Foo f = null; @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - static class Bar<T, K> where T : IFoo where K : IBar { + static class Bar<T, K> where T : IFoo where K : IBar + { [Kept] public static void Helper (T arg, K arg2) { @@ -19,40 +22,48 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - abstract class BaseFoo : IFoo { + abstract class BaseFoo : IFoo + { } [Kept] [KeptBaseType (typeof (BaseFoo))] - abstract class BaseFoo2 : BaseFoo { + abstract class BaseFoo2 : BaseFoo + { } [Kept] [KeptInterface (typeof (IBar))] - abstract class BaseBar : IBar { + abstract class BaseBar : IBar + { } [Kept] [KeptBaseType (typeof (BaseBar))] - abstract class BaseBar2 : BaseBar { + abstract class BaseBar2 : BaseBar + { } [Kept] [KeptBaseType (typeof (BaseFoo2))] - class Foo : BaseFoo2 { + class Foo : BaseFoo2 + { } - + [Kept] [KeptBaseType (typeof (BaseBar2))] - class Bar : BaseBar2 { + class Bar : BaseBar2 + { } [Kept] - interface IFoo { + interface IFoo + { } [Kept] - interface IBar { + interface IBar + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/InterfaceOnMultipleBases.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/InterfaceOnMultipleBases.cs index 6b303e24f..3a997c981 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/InterfaceOnMultipleBases.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/InterfaceOnMultipleBases.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class InterfaceOnMultipleBases { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class InterfaceOnMultipleBases + { public static void Main () { Foo f = null; @@ -15,28 +17,33 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - class Base : IFoo { + class Base : IFoo + { } - + [Kept] [KeptBaseType (typeof (Base))] [KeptInterface (typeof (IFoo))] - class Base2 : Base, IFoo { + class Base2 : Base, IFoo + { } - + [Kept] [KeptBaseType (typeof (Base2))] - class Base3 : Base2 { + class Base3 : Base2 + { } - + [Kept] [KeptBaseType (typeof (Base3))] [KeptInterface (typeof (IFoo))] - class Foo : Base3, IFoo { + class Foo : Base3, IFoo + { } [Kept] - interface IFoo { + interface IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalAndNestedInterfaces.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalAndNestedInterfaces.cs index da7af0a82..333f8334d 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalAndNestedInterfaces.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalAndNestedInterfaces.cs @@ -1,13 +1,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class LocalAndNestedInterfaces { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class LocalAndNestedInterfaces + { public static void Main () { Foo f = null; IFoo i = f; IBase2 b = i; - + Helper (b); } @@ -19,19 +21,23 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] [KeptInterface (typeof (IBase2))] - class Foo : IFoo { + class Foo : IFoo + { } - interface IBase { + interface IBase + { } [Kept] - interface IBase2 : IBase { + interface IBase2 : IBase + { } [Kept] [KeptInterface (typeof (IBase2))] - interface IFoo : IBase2 { + interface IFoo : IBase2 + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalArrayPassedAsParameter.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalArrayPassedAsParameter.cs index 0a9aacc0c..c8e07b705 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalArrayPassedAsParameter.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalArrayPassedAsParameter.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class LocalArrayPassedAsParameter { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class LocalArrayPassedAsParameter + { public static void Main () { - Foo [] arr = null; + Foo[] arr = null; Helper (arr); } @@ -15,11 +17,13 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { } [Kept] - interface IFoo { + interface IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalDowncastedToInterface.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalDowncastedToInterface.cs index dc63d99a3..d17dede47 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalDowncastedToInterface.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalDowncastedToInterface.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class LocalDowncastedToInterface { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class LocalDowncastedToInterface + { public static void Main () { Foo f = null; @@ -11,7 +13,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { [Kept] // TODO : It should be safe to stub this. It can't actually be called because no instance of Foo ever exists public void Method () { @@ -19,7 +22,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Method (); } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameter.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameter.cs index 5338cc6ba..4efcfd249 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameter.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameter.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class LocalPassedAsParameter { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class LocalPassedAsParameter + { public static void Main () { Foo f = null; @@ -15,11 +17,13 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { } [Kept] - interface IFoo { + interface IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameterToGeneric.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameterToGeneric.cs index 475ac098a..757cde132 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameterToGeneric.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameterToGeneric.cs @@ -1,25 +1,29 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class LocalPassedAsParameterToGeneric { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class LocalPassedAsParameterToGeneric + { public static void Main () { Foo f = null; - Helper<IFoo>(f); + Helper<IFoo> (f); } [Kept] - static void Helper <T> (T f) + static void Helper<T> (T f) { } [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { } [Kept] - interface IFoo { + interface IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameterToGenericWithConstraint.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameterToGenericWithConstraint.cs index e00229264..46e7c416c 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameterToGenericWithConstraint.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameterToGenericWithConstraint.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class LocalPassedAsParameterToGenericWithConstraint { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class LocalPassedAsParameterToGenericWithConstraint + { public static void Main () { Foo f = null; @@ -15,11 +17,13 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { } [Kept] - interface IFoo { + interface IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameterToGenericWithConstraint2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameterToGenericWithConstraint2.cs index cecf742e4..46b2ae8c8 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameterToGenericWithConstraint2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/LocalPassedAsParameterToGenericWithConstraint2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class LocalPassedAsParameterToGenericWithConstraint2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class LocalPassedAsParameterToGenericWithConstraint2 + { public static void Main () { Foo f = null; @@ -16,17 +18,20 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { } - + [Kept] [KeptInterface (typeof (IFoo))] // technically this can be removed, but it would require more complex knowledge of the stack to do so - class Foo2 : IFoo { + class Foo2 : IFoo + { } [Kept] - interface IFoo { + interface IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfaces1.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfaces1.cs index b42a1ea16..434a4174b 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfaces1.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfaces1.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class NestedInterfaces1 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class NestedInterfaces1 + { public static void Main () { MarkBase1AndBase3 (null, null); @@ -20,12 +22,14 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IBase { + interface IBase + { } [Kept] [KeptInterface (typeof (IBase))] - interface IBase2 : IBase { + interface IBase2 : IBase + { [Kept] void Method (); } @@ -33,7 +37,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IBase2))] [KeptInterface (typeof (IBase))] - interface IBase3 : IBase2 { + interface IBase3 : IBase2 + { } /// <summary> @@ -42,7 +47,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IBase3))] [KeptInterface (typeof (IBase))] - class Foo : IBase3 { + class Foo : IBase3 + { [Kept] public void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfaces2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfaces2.cs index 0bd591b3d..93f50acca 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfaces2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfaces2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class NestedInterfaces2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class NestedInterfaces2 + { public static void Main () { MarkBase1AndBase3 (null, null); @@ -19,22 +21,26 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IBase { + interface IBase + { } - interface IBase2 : IBase { + interface IBase2 : IBase + { void Method (); } [Kept] [KeptInterface (typeof (IBase))] - interface IBase3 : IBase2 { + interface IBase3 : IBase2 + { } [Kept] [KeptInterface (typeof (IBase3))] [KeptInterface (typeof (IBase))] - class Foo : IBase3 { + class Foo : IBase3 + { public void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfaces3.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfaces3.cs index 2669daf37..5bc09dc62 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfaces3.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfaces3.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class NestedInterfaces3 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class NestedInterfaces3 + { public static void Main () { MarkBase1AndBase3 (null, null); @@ -19,31 +21,36 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IBase { + interface IBase + { } - interface IBase2 : IBase { + interface IBase2 : IBase + { void Method (); } [Kept] [KeptInterface (typeof (IBase))] - interface IBase3 : IBase2 { + interface IBase3 : IBase2 + { } [Kept] [KeptInterface (typeof (IBase))] - class Base : IBase2 { + class Base : IBase2 + { public void Method () { } } [Kept] - [KeptBaseType(typeof(Base))] + [KeptBaseType (typeof (Base))] [KeptInterface (typeof (IBase3))] [KeptInterface (typeof (IBase))] - class Foo : Base, IBase3, IBase2 { + class Foo : Base, IBase3, IBase2 + { public void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfacesWithExplicit1.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfacesWithExplicit1.cs index 18e717198..0ea1e369b 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfacesWithExplicit1.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfacesWithExplicit1.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class NestedInterfacesWithExplicit1 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class NestedInterfacesWithExplicit1 + { public static void Main () { MarkBase1AndBase3 (null, null); @@ -20,12 +22,14 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IBase { + interface IBase + { } [Kept] [KeptInterface (typeof (IBase))] - interface IBase2 : IBase { + interface IBase2 : IBase + { [Kept] void Method (); } @@ -33,14 +37,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IBase2))] [KeptInterface (typeof (IBase))] - interface IBase3 : IBase2 { + interface IBase3 : IBase2 + { } [Kept] [KeptInterface (typeof (IBase3))] [KeptInterface (typeof (IBase2))] [KeptInterface (typeof (IBase))] - class Foo : IBase3 { + class Foo : IBase3 + { [Kept] void IBase2.Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfacesWithExplicitAndNormal1.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfacesWithExplicitAndNormal1.cs index 6f5373463..a676cb64b 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfacesWithExplicitAndNormal1.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/NestedInterfacesWithExplicitAndNormal1.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class NestedInterfacesWithExplicitAndNormal1 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class NestedInterfacesWithExplicitAndNormal1 + { public static void Main () { MarkBase1AndBase3 (null, null); @@ -20,12 +22,14 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IBase { + interface IBase + { } [Kept] [KeptInterface (typeof (IBase))] - interface IBase2 : IBase { + interface IBase2 : IBase + { [Kept] void Method (); } @@ -33,14 +37,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IBase2))] [KeptInterface (typeof (IBase))] - interface IBase3 : IBase2 { + interface IBase3 : IBase2 + { } [Kept] [KeptInterface (typeof (IBase3))] [KeptInterface (typeof (IBase2))] [KeptInterface (typeof (IBase))] - class Foo : IBase3 { + class Foo : IBase3 + { [Kept] void IBase2.Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ParameterAndLocal.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ParameterAndLocal.cs index 3d31fe038..431653cac 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ParameterAndLocal.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ParameterAndLocal.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class ParameterAndLocal { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class ParameterAndLocal + { public static void Main () { Helper (null); @@ -15,14 +17,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Method (); } [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { [Kept] public void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ParameterOutAndLocal.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ParameterOutAndLocal.cs index 5703d03e2..65d483770 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ParameterOutAndLocal.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ParameterOutAndLocal.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class ParameterOutAndLocal { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class ParameterOutAndLocal + { public static void Main () { Foo f; @@ -17,14 +19,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Method (); } [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { [Kept] public void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ParameterRefAndLocal.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ParameterRefAndLocal.cs index a292c7b33..1bf66c1dd 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ParameterRefAndLocal.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ParameterRefAndLocal.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class ParameterRefAndLocal { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class ParameterRefAndLocal + { public static void Main () { Foo f = null; @@ -16,14 +18,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Method (); } [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { [Kept] public void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ReturnValueDowncastedToInterface.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ReturnValueDowncastedToInterface.cs index 0aef967a5..3fb6ed2db 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ReturnValueDowncastedToInterface.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoKeptCtorButInterfaceNeeded/ReturnValueDowncastedToInterface.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded { - public class ReturnValueDowncastedToInterface { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded +{ + public class ReturnValueDowncastedToInterface + { public static void Main () { UseAnIFoo (GetAFoo ()); @@ -20,11 +22,13 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptC [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { } [Kept] - interface IFoo { + interface IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ObjectCastedToSecondInterfaceHasMemberRemovedButInterfaceKept.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ObjectCastedToSecondInterfaceHasMemberRemovedButInterfaceKept.cs index 95fd8b266..a3222443e 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ObjectCastedToSecondInterfaceHasMemberRemovedButInterfaceKept.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/ObjectCastedToSecondInterfaceHasMemberRemovedButInterfaceKept.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class ObjectCastedToSecondInterfaceHasMemberRemovedButInterfaceKept { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class ObjectCastedToSecondInterfaceHasMemberRemovedButInterfaceKept + { public static void Main () { IFoo i = new A (); @@ -10,13 +12,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } - + [Kept] - interface IBar { + interface IBar + { void Bar (); } @@ -24,7 +28,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] [KeptInterface (typeof (IBar))] - class A : IBar, IFoo { + class A : IBar, IFoo + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/TypeGetsMarkedThatImplementsAlreadyMarkedInterfaceMethod.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/TypeGetsMarkedThatImplementsAlreadyMarkedInterfaceMethod.cs index 85f1c855a..944efb46d 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/TypeGetsMarkedThatImplementsAlreadyMarkedInterfaceMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/TypeGetsMarkedThatImplementsAlreadyMarkedInterfaceMethod.cs @@ -1,21 +1,25 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - class TypeGetsMarkedThatImplementsAlreadyMarkedInterfaceMethod { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + class TypeGetsMarkedThatImplementsAlreadyMarkedInterfaceMethod + { public static void Main () { IFoo i = new A (); i.Foo (); } - interface IFoo { + interface IFoo + { [Kept] void Foo (); } [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class B : IFoo { + class B : IFoo + { [Kept] public void Foo () { @@ -24,7 +28,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class A : IFoo { + class A : IFoo + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedComInterfaceIsKept.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedComInterfaceIsKept.cs index 4e7212bef..61ebdf89c 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedComInterfaceIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedComInterfaceIsKept.cs @@ -1,12 +1,14 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ /// <summary> /// It's much harder to know if a com interface will be needed since so much can be on the native side. /// As a precaution we will not apply the unused interface rules to com interfaces /// </summary> - public class UnusedComInterfaceIsKept { + public class UnusedComInterfaceIsKept + { public static void Main () { var i = new A (); @@ -17,14 +19,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [KeptAttributeAttribute (typeof (GuidAttribute))] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - interface IBar { + interface IBar + { void Bar (); } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IBar))] - class A : IBar { + class A : IBar + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedComInterfaceIsRemovedWhenComFeatureExcluded.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedComInterfaceIsRemovedWhenComFeatureExcluded.cs index 597da0c7b..3f0d5b8ca 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedComInterfaceIsRemovedWhenComFeatureExcluded.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedComInterfaceIsRemovedWhenComFeatureExcluded.cs @@ -2,12 +2,14 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif [SetupLinkerArgument ("--exclude-feature", "com")] - public class UnusedComInterfaceIsRemovedWhenComFeatureExcluded { + public class UnusedComInterfaceIsRemovedWhenComFeatureExcluded + { public static void Main () { var i = new A (); @@ -16,13 +18,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - interface IBar { + interface IBar + { void Bar (); } [Kept] [KeptMember (".ctor()")] - class A : IBar { + class A : IBar + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedExplicitInterfaceHasMethodPreservedViaXml.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedExplicitInterfaceHasMethodPreservedViaXml.cs index 1a97b7836..bc8e3226f 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedExplicitInterfaceHasMethodPreservedViaXml.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedExplicitInterfaceHasMethodPreservedViaXml.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class UnusedExplicitInterfaceHasMethodPreservedViaXml { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class UnusedExplicitInterfaceHasMethodPreservedViaXml + { public static void Main () { IFoo i = new A (); @@ -9,13 +11,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } [Kept] - interface IBar { + interface IBar + { [Kept] void Bar (); } @@ -24,7 +28,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] [KeptInterface (typeof (IBar))] - class A : IBar, IFoo { + class A : IBar, IFoo + { [Kept] void IFoo.Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedExplicitInterfaceIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedExplicitInterfaceIsRemoved.cs index 7afcd6056..cdfb7c9e2 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedExplicitInterfaceIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedExplicitInterfaceIsRemoved.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class UnusedExplicitInterfaceIsRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class UnusedExplicitInterfaceIsRemoved + { public static void Main () { IFoo i = new A (); @@ -9,19 +11,22 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } - interface IBar { + interface IBar + { void Bar (); } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class A : IBar, IFoo { + class A : IBar, IFoo + { [Kept] void IFoo.Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedGenericInterfaceIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedGenericInterfaceIsRemoved.cs index 5801525cc..7c2f1378c 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedGenericInterfaceIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedGenericInterfaceIsRemoved.cs @@ -1,19 +1,22 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class UnusedGenericInterfaceIsRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class UnusedGenericInterfaceIsRemoved + { public static void Main () { var fb = new Foo (); IFoo<object> fo = fb; fo.Method (null); - + IFoo<int> fi = fb; fi.Method (0); } [Kept] - interface IFoo<T> { + interface IFoo<T> + { [Kept] void Method (T arg); } @@ -24,7 +27,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { [KeptInterface (typeof (IFoo<int>))] [KeptInterface (typeof (IFoo<string>))] // FIXME : Should be removed [KeptInterface (typeof (IFoo<Bar>))] // FIXME : Should be removed - class Foo : IFoo<object>, IFoo<int>, IFoo<string>, IFoo<Bar> { + class Foo : IFoo<object>, IFoo<int>, IFoo<string>, IFoo<Bar> + { [Kept] public void Method (object arg) { @@ -53,7 +57,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] // FIXME : Should be removed - class Bar { + class Bar + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedInterfaceHasMethodPreservedViaXml.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedInterfaceHasMethodPreservedViaXml.cs index 2b5e7ea2f..bcacfa101 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedInterfaceHasMethodPreservedViaXml.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedInterfaceHasMethodPreservedViaXml.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class UnusedInterfaceHasMethodPreservedViaXml { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class UnusedInterfaceHasMethodPreservedViaXml + { public static void Main () { IFoo i = new A (); @@ -9,19 +11,22 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } - interface IBar { + interface IBar + { void Bar (); } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class A : IBar, IFoo { + class A : IBar, IFoo + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedInterfaceTypeIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedInterfaceTypeIsRemoved.cs index 69e55bead..a5d1a89fd 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedInterfaceTypeIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/UnusedInterfaceTypeIsRemoved.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { - public class UnusedInterfaceTypeIsRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType +{ + public class UnusedInterfaceTypeIsRemoved + { public static void Main () { IFoo i = new A (); @@ -9,19 +11,22 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } - interface IBar { + interface IBar + { void Bar (); } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class A : IBar, IFoo { + class A : IBar, IFoo + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed.cs index 260dcb92e..431951898 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor { - public class InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor +{ + public class InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed + { public static void Main () { IUsedInterface p = new UsedClass (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor } [Kept] - interface IUsedInterface { + interface IUsedInterface + { [Kept] void Foo (); } @@ -18,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IUsedInterface))] - class UsedClass : IUsedInterface { + class UsedClass : IUsedInterface + { [Kept] public void Foo () { @@ -27,7 +31,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor [Kept] [KeptInterface (typeof (IUsedInterface))] // Could be removed in the future with improved handling of value types - struct StaticMethodOnlyUsed : IUsedInterface { + struct StaticMethodOnlyUsed : IUsedInterface + { [Kept] // Could be removed in the future with improved handling of value types public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsedWithCctor.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsedWithCctor.cs index 0ce19620b..94e099e60 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsedWithCctor.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsedWithCctor.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor { - public class InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsedWithCctor { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor +{ + public class InterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsedWithCctor + { public static void Main () { IUsedInterface p = new UsedClass (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor } [Kept] - interface IUsedInterface { + interface IUsedInterface + { [Kept] void Foo (); } @@ -18,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IUsedInterface))] - class UsedClass : IUsedInterface { + class UsedClass : IUsedInterface + { [Kept] public void Foo () { @@ -27,7 +31,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor [Kept] [KeptInterface (typeof (IUsedInterface))] // Could be removed in the future with improved handling of value types - struct StaticMethodOnlyUsed : IUsedInterface { + struct StaticMethodOnlyUsed : IUsedInterface + { [Kept] static StaticMethodOnlyUsed () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod.cs index 54680898a..0a387937b 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod.cs @@ -1,24 +1,28 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor { - public class InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor +{ + public class InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod + { public static void Main () { StaticMethodOnlyUsed.StaticMethod (); - + // We are testing removing interfaces when no instance is created, we need to mark the interface types // so that we don't end up testing unused interface types being swept var tmp = typeof (IUsedInterface).ToString (); } [Kept] // Could be removed in the future with improved handling of value types - interface IUsedInterface { + interface IUsedInterface + { void Foo (); } [Kept] [KeptInterface (typeof (IUsedInterface))] // Could be removed in the future with improved handling of value types - struct StaticMethodOnlyUsed : IUsedInterface { + struct StaticMethodOnlyUsed : IUsedInterface + { public void Foo () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethodMultiple.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethodMultiple.cs index a6eadcabf..4874b0edc 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethodMultiple.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/NoKeptCtor/InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethodMultiple.cs @@ -1,13 +1,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor { - public class InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethodMultiple { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor +{ + public class InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethodMultiple + { public static void Main () { IUsedInterface p = new UsedClass (); StaticMethodOnlyUsed.StaticMethod (); p.Foo (); - + // We are testing removing interfaces when no instance is created, we need to mark the interface types // so that we don't end up testing unused interface types being swept var tmp = typeof (IRemovable1).ToString (); @@ -15,23 +17,27 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor } [Kept] - interface IUsedInterface { + interface IUsedInterface + { [Kept] void Foo (); } [Kept] // Could be removed in the future with improved handling of value types - interface IRemovable1 { + interface IRemovable1 + { } - + [Kept] // Could be removed in the future with improved handling of value types - interface IRemovable2 { + interface IRemovable2 + { } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IUsedInterface))] - class UsedClass : IUsedInterface { + class UsedClass : IUsedInterface + { [Kept] public void Foo () { @@ -42,7 +48,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor [KeptInterface (typeof (IUsedInterface))] // Could be removed in the future with improved handling of value types [KeptInterface (typeof (IRemovable1))] // Could be removed in the future with improved handling of value types [KeptInterface (typeof (IRemovable2))] // Could be removed in the future with improved handling of value types - struct StaticMethodOnlyUsed : IUsedInterface, IRemovable1, IRemovable2 { + struct StaticMethodOnlyUsed : IUsedInterface, IRemovable1, IRemovable2 + { [Kept] // Could be removed in the future with improved handling of value types public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructImplementingInterfaceMethodsNested.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructImplementingInterfaceMethodsNested.cs index 1108175bf..8e438aeda 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructImplementingInterfaceMethodsNested.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructImplementingInterfaceMethodsNested.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { - public class StructImplementingInterfaceMethodsNested { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType +{ + public class StructImplementingInterfaceMethodsNested + { public static void Main () { IFoo i = new A (); @@ -9,18 +11,21 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } - interface IBar : IFoo { + interface IBar : IFoo + { void Bar (); } [Kept] [KeptInterface (typeof (IFoo))] - struct A : IBar { + struct A : IBar + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructImplementingInterfaceMethodsNested2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructImplementingInterfaceMethodsNested2.cs index f7a701dc1..6ae4c15ea 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructImplementingInterfaceMethodsNested2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructImplementingInterfaceMethodsNested2.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { - public class StructImplementingInterfaceMethodsNested2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType +{ + public class StructImplementingInterfaceMethodsNested2 + { public static void Main () { IBar b = new A (); @@ -10,21 +12,24 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } - + [Kept] [KeptInterface (typeof (IFoo))] - interface IBar : IFoo { + interface IBar : IFoo + { void Bar (); } [Kept] [KeptInterface (typeof (IBar))] [KeptInterface (typeof (IFoo))] - struct A : IBar { + struct A : IBar + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs index a1996be28..3149f92aa 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs @@ -2,7 +2,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { - class StructUsedFromConcreteTypeHasInterfaceMethodRemoved { + class StructUsedFromConcreteTypeHasInterfaceMethodRemoved + { public static void Main () { A a = new A (); @@ -10,14 +11,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType } [Kept] - struct A : IFoo { + struct A : IFoo + { [Kept] public void Foo () { } } - public interface IFoo { + public interface IFoo + { void Foo (); } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructUsedFromConcreteTypeHasInterfaceMethodRemoved2.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructUsedFromConcreteTypeHasInterfaceMethodRemoved2.cs index 246f682a8..092805b5e 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructUsedFromConcreteTypeHasInterfaceMethodRemoved2.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructUsedFromConcreteTypeHasInterfaceMethodRemoved2.cs @@ -1,19 +1,22 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { - public class StructUsedFromConcreteTypeHasInterfaceMethodRemoved2 { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType +{ + public class StructUsedFromConcreteTypeHasInterfaceMethodRemoved2 + { public static void Main () { A a = new A (); a.Foo (); - + // If IFoo is marked for any reason then all of a sudden we do need to keep IFoo on A var tmp = typeof (IFoo).ToString (); } [Kept] [KeptInterface (typeof (IFoo))] - struct A : IFoo { + struct A : IFoo + { [Kept] public void Foo () { @@ -21,7 +24,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { } [Kept] - public interface IFoo { + public interface IFoo + { void Foo (); } } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructUsedFromInterfaceHasInterfaceMethodKept.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructUsedFromInterfaceHasInterfaceMethodKept.cs index 83935642d..a077e2827 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructUsedFromInterfaceHasInterfaceMethodKept.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructUsedFromInterfaceHasInterfaceMethodKept.cs @@ -2,7 +2,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { - class StructUsedFromInterfaceHasInterfaceMethodKept { + class StructUsedFromInterfaceHasInterfaceMethodKept + { public static void Main () { IFoo a = new A (); @@ -11,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType [Kept] [KeptInterface (typeof (IFoo))] - struct A : IFoo { + struct A : IFoo + { [Kept] public void Foo () { @@ -19,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType } [Kept] - public interface IFoo { + public interface IFoo + { [Kept] void Foo (); } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructWithNestedStructImplementingInterface.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructWithNestedStructImplementingInterface.cs index 3c369c1b1..0bdc4a2a4 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructWithNestedStructImplementingInterface.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/StructWithNestedStructImplementingInterface.cs @@ -1,12 +1,14 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType +{ /// <summary> /// This is a specially crafted cases that was able to hit a 'Collection was modified; enumeration operation may not execute.' exception during /// MarkStep.ProcessMarkedTypesWithInterfaces /// </summary> - public class StructWithNestedStructImplementingInterface { + public class StructWithNestedStructImplementingInterface + { public static void Main () { var type = typeof (IBuildable<>); @@ -16,37 +18,46 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { } [Kept] - public interface IRunner { + public interface IRunner + { } - public interface IBuildable { + public interface IBuildable + { } [Kept] - public interface IBuilder { + public interface IBuilder + { Result<IRunner> Build (Node node, Node root, World world); } [Kept] - public interface IBuildable<T> : IBuildable where T : IBuilder, new() { + public interface IBuildable<T> : IBuildable where T : IBuilder, new() + { } - public struct Result<T> : IResult { + public struct Result<T> : IResult + { } - public class Node { + public class Node + { } - public class World { + public class World + { } - public interface IResult { + public interface IResult + { } [Kept] [KeptInterface (typeof (IBuilder))] [KeptMember (".ctor()")] - public abstract class Builder<T> : IBuilder where T : IRunner { + public abstract class Builder<T> : IBuilder where T : IRunner + { public abstract Result<T> Build (Node node, Node root, World world); Result<IRunner> IBuilder.Build (Node node, Node root, World world) @@ -57,7 +68,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { [Kept] [KeptInterface (typeof (IBuildable<Profile.Builder>))] - public struct Profile : IBuildable<Profile.Builder> { + public struct Profile : IBuildable<Profile.Builder> + { [Kept] public void Foo () { @@ -65,13 +77,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { [Kept] [KeptInterface (typeof (IRunner))] - private sealed class Runner : IRunner { + private sealed class Runner : IRunner + { } [Kept] - [KeptBaseType (typeof(Builder<Runner>))] + [KeptBaseType (typeof (Builder<Runner>))] [KeptMember (".ctor()")] - private sealed class Builder : Builder<Runner> { + private sealed class Builder : Builder<Runner> + { public override Result<Runner> Build (Node node, Node root, World world) { return default (Result<Runner>); diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedExplicitInterfaceHasMethodPreservedViaXml.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedExplicitInterfaceHasMethodPreservedViaXml.cs index 4e76aa1a5..160d0fa83 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedExplicitInterfaceHasMethodPreservedViaXml.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedExplicitInterfaceHasMethodPreservedViaXml.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { - public class UnusedExplicitInterfaceHasMethodPreservedViaXml { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType +{ + public class UnusedExplicitInterfaceHasMethodPreservedViaXml + { public static void Main () { IFoo i = new A (); @@ -9,13 +11,15 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } [Kept] - interface IBar { + interface IBar + { [Kept] void Bar (); } @@ -24,7 +28,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] [KeptInterface (typeof (IBar))] - struct A : IBar, IFoo { + struct A : IBar, IFoo + { [Kept] void IFoo.Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedExplicitInterfaceIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedExplicitInterfaceIsRemoved.cs index f731e3bdc..fa6d6d344 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedExplicitInterfaceIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedExplicitInterfaceIsRemoved.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { - public class UnusedExplicitInterfaceIsRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType +{ + public class UnusedExplicitInterfaceIsRemoved + { public static void Main () { IFoo i = new A (); @@ -9,19 +11,22 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } - interface IBar { + interface IBar + { void Bar (); } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - struct A : IBar, IFoo { + struct A : IBar, IFoo + { [Kept] void IFoo.Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedInterfaceHasMethodPreservedViaXml.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedInterfaceHasMethodPreservedViaXml.cs index 89cf4d264..550b3abf7 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedInterfaceHasMethodPreservedViaXml.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedInterfaceHasMethodPreservedViaXml.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { - public class UnusedInterfaceHasMethodPreservedViaXml { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType +{ + public class UnusedInterfaceHasMethodPreservedViaXml + { public static void Main () { IFoo i = new A (); @@ -9,19 +11,22 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } - interface IBar { + interface IBar + { void Bar (); } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - struct A : IBar, IFoo { + struct A : IBar, IFoo + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedInterfaceTypeIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedInterfaceTypeIsRemoved.cs index 82ececac1..f79f6d5e0 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedInterfaceTypeIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnValueType/UnusedInterfaceTypeIsRemoved.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { - public class UnusedInterfaceTypeIsRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType +{ + public class UnusedInterfaceTypeIsRemoved + { public static void Main () { IFoo i = new A (); @@ -9,19 +11,22 @@ namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Foo (); } - interface IBar { + interface IBar + { void Bar (); } [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - struct A : IBar, IFoo { + struct A : IBar, IFoo + { [Kept] public void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/Dependencies/TypeWithBaseInCopiedAssembly_Base.cs b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/Dependencies/TypeWithBaseInCopiedAssembly_Base.cs index 7702d827f..337279c98 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/Dependencies/TypeWithBaseInCopiedAssembly_Base.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/Dependencies/TypeWithBaseInCopiedAssembly_Base.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods.Dependencies { - public class TypeWithBaseInCopiedAssembly_Base { +namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods.Dependencies +{ + public class TypeWithBaseInCopiedAssembly_Base + { public virtual void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/HarderToDetectUnusedVirtualMethodGetsRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/HarderToDetectUnusedVirtualMethodGetsRemoved.cs index 8348dbd09..b9885e8ac 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/HarderToDetectUnusedVirtualMethodGetsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/HarderToDetectUnusedVirtualMethodGetsRemoved.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { - class HarderToDetectUnusedVirtualMethodGetsRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods +{ + class HarderToDetectUnusedVirtualMethodGetsRemoved + { public static void Main () { new Base ().Call (); @@ -14,14 +16,16 @@ namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { [Kept] [KeptMember (".ctor()")] - class Base { + class Base + { [Kept] public virtual void Call () { } } - class B : Base { + class B : Base + { public override void Call () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/NeverInstantiatedTypeWithBaseInCopiedAssembly.cs b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/NeverInstantiatedTypeWithBaseInCopiedAssembly.cs index 50a91dace..162a5c48c 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/NeverInstantiatedTypeWithBaseInCopiedAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/NeverInstantiatedTypeWithBaseInCopiedAssembly.cs @@ -2,20 +2,23 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.VirtualMethods.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { +namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods +{ [SetupLinkerAction ("copy", "base")] - [SetupCompileBefore ("base.dll", new [] {typeof (TypeWithBaseInCopiedAssembly_Base)})] + [SetupCompileBefore ("base.dll", new[] { typeof (TypeWithBaseInCopiedAssembly_Base) })] [KeptMemberInAssembly ("base.dll", typeof (TypeWithBaseInCopiedAssembly_Base), "Method()")] - public class NeverInstantiatedTypeWithBaseInCopiedAssembly { + public class NeverInstantiatedTypeWithBaseInCopiedAssembly + { public static void Main () { new Foo (); } [Kept] - [KeptMember(".ctor()")] + [KeptMember (".ctor()")] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly_Base))] - class Foo : TypeWithBaseInCopiedAssembly_Base { + class Foo : TypeWithBaseInCopiedAssembly_Base + { [Kept] public override void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly.cs b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly.cs index 0b58b67fb..266f21769 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/NotKeptCtor/NeverInstantiatedTypeWithBaseInCopiedAssembly.cs @@ -2,11 +2,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Inheritance.VirtualMethods.Dependencies; -namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods.NotKeptCtor { +namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods.NotKeptCtor +{ [SetupLinkerAction ("copy", "base")] - [SetupCompileBefore ("base.dll", new [] {typeof (TypeWithBaseInCopiedAssembly_Base)})] + [SetupCompileBefore ("base.dll", new[] { typeof (TypeWithBaseInCopiedAssembly_Base) })] [KeptMemberInAssembly ("base.dll", typeof (TypeWithBaseInCopiedAssembly_Base), "Method()")] - public class NeverInstantiatedTypeWithBaseInCopiedAssembly { + public class NeverInstantiatedTypeWithBaseInCopiedAssembly + { public static void Main () { Helper (null); @@ -19,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods.NotKeptCtor { [Kept] [KeptBaseType (typeof (TypeWithBaseInCopiedAssembly_Base))] - class Foo : TypeWithBaseInCopiedAssembly_Base { + class Foo : TypeWithBaseInCopiedAssembly_Base + { // It's safe to remove this because the type is never instantiated and the base method is virtual public override void Method () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UnusedTypeWithOverrideOfVirtualMethodIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UnusedTypeWithOverrideOfVirtualMethodIsRemoved.cs index 57e84bca1..a9d71c772 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UnusedTypeWithOverrideOfVirtualMethodIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UnusedTypeWithOverrideOfVirtualMethodIsRemoved.cs @@ -1,21 +1,25 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { - class UnusedTypeWithOverrideOfVirtualMethodIsRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods +{ + class UnusedTypeWithOverrideOfVirtualMethodIsRemoved + { public static void Main () { new Base ().Call (); } [KeptMember (".ctor()")] - class Base { + class Base + { [Kept] public virtual void Call () { } } - class B : Base { + class B : Base + { public override void Call () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UnusedVirtualMethodRemoved.cs b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UnusedVirtualMethodRemoved.cs index 88bd1f8ec..615e7f290 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UnusedVirtualMethodRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UnusedVirtualMethodRemoved.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { - public class UnusedVirtualMethodRemoved { +namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods +{ + public class UnusedVirtualMethodRemoved + { public static void Main () { var tmp = new B (); } [KeptMember (".ctor()")] - class Base { + class Base + { public virtual void Call () { } @@ -17,7 +20,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (Base))] - class B : Base { + class B : Base + { public override void Call () { } diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UsedOverrideOfVirtualMethodIsKept.cs b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UsedOverrideOfVirtualMethodIsKept.cs index 27b3c90dd..a1b996d41 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UsedOverrideOfVirtualMethodIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UsedOverrideOfVirtualMethodIsKept.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { - public class UsedOverrideOfVirtualMethodIsKept { +namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods +{ + public class UsedOverrideOfVirtualMethodIsKept + { public static void Main () { var tmp = new B (); @@ -9,7 +11,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { } [KeptMember (".ctor()")] - class Base { + class Base + { [Kept] public virtual void Call () { @@ -19,7 +22,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (Base))] - class B : Base { + class B : Base + { [Kept] public override void Call () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UsedTypeWithOverrideOfVirtualMethodHasOverrideKept.cs b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UsedTypeWithOverrideOfVirtualMethodHasOverrideKept.cs index 2474d8dfa..29af6cfea 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UsedTypeWithOverrideOfVirtualMethodHasOverrideKept.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/UsedTypeWithOverrideOfVirtualMethodHasOverrideKept.cs @@ -1,8 +1,10 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { - public class UsedTypeWithOverrideOfVirtualMethodHasOverrideKept { +namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods +{ + public class UsedTypeWithOverrideOfVirtualMethodHasOverrideKept + { public static void Main () { new B (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { } [KeptMember (".ctor()")] - class Base { + class Base + { [Kept] public virtual void Call () { @@ -19,7 +22,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { [KeptMember (".ctor()")] [KeptBaseType (typeof (Base))] - class B : Base { + class B : Base + { [Kept] public override void Call () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/VirtualMethodGetsPerservedIfBaseMethodGetsInvoked.cs b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/VirtualMethodGetsPerservedIfBaseMethodGetsInvoked.cs index 0b1d75d75..4ae1aa52a 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/VirtualMethodGetsPerservedIfBaseMethodGetsInvoked.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/VirtualMethodGetsPerservedIfBaseMethodGetsInvoked.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { - class VirtualMethodGetsPerservedIfBaseMethodGetsInvoked { +namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods +{ + class VirtualMethodGetsPerservedIfBaseMethodGetsInvoked + { public static void Main () { new A (); @@ -9,7 +11,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { } [KeptMember (".ctor()")] - class B { + class B + { [Kept] public virtual void Foo () { @@ -18,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { [KeptMember (".ctor()")] [KeptBaseType (typeof (B))] - class A : B { + class A : B + { [Kept] public override void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly.cs b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly.cs index d6b4969fe..76457ce53 100644 --- a/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly.cs +++ b/test/Mono.Linker.Tests.Cases/Inheritance.VirtualMethods/VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { - class VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly { +namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods +{ + class VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly + { public static void Main () { new A ().Foo (); } [KeptMember (".ctor()")] - class B { + class B + { [Kept] // TODO: Would be nice to be removed public virtual void Foo () { @@ -17,7 +20,8 @@ namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods { [KeptMember (".ctor()")] [KeptBaseType (typeof (B))] - class A : B { + class A : B + { [Kept] public override void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfParameterIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfParameterIsRemoved.cs index 304a78553..8dbaf9566 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfParameterIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfParameterIsRemoved.cs @@ -2,8 +2,10 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { - class DefaultConstructorOfParameterIsRemoved { +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com +{ + class DefaultConstructorOfParameterIsRemoved + { public static void Main () { SomeMethod (null); @@ -13,7 +15,8 @@ namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { [KeptAttributeAttribute (typeof (GuidAttribute))] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { + class A + { } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfReturnTypeIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfReturnTypeIsRemoved.cs index f9b3fc51d..73295df73 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfReturnTypeIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfReturnTypeIsRemoved.cs @@ -2,8 +2,10 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { - class DefaultConstructorOfReturnTypeIsRemoved { +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com +{ + class DefaultConstructorOfReturnTypeIsRemoved + { public static void Main () { var a = SomeMethod (); @@ -13,7 +15,8 @@ namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { [KeptAttributeAttribute (typeof (GuidAttribute))] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { + class A + { } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfParameterAreRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfParameterAreRemoved.cs index 287b00c78..b5d8d6271 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfParameterAreRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfParameterAreRemoved.cs @@ -2,8 +2,10 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { - class FieldsOfParameterAreRemoved { +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com +{ + class FieldsOfParameterAreRemoved + { public static void Main () { SomeMethod (null); @@ -13,7 +15,8 @@ namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { [KeptAttributeAttribute (typeof (GuidAttribute))] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { + class A + { private int field; } diff --git a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfReturnTypeAreRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfReturnTypeAreRemoved.cs index d1c0a7ecf..4a907d64b 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfReturnTypeAreRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfReturnTypeAreRemoved.cs @@ -2,8 +2,10 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { - class FieldsOfReturnTypeAreRemoved { +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com +{ + class FieldsOfReturnTypeAreRemoved + { public static void Main () { var a = SomeMethod (); @@ -13,7 +15,8 @@ namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { [KeptAttributeAttribute (typeof (GuidAttribute))] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { + class A + { private int field; } diff --git a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfThisAreRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfThisAreRemoved.cs index ad4918318..7f34c6474 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfThisAreRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfThisAreRemoved.cs @@ -2,8 +2,10 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { - class FieldsOfThisAreRemoved { +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com +{ + class FieldsOfThisAreRemoved + { public static void Main () { new A ().SomeMethod (); @@ -14,7 +16,8 @@ namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { [KeptAttributeAttribute (typeof (GuidAttribute))] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { + class A + { private int field; [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/DefaultConstructorOfReturnTypeIsNotRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/DefaultConstructorOfReturnTypeIsNotRemoved.cs index ecfe75123..fdf91dd93 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/DefaultConstructorOfReturnTypeIsNotRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/DefaultConstructorOfReturnTypeIsNotRemoved.cs @@ -1,14 +1,17 @@ using System.Runtime.CompilerServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { - class DefaultConstructorOfReturnTypeIsNotRemoved { +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls +{ + class DefaultConstructorOfReturnTypeIsNotRemoved + { public static void Main () { var a = SomeMethod (); } - class A { + class A + { [Kept] public A () { diff --git a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorIsRemoved.cs index ab21994f0..089e594fa 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorIsRemoved.cs @@ -1,15 +1,18 @@ using System.Runtime.CompilerServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { - class UnusedDefaultConstructorIsRemoved { +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls +{ + class UnusedDefaultConstructorIsRemoved + { public static void Main () { var a = new A (1); SomeMethod (a); } - class A { + class A + { public A () { } diff --git a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs index d181ecd0a..e4a5e66ff 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs @@ -1,15 +1,18 @@ using System.Runtime.CompilerServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { - class UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved { +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls +{ + class UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved + { public static void Main () { var a = new A (1); SomeMethod (ref a); } - class A { + class A + { [Kept] public A () { diff --git a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesAreNotRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesAreNotRemoved.cs index 09809a60e..eefdd22af 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesAreNotRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesAreNotRemoved.cs @@ -1,8 +1,10 @@ using System.Runtime.CompilerServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { - class UnusedFieldsOfTypesAreNotRemoved { +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls +{ + class UnusedFieldsOfTypesAreNotRemoved + { public static void Main () { var a = new A (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { } [KeptMember (".ctor()")] - class A { + class A + { [Kept] private int field1; [Kept] private int field2; diff --git a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs index d4f3c3779..7659a6486 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs @@ -1,8 +1,10 @@ using System.Runtime.CompilerServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { - class UnusedFieldsOfTypesPassedByRefAreNotRemoved { +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls +{ + class UnusedFieldsOfTypesPassedByRefAreNotRemoved + { public static void Main () { var a = new A (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { } [KeptMember (".ctor()")] - class A { + class A + { [Kept] private int field1; [Kept] private int field2; diff --git a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesWhenHasThisAreNotRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesWhenHasThisAreNotRemoved.cs index df77357d6..78bf3a9da 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesWhenHasThisAreNotRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesWhenHasThisAreNotRemoved.cs @@ -1,8 +1,10 @@ using System.Runtime.CompilerServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { - class UnusedFieldsOfTypesWhenHasThisAreNotRemoved { +namespace Mono.Linker.Tests.Cases.Interop.InternalCalls +{ + class UnusedFieldsOfTypesWhenHasThisAreNotRemoved + { public static void Main () { A a = new A (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { } [KeptMember (".ctor()")] - class A { + class A + { [Kept] private int field1; [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfParameterIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfParameterIsRemoved.cs index df3d3b552..c17a8eeae 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfParameterIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfParameterIsRemoved.cs @@ -2,8 +2,10 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { - class DefaultConstructorOfParameterIsRemoved { +namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com +{ + class DefaultConstructorOfParameterIsRemoved + { public static void Main () { SomeMethod (null); @@ -13,7 +15,8 @@ namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { [KeptAttributeAttribute (typeof (GuidAttribute))] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { + class A + { } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfReturnTypeIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfReturnTypeIsRemoved.cs index 3cc7df5db..e19ddcc32 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfReturnTypeIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfReturnTypeIsRemoved.cs @@ -2,8 +2,10 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { - class DefaultConstructorOfReturnTypeIsRemoved { +namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com +{ + class DefaultConstructorOfReturnTypeIsRemoved + { public static void Main () { var a = SomeMethod (); @@ -13,7 +15,8 @@ namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { [KeptAttributeAttribute (typeof (GuidAttribute))] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { + class A + { } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfParameterAreRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfParameterAreRemoved.cs index 73a66b576..fa7dac6df 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfParameterAreRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfParameterAreRemoved.cs @@ -2,8 +2,10 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { - class FieldsOfParameterAreRemoved { +namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com +{ + class FieldsOfParameterAreRemoved + { public static void Main () { SomeMethod (null); @@ -13,7 +15,8 @@ namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { [KeptAttributeAttribute (typeof (GuidAttribute))] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { + class A + { private int field; } diff --git a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfReturnTypeAreRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfReturnTypeAreRemoved.cs index 7551d8687..bd7ac773a 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfReturnTypeAreRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfReturnTypeAreRemoved.cs @@ -2,8 +2,10 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { - class FieldsOfReturnTypeAreRemoved { +namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com +{ + class FieldsOfReturnTypeAreRemoved + { public static void Main () { var a = SomeMethod (); @@ -13,7 +15,8 @@ namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { [KeptAttributeAttribute (typeof (GuidAttribute))] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { + class A + { private int field; } diff --git a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfThisAreRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfThisAreRemoved.cs index 4c7402063..164030b48 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfThisAreRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfThisAreRemoved.cs @@ -2,8 +2,10 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { - class FieldsOfThisAreRemoved { +namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com +{ + class FieldsOfThisAreRemoved + { public static void Main () { new A ().SomeMethod (); @@ -14,7 +16,8 @@ namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { [KeptAttributeAttribute (typeof (GuidAttribute))] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { + class A + { private int field; [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/DefaultConstructorOfReturnTypeIsNotRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/DefaultConstructorOfReturnTypeIsNotRemoved.cs index d714d0d95..5b7bbbe94 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/DefaultConstructorOfReturnTypeIsNotRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/DefaultConstructorOfReturnTypeIsNotRemoved.cs @@ -1,14 +1,17 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.PInvoke { - class DefaultConstructorOfReturnTypeIsNotRemoved { +namespace Mono.Linker.Tests.Cases.Interop.PInvoke +{ + class DefaultConstructorOfReturnTypeIsNotRemoved + { public static void Main () { var a = SomeMethod (); } - class A { + class A + { [Kept] public A () { diff --git a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Individual/CanOutputPInvokes.cs b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Individual/CanOutputPInvokes.cs index 8f0b28eec..e42acbb9b 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Individual/CanOutputPInvokes.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Individual/CanOutputPInvokes.cs @@ -8,9 +8,9 @@ namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Individual [SetupLinkerAction ("link", "linkassembly")] // Prevent dumping of pinvokes from core assemblies [SetupLinkerCoreAction ("skip")] - [SetupCompileBefore ("copyassembly.dll", new [] { typeof (CanOutputPInvokes_CopyAssembly) })] - [SetupCompileBefore ("linkassembly.dll", new [] { typeof (CanOutputPInvokes_LinkAssembly) })] - [SetupLinkerArgument ("--output-pinvokes", new [] { "pinvokes.json" })] + [SetupCompileBefore ("copyassembly.dll", new[] { typeof (CanOutputPInvokes_CopyAssembly) })] + [SetupCompileBefore ("linkassembly.dll", new[] { typeof (CanOutputPInvokes_LinkAssembly) })] + [SetupLinkerArgument ("--output-pinvokes", new[] { "pinvokes.json" })] public class CanOutputPInvokes { diff --git a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorIsRemoved.cs index 041cc9c98..78d07f35c 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorIsRemoved.cs @@ -1,15 +1,18 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.PInvoke { - class UnusedDefaultConstructorIsRemoved { +namespace Mono.Linker.Tests.Cases.Interop.PInvoke +{ + class UnusedDefaultConstructorIsRemoved + { public static void Main () { var a = new A (1); SomeMethod (a); } - class A { + class A + { public A () { } diff --git a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs index db2514a4a..442a3e84f 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs @@ -1,15 +1,18 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.PInvoke { - class UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved { +namespace Mono.Linker.Tests.Cases.Interop.PInvoke +{ + class UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved + { public static void Main () { var a = new A (1); SomeMethod (ref a); } - class A { + class A + { [Kept] public A () { diff --git a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesAreNotRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesAreNotRemoved.cs index a34c4d6bb..e801ff55c 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesAreNotRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesAreNotRemoved.cs @@ -1,8 +1,10 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.PInvoke { - class UnusedFieldsOfTypesAreNotRemoved { +namespace Mono.Linker.Tests.Cases.Interop.PInvoke +{ + class UnusedFieldsOfTypesAreNotRemoved + { public static void Main () { var a = new A (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Interop.PInvoke { } [KeptMember (".ctor()")] - class A { + class A + { [Kept] private int field1; [Kept] private int field2; diff --git a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs index 50ae45fe3..e9bbbf654 100644 --- a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs @@ -1,8 +1,10 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Interop.PInvoke { - class UnusedFieldsOfTypesPassedByRefAreNotRemoved { +namespace Mono.Linker.Tests.Cases.Interop.PInvoke +{ + class UnusedFieldsOfTypesPassedByRefAreNotRemoved + { public static void Main () { var a = new A (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Interop.PInvoke { } [KeptMember (".ctor()")] - class A { + class A + { [Kept] private int field1; [Kept] private int field2; diff --git a/test/Mono.Linker.Tests.Cases/Libraries/CanLinkPublicApisOfLibrary.cs b/test/Mono.Linker.Tests.Cases/Libraries/CanLinkPublicApisOfLibrary.cs index 1bcd525dd..3ec44173f 100644 --- a/test/Mono.Linker.Tests.Cases/Libraries/CanLinkPublicApisOfLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/Libraries/CanLinkPublicApisOfLibrary.cs @@ -1,12 +1,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Libraries { +namespace Mono.Linker.Tests.Cases.Libraries +{ [SetupLinkerLinkPublicAndFamily] [SetupCompileAsLibrary] [Kept] [KeptMember (".ctor()")] - public class CanLinkPublicApisOfLibrary { + public class CanLinkPublicApisOfLibrary + { // Kept because by default libraries their action set to copy [Kept] public static void Main () diff --git a/test/Mono.Linker.Tests.Cases/Libraries/DefaultLibraryLinkBehavior.cs b/test/Mono.Linker.Tests.Cases/Libraries/DefaultLibraryLinkBehavior.cs index 5c1e9aba4..19ae1ea1c 100644 --- a/test/Mono.Linker.Tests.Cases/Libraries/DefaultLibraryLinkBehavior.cs +++ b/test/Mono.Linker.Tests.Cases/Libraries/DefaultLibraryLinkBehavior.cs @@ -1,11 +1,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Libraries { +namespace Mono.Linker.Tests.Cases.Libraries +{ [SetupCompileAsLibrary] [Kept] [KeptMember (".ctor()")] - public class DefaultLibraryLinkBehavior { + public class DefaultLibraryLinkBehavior + { // Kept because by default libraries their action set to copy [Kept] public static void Main () diff --git a/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/UserAssemblyActionWorks_Lib.cs b/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/UserAssemblyActionWorks_Lib.cs index b9b9e5863..d46e34942 100644 --- a/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/UserAssemblyActionWorks_Lib.cs +++ b/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/UserAssemblyActionWorks_Lib.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.Libraries.Dependencies { - public class UserAssemblyActionWorks_Lib { +namespace Mono.Linker.Tests.Cases.Libraries.Dependencies +{ + public class UserAssemblyActionWorks_Lib + { public static void Used () { } diff --git a/test/Mono.Linker.Tests.Cases/Libraries/UserAssemblyActionWorks.cs b/test/Mono.Linker.Tests.Cases/Libraries/UserAssemblyActionWorks.cs index 1337ce066..cf66c9e5a 100644 --- a/test/Mono.Linker.Tests.Cases/Libraries/UserAssemblyActionWorks.cs +++ b/test/Mono.Linker.Tests.Cases/Libraries/UserAssemblyActionWorks.cs @@ -2,14 +2,16 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Libraries.Dependencies; -namespace Mono.Linker.Tests.Cases.Libraries { +namespace Mono.Linker.Tests.Cases.Libraries +{ /// <summary> /// We have to check another assembly because the test exe is included with -a and that will cause it to be linked /// </summary> [SetupLinkerUserAction ("copy")] [SetupCompileBefore ("lib.dll", new[] { "Dependencies/UserAssemblyActionWorks_Lib.cs" })] [KeptAllTypesAndMembersInAssembly ("lib.dll")] - public class UserAssemblyActionWorks { + public class UserAssemblyActionWorks + { public static void Main () { UserAssemblyActionWorks_Lib.Used (); diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/AssemblyWithPreserveAll.cs b/test/Mono.Linker.Tests.Cases/LinkXml/AssemblyWithPreserveAll.cs index f02913bc5..f9dc8ae88 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/AssemblyWithPreserveAll.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/AssemblyWithPreserveAll.cs @@ -1,22 +1,25 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { +namespace Mono.Linker.Tests.Cases.LinkXml +{ [KeptMember (".ctor()")] - public class AssemblyWithPreserveAll { + public class AssemblyWithPreserveAll + { public static void Main () { } [Kept] [KeptMember (".ctor()")] - class UnusedType { + class UnusedType + { [Kept] public int UnusedField; [Kept] [KeptBackingField] public int UnusedProperty { [Kept] get; [Kept] set; } - + [Kept] public void UnusedMethod () { @@ -24,7 +27,8 @@ namespace Mono.Linker.Tests.Cases.LinkXml { [Kept] [KeptMember (".ctor()")] - class UnusedNestedType { + class UnusedNestedType + { } } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveAnExportedType.cs b/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveAnExportedType.cs index bbf26c1d4..f7e7b07da 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveAnExportedType.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveAnExportedType.cs @@ -12,8 +12,10 @@ namespace Mono.Linker.Tests.Cases.LinkXml [RemovedAssembly ("Forwarder.dll")] [KeptMemberInAssembly ("Library.dll", typeof (CanPreserveAnExportedType_Library), "Field1", "Method()", ".ctor()")] - class CanPreserveAnExportedType { - public static void Main () { + class CanPreserveAnExportedType + { + public static void Main () + { } } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExcludedFeatureCom.cs b/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExcludedFeatureCom.cs index df2aeb29f..ba268b9f2 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExcludedFeatureCom.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExcludedFeatureCom.cs @@ -3,13 +3,15 @@ using System.Runtime.InteropServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.LinkXml { +namespace Mono.Linker.Tests.Cases.LinkXml +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif [SetupLinkerArgument ("--exclude-feature", "com")] - public class CanPreserveExcludedFeatureCom { - public static void Main() + public class CanPreserveExcludedFeatureCom + { + public static void Main () { var a = new A (); } @@ -17,7 +19,7 @@ namespace Mono.Linker.Tests.Cases.LinkXml { [Kept] [KeptMember (".ctor()")] - [KeptAttributeAttribute (typeof(GuidAttribute))] + [KeptAttributeAttribute (typeof (GuidAttribute))] [ComImport] [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] class A diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExportedTypesUsingRegex.cs b/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExportedTypesUsingRegex.cs index d122d98f3..b12e8f6bd 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExportedTypesUsingRegex.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExportedTypesUsingRegex.cs @@ -6,14 +6,16 @@ using Mono.Linker.Tests.Cases.LinkXml.Dependencies; namespace Mono.Linker.Tests.Cases.LinkXml { [KeepTypeForwarderOnlyAssemblies ("false")] - [SetupCompileBefore ("Library.dll", new [] { "Dependencies/CanPreserveAnExportedType_Library.cs" })] + [SetupCompileBefore ("Library.dll", new[] { "Dependencies/CanPreserveAnExportedType_Library.cs" })] // Add another assembly in that uses the forwarder just to make things a little more complex - [SetupCompileBefore ("Forwarder.dll", new [] { "Dependencies/CanPreserveAnExportedType_Forwarder.cs" }, references: new [] { "Library.dll" })] + [SetupCompileBefore ("Forwarder.dll", new[] { "Dependencies/CanPreserveAnExportedType_Forwarder.cs" }, references: new[] { "Library.dll" })] [RemovedAssembly ("Forwarder.dll")] [KeptMemberInAssembly ("Library.dll", typeof (CanPreserveAnExportedType_Library), "Field1", "Method()", ".ctor()")] - class CanPreserveExportedTypesUsingRegex { - public static void Main () { + class CanPreserveExportedTypesUsingRegex + { + public static void Main () + { } } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveTypesUsingRegex.cs b/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveTypesUsingRegex.cs index 0eb9542d2..2c5167dc9 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveTypesUsingRegex.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveTypesUsingRegex.cs @@ -4,29 +4,36 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; namespace Mono.Linker.Tests.Cases.LinkXml { [KeptMember (".ctor()")] - class CanPreserveTypesUsingRegex { - public static void Main () { + class CanPreserveTypesUsingRegex + { + public static void Main () + { } [Kept] - void UnusedHelper () { + void UnusedHelper () + { } [Kept] [KeptMember (".ctor()")] - class Bar { + class Bar + { } } } -namespace Mono.Linker.Tests.Cases.LinkXml.PreserveNamespace { +namespace Mono.Linker.Tests.Cases.LinkXml.PreserveNamespace +{ [Kept] [KeptMember (".ctor()")] - class Type1 { + class Type1 + { } [Kept] [KeptMember (".ctor()")] - class Type2 { + class Type2 + { } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/CanPreserveAnExportedType_Library.cs b/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/CanPreserveAnExportedType_Library.cs index 38814d986..83781f887 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/CanPreserveAnExportedType_Library.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/CanPreserveAnExportedType_Library.cs @@ -2,10 +2,12 @@ namespace Mono.Linker.Tests.Cases.LinkXml.Dependencies { - public class CanPreserveAnExportedType_Library { + public class CanPreserveAnExportedType_Library + { public int Field1; - public void Method () { + public void Method () + { } } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/CopyLibrary.cs b/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/CopyLibrary.cs index 0f7fda126..b6ecabd48 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/CopyLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/CopyLibrary.cs @@ -2,7 +2,8 @@ using System; namespace Mono.Linker.Tests.Cases.LinkXml.Dependencies.EmbeddedLinkXmlFromCopyAssemblyIsProcessed { - public class CopyLibrary { + public class CopyLibrary + { public void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/OtherLibrary.cs b/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/OtherLibrary.cs index 24f59a2d3..c33cfebaa 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/OtherLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/OtherLibrary.cs @@ -2,7 +2,8 @@ using System; namespace Mono.Linker.Tests.Cases.LinkXml.Dependencies.EmbeddedLinkXmlFromCopyAssemblyIsProcessed { - public class OtherLibrary { + public class OtherLibrary + { public void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Base.cs b/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Base.cs index d9803fada..b040bf788 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Base.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Base.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.LinkXml.Dependencies.EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod { - public class Base { +namespace Mono.Linker.Tests.Cases.LinkXml.Dependencies.EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod +{ + public class Base + { public virtual void VirtualMethodFromBase () { } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library1.cs b/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library1.cs index 3c1158922..4b84325a7 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library1.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library1.cs @@ -1,15 +1,18 @@ -namespace Mono.Linker.Tests.Cases.LinkXml.Dependencies.EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod { - public class Library1 : Base { +namespace Mono.Linker.Tests.Cases.LinkXml.Dependencies.EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod +{ + public class Library1 : Base + { public override void VirtualMethodFromBase () { } } - + /// <summary> /// This is here to confirm that derived types in the same assembly as the embedded resource are correctly taken into /// consideration /// </summary> - public class Library1Secondary : Base { + public class Library1Secondary : Base + { public override void VirtualMethodFromBase () { } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library2.cs b/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library2.cs index b977a5834..e572e1489 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library2.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library2.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.LinkXml.Dependencies.EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod { - public class Library2 : Base { +namespace Mono.Linker.Tests.Cases.LinkXml.Dependencies.EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod +{ + public class Library2 : Base + { public override void VirtualMethodFromBase () { } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlFromCopyAssemblyIsProcessed.cs b/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlFromCopyAssemblyIsProcessed.cs index 9bddcaae3..9a57d8bf3 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlFromCopyAssemblyIsProcessed.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlFromCopyAssemblyIsProcessed.cs @@ -2,18 +2,20 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.LinkXml.Dependencies.EmbeddedLinkXmlFromCopyAssemblyIsProcessed; -namespace Mono.Linker.Tests.Cases.LinkXml { +namespace Mono.Linker.Tests.Cases.LinkXml +{ [SetupCompileBefore ("Library.dll", - new [] { "Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/OtherLibrary.cs" })] + new[] { "Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/OtherLibrary.cs" })] [SetupCompileBefore ("CopyLibrary.dll", - new [] { "Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/CopyLibrary.cs" }, - resources: new [] { "Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/CopyLibrary.xml"})] + new[] { "Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/CopyLibrary.cs" }, + resources: new[] { "Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/CopyLibrary.xml" })] [IncludeBlacklistStep (true)] [SetupLinkerAction ("copy", "CopyLibrary")] [KeptTypeInAssembly ("CopyLibrary.dll", typeof (CopyLibrary))] [KeptTypeInAssembly ("Library.dll", typeof (OtherLibrary))] - public class EmbeddedLinkXmlFromCopyAssemblyIsProcessed { + public class EmbeddedLinkXmlFromCopyAssemblyIsProcessed + { public static void Main () { var tmp = new CopyLibrary (); diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod.cs b/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod.cs index 6111bc713..77f45d75c 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod.cs @@ -2,26 +2,28 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.LinkXml.Dependencies.EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod; -namespace Mono.Linker.Tests.Cases.LinkXml { +namespace Mono.Linker.Tests.Cases.LinkXml +{ [SetupCompileBefore ("Base.dll", - new []{"Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Base.cs"})] + new[] { "Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Base.cs" })] [SetupCompileBefore ("Library1.dll", - new [] { "Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library1.cs"}, - new [] { "Base.dll"}, - resources: new [] { "Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library1.xml"})] - [SetupCompileBefore("Library2.dll", - new [] {"Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library2.cs"}, - new [] {"Base.dll"}, + new[] { "Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library1.cs" }, + new[] { "Base.dll" }, + resources: new[] { "Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library1.xml" })] + [SetupCompileBefore ("Library2.dll", + new[] { "Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library2.cs" }, + new[] { "Base.dll" }, addAsReference: false)] [IncludeBlacklistStep (true)] - + [KeptMemberInAssembly ("Library1.dll", typeof (Library1), "VirtualMethodFromBase()")] [KeptMemberInAssembly ("Library1.dll", typeof (Library1Secondary), "VirtualMethodFromBase()")] - + // Library1's embedded link xml will preserve the Library2 type. Because Library2 shares a base class with Library1 // Library2's override should be kept as well [KeptMemberInAssembly ("Library2.dll", "Mono.Linker.Tests.Cases.LinkXml.Dependencies.EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod.Library2", "VirtualMethodFromBase()")] - public class EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod { + public class EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod + { public static void Main () { var tmp = new Library1 (); diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/Dependencies/OnAssembly_Lib1.cs b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/Dependencies/OnAssembly_Lib1.cs index 1e0c0a738..ee457792a 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/Dependencies/OnAssembly_Lib1.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/Dependencies/OnAssembly_Lib1.cs @@ -1,10 +1,13 @@ -namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude.Dependencies { - public class OnAssembly_Lib1 { - public static void UsedSoCompilerDoesntRemoveReference () - { - } +namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude.Dependencies +{ + public class OnAssembly_Lib1 + { + public static void UsedSoCompilerDoesntRemoveReference () + { + } - public class FeatureOneClass { - } - } + public class FeatureOneClass + { + } + } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/Dependencies/OnAssembly_Lib2.cs b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/Dependencies/OnAssembly_Lib2.cs index 0a7731e79..032ad67f7 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/Dependencies/OnAssembly_Lib2.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/Dependencies/OnAssembly_Lib2.cs @@ -1,10 +1,13 @@ -namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude.Dependencies { - public class OnAssembly_Lib2 { - public static void UsedSoCompilerDoesntRemoveReference () - { - } +namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude.Dependencies +{ + public class OnAssembly_Lib2 + { + public static void UsedSoCompilerDoesntRemoveReference () + { + } - public class FeatureTwoClass { - } - } + public class FeatureTwoClass + { + } + } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnAssembly.cs b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnAssembly.cs index 59d546a15..dbe36e943 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnAssembly.cs @@ -2,20 +2,22 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.LinkXml.FeatureExclude.Dependencies; -namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude { +namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif - [SetupLinkerArgument ("--exclude-feature", "one")] - [SetupCompileBefore ("library1.dll", new[] {typeof (OnAssembly_Lib1)})] - [SetupCompileBefore ("library2.dll", new[] {typeof (OnAssembly_Lib2)})] - [RemovedTypeInAssembly ("library1.dll", typeof (OnAssembly_Lib1.FeatureOneClass))] - [KeptTypeInAssembly ("library2.dll", typeof (OnAssembly_Lib2.FeatureTwoClass))] - public class OnAssembly { - public static void Main () - { - OnAssembly_Lib1.UsedSoCompilerDoesntRemoveReference (); - OnAssembly_Lib2.UsedSoCompilerDoesntRemoveReference (); - } - } + [SetupLinkerArgument ("--exclude-feature", "one")] + [SetupCompileBefore ("library1.dll", new[] { typeof (OnAssembly_Lib1) })] + [SetupCompileBefore ("library2.dll", new[] { typeof (OnAssembly_Lib2) })] + [RemovedTypeInAssembly ("library1.dll", typeof (OnAssembly_Lib1.FeatureOneClass))] + [KeptTypeInAssembly ("library2.dll", typeof (OnAssembly_Lib2.FeatureTwoClass))] + public class OnAssembly + { + public static void Main () + { + OnAssembly_Lib1.UsedSoCompilerDoesntRemoveReference (); + OnAssembly_Lib2.UsedSoCompilerDoesntRemoveReference (); + } + } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnEvent.cs b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnEvent.cs index 2cf664c5e..1279cfe85 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnEvent.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnEvent.cs @@ -2,19 +2,21 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude { +namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif - [SetupLinkerArgument ("--exclude-feature", "one")] - public class OnEvent { - public static void Main () - { - } + [SetupLinkerArgument ("--exclude-feature", "one")] + public class OnEvent + { + public static void Main () + { + } - public event EventHandler<EventArgs> FeatureOne; + public event EventHandler<EventArgs> FeatureOne; - [Kept] - public event EventHandler<EventArgs> FeatureTwo {[Kept] add {}[Kept] remove {} } - } + [Kept] + public event EventHandler<EventArgs> FeatureTwo { [Kept] add { } [Kept] remove { } } + } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnField.cs b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnField.cs index 466be6199..df2a32af2 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnField.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnField.cs @@ -1,19 +1,21 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude { +namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif - [SetupLinkerArgument ("--exclude-feature", "one")] - public class OnField { - public static void Main () - { - } + [SetupLinkerArgument ("--exclude-feature", "one")] + public class OnField + { + public static void Main () + { + } - private int _featureOne; + private int _featureOne; - [Kept] - private int _featureTwo; - } + [Kept] + private int _featureTwo; + } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnMethod.cs b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnMethod.cs index 30741f2a2..1f7a7def8 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnMethod.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnMethod.cs @@ -1,23 +1,25 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude { +namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif - [SetupLinkerArgument ("--exclude-feature", "one")] - public class OnMethod { - public static void Main () - { - } + [SetupLinkerArgument ("--exclude-feature", "one")] + public class OnMethod + { + public static void Main () + { + } - public void FeatureOne () - { - } + public void FeatureOne () + { + } - [Kept] - public void FeatureTwo () - { - } - } + [Kept] + public void FeatureTwo () + { + } + } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnProperty.cs b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnProperty.cs index c550c605c..105330ea3 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnProperty.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnProperty.cs @@ -1,12 +1,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude { +namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif [SetupLinkerArgument ("--exclude-feature", "one")] - public class OnProperty { + public class OnProperty + { public static void Main () { new Foo (); // Used to avoid lazy body marking @@ -14,12 +16,13 @@ namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { public int FeatureOne { get; set; } - - [Kept] - [KeptBackingField] - public int FeatureTwo {[Kept] get; [Kept] set; } + + [Kept] + [KeptBackingField] + public int FeatureTwo { [Kept] get; [Kept] set; } } } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnType.cs b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnType.cs index 731f54080..32b546637 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnType.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/FeatureExclude/OnType.cs @@ -1,23 +1,26 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude { +namespace Mono.Linker.Tests.Cases.LinkXml.FeatureExclude +{ #if NETCOREAPP [IgnoreTestCase ("--exclude-feature is not supported on .NET Core")] #endif - [SetupLinkerArgument ("--exclude-feature", "one")] - public class OnType { - public static void Main () - { - } + [SetupLinkerArgument ("--exclude-feature", "one")] + public class OnType + { + public static void Main () + { + } - class FeatureOneClass - { - } + class FeatureOneClass + { + } - [Kept] - [KeptMember(".ctor()")] - class FeatureTwoClass { - } - } + [Kept] + [KeptMember (".ctor()")] + class FeatureTwoClass + { + } + } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/PreserveBackingFieldWhenPropertyIsKept.cs b/test/Mono.Linker.Tests.Cases/LinkXml/PreserveBackingFieldWhenPropertyIsKept.cs index c319c1442..16e302a5f 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/PreserveBackingFieldWhenPropertyIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/PreserveBackingFieldWhenPropertyIsKept.cs @@ -13,6 +13,6 @@ namespace Mono.Linker.Tests.Cases.LinkXml [Kept] [KeptBackingField] - public static int Prop { get; [Kept] set; } + public static int Prop { get; [Kept] set; } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/PreserveSecondLevelMethodsOfNonRequiredType.cs b/test/Mono.Linker.Tests.Cases/LinkXml/PreserveSecondLevelMethodsOfNonRequiredType.cs index b795e8f24..27dde89b2 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/PreserveSecondLevelMethodsOfNonRequiredType.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/PreserveSecondLevelMethodsOfNonRequiredType.cs @@ -1,35 +1,37 @@ using System.Collections.Generic; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class PreserveSecondLevelMethodsOfNonRequiredType { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class PreserveSecondLevelMethodsOfNonRequiredType + { public static void Main () { - new Unused (); + new Unused (); } [Kept] class Unused - { - [Kept] - public Unused () - { - } + { + [Kept] + public Unused () + { + } [Kept] private void PreservedMethod () { - new SecondLevel (2); + new SecondLevel (2); } } - [Kept] - class SecondLevel - { - [Kept] - public SecondLevel (int arg) - { - } - } + [Kept] + class SecondLevel + { + [Kept] + public SecondLevel (int arg) + { + } + } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.cs b/test/Mono.Linker.Tests.Cases/LinkXml/TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.cs index 623ee17ca..ed0c2afc6 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.cs @@ -4,12 +4,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; namespace Mono.Linker.Tests.Cases.LinkXml { - class TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved { - public static void Main () { + class TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved + { + public static void Main () + { } [Kept] - class Unused : IFoo<int>, IFoo<string>, IFoo<Cat>, IFoo2<int>, IFoo3<int, string, char>, IDog, IFoo<IFoo<int>> { + class Unused : IFoo<int>, IFoo<string>, IFoo<Cat>, IFoo2<int>, IFoo3<int, string, char>, IDog, IFoo<IFoo<int>> + { [Kept] public int Field1; @@ -37,25 +40,30 @@ namespace Mono.Linker.Tests.Cases.LinkXml int IFoo<IFoo<int>>.Bar { get; set; } } - interface IDog { + interface IDog + { string Name { get; set; } } [Kept] - interface IFoo<T> { + interface IFoo<T> + { int Bar { get; set; } } - interface IFoo2<T> { + interface IFoo2<T> + { int Bar2 { get; set; } } - interface IFoo3<T, K, J> { + interface IFoo3<T, K, J> + { int Bar3 { get; set; } } - class Cat { + class Cat + { } } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.cs index fb8536a2f..339cc5e49 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.cs @@ -1,15 +1,18 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { +namespace Mono.Linker.Tests.Cases.LinkXml +{ [KeptMember (".ctor()")] - public class UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved { + public class UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved + { public static void Main () { } [Kept] [KeptMember (".ctor()")] - class Unused { + class Unused + { } } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedEventPreservedByLinkXmlIsKept.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedEventPreservedByLinkXmlIsKept.cs index b953fdcea..ae02f1ef5 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedEventPreservedByLinkXmlIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedEventPreservedByLinkXmlIsKept.cs @@ -2,8 +2,10 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedEventPreservedByLinkXmlIsKept { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class UnusedEventPreservedByLinkXmlIsKept + { public static void Main () { new Unused (); // Used to avoid lazy body marking @@ -11,7 +13,8 @@ namespace Mono.Linker.Tests.Cases.LinkXml { [Kept] [KeptMember (".ctor()")] - class Unused { + class Unused + { [Kept] [KeptBackingField] [KeptEventAddMethod] diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedFieldPreservedByLinkXmlIsKept.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedFieldPreservedByLinkXmlIsKept.cs index d41e23716..b3f3b2508 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedFieldPreservedByLinkXmlIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedFieldPreservedByLinkXmlIsKept.cs @@ -1,14 +1,17 @@ using System.Collections.Generic; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedFieldPreservedByLinkXmlIsKept { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class UnusedFieldPreservedByLinkXmlIsKept + { public static void Main () { } [Kept] - class Unused { + class Unused + { [Kept] private int _preserved; @@ -22,7 +25,8 @@ namespace Mono.Linker.Tests.Cases.LinkXml { } [Kept] - class UnusedWithGenerics<T> { + class UnusedWithGenerics<T> + { [Kept] private List<T> _preserved1; } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedGenericTypeWithPreserveAllHasAllMembersPreserved.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedGenericTypeWithPreserveAllHasAllMembersPreserved.cs index 659d4c5d1..24a0f4b30 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedGenericTypeWithPreserveAllHasAllMembersPreserved.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedGenericTypeWithPreserveAllHasAllMembersPreserved.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - public class UnusedGenericTypeWithPreserveAllHasAllMembersPreserved { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + public class UnusedGenericTypeWithPreserveAllHasAllMembersPreserved + { public static void Main () { } [Kept] [KeptMember (".ctor()")] - class Unused<T1, T2, T3> { + class Unused<T1, T2, T3> + { [Kept] public int Field1; @@ -29,7 +32,7 @@ namespace Mono.Linker.Tests.Cases.LinkXml { [Kept] [KeptBackingField] - public string Property1 { [Kept] get; [Kept] set;} + public string Property1 { [Kept] get; [Kept] set; } [Kept] [KeptBackingField] diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedInterfaceTypeOnTypeWithPreserveAllIsKept.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedInterfaceTypeOnTypeWithPreserveAllIsKept.cs index 8e362a4d8..749bebc64 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedInterfaceTypeOnTypeWithPreserveAllIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedInterfaceTypeOnTypeWithPreserveAllIsKept.cs @@ -1,19 +1,23 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - public class UnusedInterfaceTypeOnTypeWithPreserveAllIsKept { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + public class UnusedInterfaceTypeOnTypeWithPreserveAllIsKept + { public static void Main () { } [Kept] - interface IFoo { + interface IFoo + { } - + [Kept] [KeptMember (".ctor()")] [KeptInterface (typeof (IFoo))] - class Bar : IFoo { + class Bar : IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedInterfaceTypeOnTypeWithPreserveNothingIsRemoved.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedInterfaceTypeOnTypeWithPreserveNothingIsRemoved.cs index 968d0d1e6..f87deab6a 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedInterfaceTypeOnTypeWithPreserveNothingIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedInterfaceTypeOnTypeWithPreserveNothingIsRemoved.cs @@ -1,16 +1,20 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - public class UnusedInterfaceTypeOnTypeWithPreserveNothingIsRemoved { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + public class UnusedInterfaceTypeOnTypeWithPreserveNothingIsRemoved + { public static void Main () { } - interface IFoo { + interface IFoo + { } - + [Kept] - class Bar : IFoo { + class Bar : IFoo + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedMethodPreservedByLinkXmlIsKept.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedMethodPreservedByLinkXmlIsKept.cs index 123afb937..3cfc293cd 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedMethodPreservedByLinkXmlIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedMethodPreservedByLinkXmlIsKept.cs @@ -1,14 +1,17 @@ using System.Collections.Generic; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedMethodPreservedByLinkXmlIsKept { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class UnusedMethodPreservedByLinkXmlIsKept + { public static void Main () { } [Kept] - class Unused { + class Unused + { [Kept] private void PreservedMethod () { @@ -34,7 +37,7 @@ namespace Mono.Linker.Tests.Cases.LinkXml { } [Kept] - private void PreservedMethod5<T>(T arg) + private void PreservedMethod5<T> (T arg) { } } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedNestedTypePreservedByLinkXmlIsKept.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedNestedTypePreservedByLinkXmlIsKept.cs index 5e319acfd..bdf36cf2b 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedNestedTypePreservedByLinkXmlIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedNestedTypePreservedByLinkXmlIsKept.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedNestedTypePreservedByLinkXmlIsKept { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class UnusedNestedTypePreservedByLinkXmlIsKept + { public static void Main () { } [Kept] [KeptMember (".ctor()")] - class Unused { + class Unused + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedNonRequiredTypeIsRemoved.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedNonRequiredTypeIsRemoved.cs index 8175ee32e..ca988955a 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedNonRequiredTypeIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedNonRequiredTypeIsRemoved.cs @@ -1,10 +1,13 @@ -namespace Mono.Linker.Tests.Cases.LinkXml { - public class UnusedNonRequiredTypeIsRemoved { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + public class UnusedNonRequiredTypeIsRemoved + { public static void Main () { } - class Unused { + class Unused + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedPropertyPreservedByLinkXmlIsKept.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedPropertyPreservedByLinkXmlIsKept.cs index 8d3bb6372..4c6c9834b 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedPropertyPreservedByLinkXmlIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedPropertyPreservedByLinkXmlIsKept.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedPropertyPreservedByLinkXmlIsKept { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class UnusedPropertyPreservedByLinkXmlIsKept + { public static void Main () { new Unused (); // Used to avoid lazy body marking @@ -9,7 +11,8 @@ namespace Mono.Linker.Tests.Cases.LinkXml { [Kept] [KeptMember (".ctor()")] - class Unused { + class Unused + { [Kept] [KeptBackingField] public int PreservedProperty1 { [Kept] get; [Kept] set; } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeDeclarationPreservedByLinkXmlIsKept.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeDeclarationPreservedByLinkXmlIsKept.cs index bd2b15ba3..e5c18215d 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeDeclarationPreservedByLinkXmlIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeDeclarationPreservedByLinkXmlIsKept.cs @@ -1,8 +1,10 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - public class UnusedTypeDeclarationPreservedByLinkXmlIsKept { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + public class UnusedTypeDeclarationPreservedByLinkXmlIsKept + { public static void Main () { } @@ -10,14 +12,14 @@ namespace Mono.Linker.Tests.Cases.LinkXml { [Kept] [KeptBaseType (typeof (UnusedTypeDeclarationPreservedByLinkXmlIsKeptUnusedTypeBase))] - class UnusedTypeDeclarationPreservedByLinkXmlIsKeptUnusedType : UnusedTypeDeclarationPreservedByLinkXmlIsKeptUnusedTypeBase + class UnusedTypeDeclarationPreservedByLinkXmlIsKeptUnusedType : UnusedTypeDeclarationPreservedByLinkXmlIsKeptUnusedTypeBase { int field; static void Method () { } - string Prop { get; set; } + string Prop { get; set; } } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.cs index 246c80af6..35297246d 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.cs @@ -1,16 +1,19 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { +namespace Mono.Linker.Tests.Cases.LinkXml +{ - [KeptMember(".ctor()")] - class UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved { + [KeptMember (".ctor()")] + class UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved + { public static void Main () { } [Kept] [KeptMember (".ctor()")] - class Unused { + class Unused + { [Kept] void Foo () { diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlIsKept.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlIsKept.cs index edaff63eb..bc6d19205 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlIsKept.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypePreservedByLinkXmlIsKept { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class UnusedTypePreservedByLinkXmlIsKept + { public static void Main () { } @@ -9,6 +11,7 @@ namespace Mono.Linker.Tests.Cases.LinkXml { [Kept] [KeptMember (".ctor()")] - class UnusedTypePreservedByLinkXmlIsKeptUnusedType { + class UnusedTypePreservedByLinkXmlIsKeptUnusedType + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlWithCommentIsKept.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlWithCommentIsKept.cs index fe077d530..08d9da69d 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlWithCommentIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlWithCommentIsKept.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypePreservedByLinkXmlWithCommentIsKept { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class UnusedTypePreservedByLinkXmlWithCommentIsKept + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.cs index 840d7f474..503e2e011 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.cs @@ -1,6 +1,7 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { +namespace Mono.Linker.Tests.Cases.LinkXml +{ class UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved { public static void Main () @@ -9,7 +10,8 @@ namespace Mono.Linker.Tests.Cases.LinkXml { [Kept] [KeptMember (".ctor()")] - class Unused { + class Unused + { [Kept] public int Field1; @@ -30,7 +32,7 @@ namespace Mono.Linker.Tests.Cases.LinkXml { [Kept] [KeptBackingField] - public string Property1 { [Kept] get; [Kept] set;} + public string Property1 { [Kept] get; [Kept] set; } [Kept] [KeptBackingField] diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveAllHasAllMembersPreserved.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveAllHasAllMembersPreserved.cs index 02fb956f2..f3941efe4 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveAllHasAllMembersPreserved.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveAllHasAllMembersPreserved.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypeWithPreserveAllHasAllMembersPreserved { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class UnusedTypeWithPreserveAllHasAllMembersPreserved + { public static void Main () { } [Kept] [KeptMember (".ctor()")] - class Unused { + class Unused + { [Kept] public int Field1; @@ -29,7 +32,7 @@ namespace Mono.Linker.Tests.Cases.LinkXml { [Kept] [KeptBackingField] - public string Property1 { [Kept] get; [Kept] set;} + public string Property1 { [Kept] get; [Kept] set; } [Kept] [KeptBackingField] diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveFieldsHasMethodsRemoved.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveFieldsHasMethodsRemoved.cs index 1af6f4530..43abdce1e 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveFieldsHasMethodsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveFieldsHasMethodsRemoved.cs @@ -1,13 +1,16 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypeWithPreserveFieldsHasMethodsRemoved { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class UnusedTypeWithPreserveFieldsHasMethodsRemoved + { public static void Main () { } [Kept] - class Unused { + class Unused + { [Kept] public int Field1; diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveMethodsHasFieldsRemoved.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveMethodsHasFieldsRemoved.cs index 8a79d2d2b..bcc7e36a9 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveMethodsHasFieldsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveMethodsHasFieldsRemoved.cs @@ -1,14 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypeWithPreserveMethodsHasFieldsRemoved { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class UnusedTypeWithPreserveMethodsHasFieldsRemoved + { public static void Main () { } [Kept] [KeptMember (".ctor()")] - class Unused { + class Unused + { public int Field1; private int Field2; internal int Field3; diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingAndPreserveMembers.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingAndPreserveMembers.cs index b9d404f22..be91373c1 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingAndPreserveMembers.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingAndPreserveMembers.cs @@ -1,13 +1,16 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypeWithPreserveNothingAndPreserveMembers { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class UnusedTypeWithPreserveNothingAndPreserveMembers + { public static void Main () { } [Kept] - class Unused { + class Unused + { [Kept] public int Field1; diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingHasMembersRemoved.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingHasMembersRemoved.cs index d6ea29b89..053ba52c0 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingHasMembersRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingHasMembersRemoved.cs @@ -1,13 +1,16 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypeWithPreserveNothingHasMembersRemoved { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class UnusedTypeWithPreserveNothingHasMembersRemoved + { public static void Main () { } [Kept] - class Unused { + class Unused + { public int Field1; private int Field2; internal int Field3; diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UsedNonRequiredTypeIsKept.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UsedNonRequiredTypeIsKept.cs index 37cce219c..7e2272512 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UsedNonRequiredTypeIsKept.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UsedNonRequiredTypeIsKept.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - public class UsedNonRequiredTypeIsKept { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + public class UsedNonRequiredTypeIsKept + { public static void Main () { var tmp = typeof (Used1).ToString (); @@ -9,7 +11,8 @@ namespace Mono.Linker.Tests.Cases.LinkXml { tmp = typeof (Used3).ToString (); } - class Used1 { + class Used1 + { [Kept] public int field; @@ -21,7 +24,8 @@ namespace Mono.Linker.Tests.Cases.LinkXml { } [KeptMember (".ctor()")] - class Used2 { + class Used2 + { public int field; [Kept] @@ -35,7 +39,8 @@ namespace Mono.Linker.Tests.Cases.LinkXml { } [KeptMember (".ctor()")] - class Used3 { + class Used3 + { [Kept] public int field; diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/UsedNonRequiredTypeIsKeptWithSingleMethod.cs b/test/Mono.Linker.Tests.Cases/LinkXml/UsedNonRequiredTypeIsKeptWithSingleMethod.cs index 916488183..56f36d2df 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/UsedNonRequiredTypeIsKeptWithSingleMethod.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/UsedNonRequiredTypeIsKeptWithSingleMethod.cs @@ -1,8 +1,10 @@ using System.Collections.Generic; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.LinkXml { - class UsedNonRequiredTypeIsKeptWithSingleMethod { +namespace Mono.Linker.Tests.Cases.LinkXml +{ + class UsedNonRequiredTypeIsKeptWithSingleMethod + { public static void Main () { var t = typeof (Unused); diff --git a/test/Mono.Linker.Tests.Cases/Logging/Dependencies/LogStep.cs b/test/Mono.Linker.Tests.Cases/Logging/Dependencies/LogStep.cs index e4a10379b..63b429e80 100644 --- a/test/Mono.Linker.Tests.Cases/Logging/Dependencies/LogStep.cs +++ b/test/Mono.Linker.Tests.Cases/Logging/Dependencies/LogStep.cs @@ -6,10 +6,10 @@ namespace Log { public class LogStep : IStep { - public void Process(LinkContext context) + public void Process (LinkContext context) { var msgError = MessageContainer.CreateErrorMessage ("Error", 1004); - var msgWarning = MessageContainer.CreateWarningMessage("Warning", 2001, origin: new MessageOrigin("logtest", 1, 1)); + var msgWarning = MessageContainer.CreateWarningMessage ("Warning", 2001, origin: new MessageOrigin ("logtest", 1, 1)); var msgInfo = MessageContainer.CreateInfoMessage ("Info"); var msgDiagnostics = MessageContainer.CreateDiagnosticMessage ("Diagnostics"); context.LogMessage (msgError); diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyAttribute.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyAttribute.cs index 33ccf1787..09f7543d3 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyAttribute.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyAttribute.cs @@ -26,9 +26,11 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -namespace System.Runtime.CompilerServices { +namespace System.Runtime.CompilerServices +{ [AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Field, AllowMultiple = true)] - public sealed class PreserveDependencyAttribute : Attribute { + public sealed class PreserveDependencyAttribute : Attribute + { public PreserveDependencyAttribute (string memberSignature) { } diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyInCopyAssembly.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyInCopyAssembly.cs index 274675630..610cf81a5 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyInCopyAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyInCopyAssembly.cs @@ -6,8 +6,8 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies public class PreserveDependencyInCopyAssembly { [PreserveDependency ("ExtraMethod1")] - public PreserveDependencyInCopyAssembly() - { + public PreserveDependencyInCopyAssembly () + { } static void ExtraMethod1 () diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInAssemblyLibrary.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInAssemblyLibrary.cs index 8b321a355..5f4f35908 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInAssemblyLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInAssemblyLibrary.cs @@ -1,6 +1,8 @@ using System; -namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies { - public class PreserveDependencyMethodInAssemblyLibrary { +namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies +{ + public class PreserveDependencyMethodInAssemblyLibrary + { public PreserveDependencyMethodInAssemblyLibrary () { } diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs index b64962a85..e76e70c04 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies { - public abstract class PreserveDependencyMethodInNonReferencedAssemblyBase { +namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies +{ + public abstract class PreserveDependencyMethodInNonReferencedAssemblyBase + { public abstract string Method (); } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase2.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase2.cs index d5f7883ad..0ead25809 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase2.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase2.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies { - public class PreserveDependencyMethodInNonReferencedAssemblyBase2 : PreserveDependencyMethodInNonReferencedAssemblyBase { +namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies +{ + public class PreserveDependencyMethodInNonReferencedAssemblyBase2 : PreserveDependencyMethodInNonReferencedAssemblyBase + { public override string Method () { return "Base2"; diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs index 6909b63d9..69897dc76 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs @@ -1,13 +1,15 @@ using System.Runtime.CompilerServices; -namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies { - public class PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary : PreserveDependencyMethodInNonReferencedAssemblyBase { +namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies +{ + public class PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary : PreserveDependencyMethodInNonReferencedAssemblyBase + { public override string Method () { Dependency (); return "Dependency"; } - + [PreserveDependency (".ctor()", "Mono.Linker.Tests.Cases.Advanced.Dependencies.PreserveDependencyMethodInNonReferencedAssemblyBase2", "base2")] public static void Dependency () { diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary.cs index 6a796ada6..58492f960 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary.cs @@ -1,9 +1,11 @@ -namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies { - public class PreserveDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary : PreserveDependencyMethodInNonReferencedAssemblyBase { +namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies +{ + public class PreserveDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary : PreserveDependencyMethodInNonReferencedAssemblyBase + { public override string Method () { PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.Dependency (); return "Dependency"; - } + } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.cs index 57b5bc788..0a12dbbf1 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies { - public class PreserveDependencyMethodInNonReferencedAssemblyLibrary : PreserveDependencyMethodInNonReferencedAssemblyBase { +namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies +{ + public class PreserveDependencyMethodInNonReferencedAssemblyLibrary : PreserveDependencyMethodInNonReferencedAssemblyBase + { public override string Method () { return "Dependency"; diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction_Lib.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction_Lib.cs index 222887fbc..62b050213 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction_Lib.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/Dependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction_Lib.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies { - public class PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction_Lib { +namespace Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies +{ + public class PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction_Lib + { public static void MethodPreservedViaDependencyAttribute () { } diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyField.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyField.cs index 1d2289459..ea451e812 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyField.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyField.cs @@ -2,9 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.PreserveDependencies { - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "Dependencies/PreserveDependencyAttribute.cs" })] - public class PreserveDependencyField { +namespace Mono.Linker.Tests.Cases.PreserveDependencies +{ + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] + public class PreserveDependencyField + { public static void Main () { var b = new B (); @@ -12,7 +14,8 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies { } [KeptMember (".ctor()")] - class B { + class B + { [Kept] [PreserveDependency ("ExtraMethod1")] public int field; diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyFromCopiedAssembly.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyFromCopiedAssembly.cs index 2c1a49192..78e896cd3 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyFromCopiedAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyFromCopiedAssembly.cs @@ -2,10 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies; -namespace Mono.Linker.Tests.Cases.PreserveDependencies { +namespace Mono.Linker.Tests.Cases.PreserveDependencies +{ [SetupLinkerAction ("copy", "lib")] - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "Dependencies/PreserveDependencyAttribute.cs" })] - [SetupCompileBefore ("lib.dll", new [] { "Dependencies/PreserveDependencyInCopyAssembly.cs" }, new [] { "FakeSystemAssembly.dll" })] + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] + [SetupCompileBefore ("lib.dll", new[] { "Dependencies/PreserveDependencyInCopyAssembly.cs" }, new[] { "FakeSystemAssembly.dll" })] [KeptAllTypesAndMembersInAssembly ("lib.dll")] public class PreserveDependencyFromCopiedAssembly { diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyKeptOption.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyKeptOption.cs index 0ef4170d8..cc46a7fb6 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyKeptOption.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyKeptOption.cs @@ -4,9 +4,9 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.PreserveDependencies { - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "Dependencies/PreserveDependencyAttribute.cs" })] + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] [SetupLinkerArgument ("--keep-dep-attributes", "true")] - [KeptTypeInAssembly("FakeSystemAssembly.dll", typeof(PreserveDependencyAttribute))] + [KeptTypeInAssembly ("FakeSystemAssembly.dll", typeof (PreserveDependencyAttribute))] class PreserveDependencyKeptOption { public static void Main () diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMemberSignatureWildcard.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMemberSignatureWildcard.cs index d61b14ea5..61d9d4d76 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMemberSignatureWildcard.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMemberSignatureWildcard.cs @@ -6,8 +6,8 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies { [KeptMemberInAssembly ("library.dll", "Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies.PreserveDependencyMethodInAssemblyLibrary", ".ctor()")] [KeptMemberInAssembly ("library.dll", "Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies.PreserveDependencyMethodInAssemblyLibrary", "Foo()")] - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "Dependencies/PreserveDependencyAttribute.cs" })] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/PreserveDependencyMethodInAssemblyLibrary.cs" }, new [] { "FakeSystemAssembly.dll" })] + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/PreserveDependencyMethodInAssemblyLibrary.cs" }, new[] { "FakeSystemAssembly.dll" })] public class PreserveDependencyMemberSignatureWildcard { public static void Main () diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethod.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethod.cs index 71702011f..c34ec6842 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethod.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethod.cs @@ -2,20 +2,22 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.PreserveDependencies { - - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "Dependencies/PreserveDependencyAttribute.cs" })] - [LogContains("Could not resolve 'Mono.Linker.Tests.Cases.PreserveDependencies.MissingType' type dependency")] - [LogContains("Could not resolve dependency member 'MissingMethod' declared in type 'Mono.Linker.Tests.Cases.PreserveDependencies.C'")] - [LogContains("Could not resolve dependency member 'Dependency2`1' declared in type 'Mono.Linker.Tests.Cases.PreserveDependencies.C'")] - [LogContains("Could not resolve dependency member '' declared in type 'Mono.Linker.Tests.Cases.PreserveDependencies.PreserveDependencyMethod/B'")] - [LogContains("Could not resolve dependency member '.ctor' declared in type 'Mono.Linker.Tests.Cases.PreserveDependencies.PreserveDependencyMethod/NestedStruct'")] - [LogContains("Could not resolve dependency member '.cctor' declared in type 'Mono.Linker.Tests.Cases.PreserveDependencies.C'")] - class PreserveDependencyMethod { +namespace Mono.Linker.Tests.Cases.PreserveDependencies +{ + + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] + [LogContains ("Could not resolve 'Mono.Linker.Tests.Cases.PreserveDependencies.MissingType' type dependency")] + [LogContains ("Could not resolve dependency member 'MissingMethod' declared in type 'Mono.Linker.Tests.Cases.PreserveDependencies.C'")] + [LogContains ("Could not resolve dependency member 'Dependency2`1' declared in type 'Mono.Linker.Tests.Cases.PreserveDependencies.C'")] + [LogContains ("Could not resolve dependency member '' declared in type 'Mono.Linker.Tests.Cases.PreserveDependencies.PreserveDependencyMethod/B'")] + [LogContains ("Could not resolve dependency member '.ctor' declared in type 'Mono.Linker.Tests.Cases.PreserveDependencies.PreserveDependencyMethod/NestedStruct'")] + [LogContains ("Could not resolve dependency member '.cctor' declared in type 'Mono.Linker.Tests.Cases.PreserveDependencies.C'")] + class PreserveDependencyMethod + { public static void Main () { new B (); // Needed to avoid lazy body marking stubbing - + B.Method (); B.SameContext (); B.Broken (); @@ -80,7 +82,7 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies { } [Kept] - static Nested() + static Nested () { } diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInAssembly.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInAssembly.cs index 45358f0f5..c41022d9d 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInAssembly.cs @@ -5,8 +5,8 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.PreserveDependencies { [KeptMemberInAssembly ("library.dll", "Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies.PreserveDependencyMethodInAssemblyLibrary", ".ctor()")] - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "Dependencies/PreserveDependencyAttribute.cs" })] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/PreserveDependencyMethodInAssemblyLibrary.cs" }, new [] { "FakeSystemAssembly.dll" })] + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/PreserveDependencyMethodInAssemblyLibrary.cs" }, new[] { "FakeSystemAssembly.dll" })] public class PreserveDependencyMethodInAssembly { public static void Main () diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssembly.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssembly.cs index c9424f893..a035815ea 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssembly.cs @@ -3,15 +3,17 @@ using Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.PreserveDependencies { - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "Dependencies/PreserveDependencyAttribute.cs" })] - [SetupCompileBefore ("base.dll", new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.cs" }, references: new [] { "base.dll" }, addAsReference: false)] +namespace Mono.Linker.Tests.Cases.PreserveDependencies +{ + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] + [SetupCompileBefore ("base.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.cs" }, references: new[] { "base.dll" }, addAsReference: false)] [KeptAssembly ("base.dll")] [KeptAssembly ("library.dll")] [KeptMemberInAssembly ("base.dll", typeof (PreserveDependencyMethodInNonReferencedAssemblyBase), "Method()")] [KeptMemberInAssembly ("library.dll", "Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies.PreserveDependencyMethodInNonReferencedAssemblyLibrary", "Method()")] - public class PreserveDependencyMethodInNonReferencedAssembly { + public class PreserveDependencyMethodInNonReferencedAssembly + { public static void Main () { var obj = new Foo (); @@ -28,7 +30,8 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (PreserveDependencyMethodInNonReferencedAssemblyBase))] - class Foo : PreserveDependencyMethodInNonReferencedAssemblyBase { + class Foo : PreserveDependencyMethodInNonReferencedAssemblyBase + { [Kept] public override string Method () { diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChained.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChained.cs index 52eb8334c..9ae7a5973 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChained.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChained.cs @@ -3,19 +3,21 @@ using Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.PreserveDependencies { +namespace Mono.Linker.Tests.Cases.PreserveDependencies +{ [IgnoreTestCase ("Currently failing")] - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "Dependencies/PreserveDependencyAttribute.cs" })] - [SetupCompileBefore ("base.dll", new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] - [SetupCompileBefore ("base2.dll", new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase2.cs" }, references: new [] { "base.dll" }, addAsReference: false)] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs" }, references: new [] { "base.dll" }, addAsReference: false)] + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] + [SetupCompileBefore ("base.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] + [SetupCompileBefore ("base2.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase2.cs" }, references: new[] { "base.dll" }, addAsReference: false)] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs" }, references: new[] { "base.dll" }, addAsReference: false)] [KeptAssembly ("base.dll")] [KeptAssembly ("base2.dll")] [KeptAssembly ("library.dll")] [KeptMemberInAssembly ("base.dll", typeof (PreserveDependencyMethodInNonReferencedAssemblyBase), "Method()")] [KeptMemberInAssembly ("base2.dll", "Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies.PreserveDependencyMethodInNonReferencedAssemblyBase2", "Method()")] [KeptMemberInAssembly ("library.dll", "Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies.PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary", "Method()")] - public class PreserveDependencyMethodInNonReferencedAssemblyChained { + public class PreserveDependencyMethodInNonReferencedAssemblyChained + { public static void Main () { var obj = new Foo (); @@ -32,7 +34,8 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (PreserveDependencyMethodInNonReferencedAssemblyBase))] - class Foo : PreserveDependencyMethodInNonReferencedAssemblyBase { + class Foo : PreserveDependencyMethodInNonReferencedAssemblyBase + { [Kept] public override string Method () { diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReference.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReference.cs index b51e2e286..b447360fb 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReference.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReference.cs @@ -3,13 +3,14 @@ using Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.PreserveDependencies { +namespace Mono.Linker.Tests.Cases.PreserveDependencies +{ [IgnoreTestCase ("Currently failing")] - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "Dependencies/PreserveDependencyAttribute.cs" })] - [SetupCompileBefore ("base.dll", new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] - [SetupCompileBefore ("base2.dll", new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase2.cs" }, references: new [] { "base.dll" }, addAsReference: false)] - [SetupCompileBefore ("reference.dll", new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs" }, references: new [] { "base.dll" }, addAsReference: false)] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary.cs" }, references: new [] { "base.dll", "reference.dll" }, addAsReference: false)] + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] + [SetupCompileBefore ("base.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] + [SetupCompileBefore ("base2.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase2.cs" }, references: new[] { "base.dll" }, addAsReference: false)] + [SetupCompileBefore ("reference.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary.cs" }, references: new[] { "base.dll" }, addAsReference: false)] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary.cs" }, references: new[] { "base.dll", "reference.dll" }, addAsReference: false)] [KeptAssembly ("base.dll")] [KeptAssembly ("base2.dll")] [KeptAssembly ("library.dll")] @@ -18,14 +19,15 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies { [KeptMemberInAssembly ("base2.dll", "Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies.PreserveDependencyMethodInNonReferencedAssemblyBase2", "Method()")] [KeptMemberInAssembly ("library.dll", "Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies.PreserveDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary", "Method()")] [KeptMemberInAssembly ("reference.dll", "Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies.PreserveDependencyMethodInNonReferencedAssemblyChainedLibrary", "Method()")] - public class PreserveDependencyMethodInNonReferencedAssemblyChainedReference { + public class PreserveDependencyMethodInNonReferencedAssemblyChainedReference + { public static void Main () { var obj = new Foo (); var val = obj.Method (); Dependency (); } - + [Kept] [PreserveDependency (".ctor()", "Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies.PreserveDependencyMethodInNonReferencedAssemblyChainedReferenceLibrary", "library")] static void Dependency () @@ -35,7 +37,8 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (PreserveDependencyMethodInNonReferencedAssemblyBase))] - class Foo : PreserveDependencyMethodInNonReferencedAssemblyBase { + class Foo : PreserveDependencyMethodInNonReferencedAssemblyBase + { [Kept] public override string Method () { diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyWithEmbeddedXml.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyWithEmbeddedXml.cs index 5577e1cf9..6e93a8edc 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyWithEmbeddedXml.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyWithEmbeddedXml.cs @@ -3,22 +3,24 @@ using Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.PreserveDependencies { +namespace Mono.Linker.Tests.Cases.PreserveDependencies +{ /// <summary> /// This is an acceptable bug with the currently implementation. Embedded link xml files will not be processed /// </summary> [IncludeBlacklistStep (true)] - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "Dependencies/PreserveDependencyAttribute.cs" })] - [SetupCompileBefore ("base.dll", new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] + [SetupCompileBefore ("base.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] [SetupCompileBefore ( "PreserveDependencyMethodInNonReferencedAssemblyLibrary.dll", - new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.cs" }, - references: new [] { "base.dll" }, - resources: new [] {"Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.xml"}, + new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.cs" }, + references: new[] { "base.dll" }, + resources: new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.xml" }, addAsReference: false)] [KeptAssembly ("base.dll")] [RemovedMemberInAssembly ("PreserveDependencyMethodInNonReferencedAssemblyLibrary.dll", "Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies.PreserveDependencyMethodInNonReferencedAssemblyLibrary", "UnusedMethod()")] - public class PreserveDependencyMethodInNonReferencedAssemblyWithEmbeddedXml { + public class PreserveDependencyMethodInNonReferencedAssemblyWithEmbeddedXml + { public static void Main () { var obj = new Foo (); @@ -35,7 +37,8 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (PreserveDependencyMethodInNonReferencedAssemblyBase))] - class Foo : PreserveDependencyMethodInNonReferencedAssemblyBase { + class Foo : PreserveDependencyMethodInNonReferencedAssemblyBase + { [Kept] public override string Method () { diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssembly.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssembly.cs index 0db5ae13f..3c74c120c 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssembly.cs @@ -3,14 +3,16 @@ using Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.PreserveDependencies { - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "Dependencies/PreserveDependencyAttribute.cs" })] - [SetupCompileBefore ("base.dll", new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.cs" }, references: new [] { "base.dll" }, addAsReference: false)] +namespace Mono.Linker.Tests.Cases.PreserveDependencies +{ + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] + [SetupCompileBefore ("base.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.cs" }, references: new[] { "base.dll" }, addAsReference: false)] [KeptAssembly ("base.dll")] [RemovedAssembly ("library.dll")] [KeptMemberInAssembly ("base.dll", typeof (PreserveDependencyMethodInNonReferencedAssemblyBase), "Method()")] - public class PreserveDependencyOnUnusedMethodInNonReferencedAssembly { + public class PreserveDependencyOnUnusedMethodInNonReferencedAssembly + { public static void Main () { var obj = new Foo (); @@ -25,7 +27,8 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (PreserveDependencyMethodInNonReferencedAssemblyBase))] - class Foo : PreserveDependencyMethodInNonReferencedAssemblyBase { + class Foo : PreserveDependencyMethodInNonReferencedAssemblyBase + { [Kept] public override string Method () { diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction.cs index 43c967899..f29043cb2 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction.cs @@ -2,12 +2,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.PreserveDependencies { +namespace Mono.Linker.Tests.Cases.PreserveDependencies +{ [SetupLinkerUserAction ("copyused")] - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "Dependencies/PreserveDependencyAttribute.cs" })] - [SetupCompileBefore ("library.dll", new [] {"Dependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction_Lib.cs"}, addAsReference: false)] + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction_Lib.cs" }, addAsReference: false)] [RemovedAssembly ("library.dll")] - public class PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction { + public class PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithCopyUsedAction + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithEmbeddedXml.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithEmbeddedXml.cs index 21e2ca7cc..c53d436af 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithEmbeddedXml.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithEmbeddedXml.cs @@ -3,22 +3,24 @@ using Mono.Linker.Tests.Cases.PreserveDependencies.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.PreserveDependencies { +namespace Mono.Linker.Tests.Cases.PreserveDependencies +{ /// <summary> /// This test is here to ensure that link xml embedded in an assembly used by a [PreserveDependency] is not processed if the dependency is not used /// </summary> [IncludeBlacklistStep (true)] - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "Dependencies/PreserveDependencyAttribute.cs" })] - [SetupCompileBefore ("base.dll", new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] + [SetupCompileBefore ("base.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] [SetupCompileBefore ( "PreserveDependencyMethodInNonReferencedAssemblyLibrary.dll", - new [] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.cs" }, - references: new [] { "base.dll" }, - resources: new [] {"Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.xml"}, + new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.cs" }, + references: new[] { "base.dll" }, + resources: new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyLibrary.xml" }, addAsReference: false)] [KeptAssembly ("base.dll")] [RemovedAssembly ("PreserveDependencyMethodInNonReferencedAssemblyLibrary.dll")] - public class PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithEmbeddedXml { + public class PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithEmbeddedXml + { public static void Main () { var obj = new Foo (); @@ -33,7 +35,8 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies { [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (PreserveDependencyMethodInNonReferencedAssemblyBase))] - class Foo : PreserveDependencyMethodInNonReferencedAssemblyBase { + class Foo : PreserveDependencyMethodInNonReferencedAssemblyBase + { [Kept] public override string Method () { diff --git a/test/Mono.Linker.Tests.Cases/References/AssemblyOnlyUsedByUsingWithCsc.cs b/test/Mono.Linker.Tests.Cases/References/AssemblyOnlyUsedByUsingWithCsc.cs index 32ef0a3c6..bb7141228 100644 --- a/test/Mono.Linker.Tests.Cases/References/AssemblyOnlyUsedByUsingWithCsc.cs +++ b/test/Mono.Linker.Tests.Cases/References/AssemblyOnlyUsedByUsingWithCsc.cs @@ -2,29 +2,31 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.References.Dependencies; -namespace Mono.Linker.Tests.Cases.References { +namespace Mono.Linker.Tests.Cases.References +{ /// <summary> /// We can't detect the using usage in the assembly. As a result, nothing in `library` is going to be marked and that assembly will be deleted. /// Because of that, `copied` needs to have it's reference to `library` removed even though we specified an assembly action of `copy` /// </summary> [SetupLinkerAction ("copy", "copied")] [SetupLinkerArgument ("--keep-facades", "false")] - [SetupCompileBefore ("library.dll", new [] {"Dependencies/AssemblyOnlyUsedByUsing_Lib.cs"})] - + [SetupCompileBefore ("library.dll", new[] { "Dependencies/AssemblyOnlyUsedByUsing_Lib.cs" })] + // When csc is used, `copied.dll` will have a reference to `library.dll` - [SetupCompileBefore ("copied.dll", new [] {"Dependencies/AssemblyOnlyUsedByUsing_Copied.cs"}, new [] {"library.dll"}, compilerToUse: "csc")] + [SetupCompileBefore ("copied.dll", new[] { "Dependencies/AssemblyOnlyUsedByUsing_Copied.cs" }, new[] { "library.dll" }, compilerToUse: "csc")] // Here to assert that the test is setup correctly to copy the copied assembly. This is an important aspect of the bug [KeptMemberInAssembly ("copied.dll", typeof (AssemblyOnlyUsedByUsing_Copied), "Unused()")] - + // We library should be gone. The `using` statement leaves no traces in the IL so nothing in `library` will be marked [RemovedAssembly ("library.dll")] #if NETCOREAPP [KeptReferencesInAssembly ("copied.dll", new [] {"System.Private.CoreLib"})] #else - [KeptReferencesInAssembly ("copied.dll", new [] {"mscorlib"})] + [KeptReferencesInAssembly ("copied.dll", new[] { "mscorlib" })] #endif - public class AssemblyOnlyUsedByUsingWithCsc { + public class AssemblyOnlyUsedByUsingWithCsc + { public static void Main () { // Use something to keep the reference at compile time diff --git a/test/Mono.Linker.Tests.Cases/References/AssemblyOnlyUsedByUsingWithCscWithKeepFacades.cs b/test/Mono.Linker.Tests.Cases/References/AssemblyOnlyUsedByUsingWithCscWithKeepFacades.cs index b55f738dd..27deb8bf7 100644 --- a/test/Mono.Linker.Tests.Cases/References/AssemblyOnlyUsedByUsingWithCscWithKeepFacades.cs +++ b/test/Mono.Linker.Tests.Cases/References/AssemblyOnlyUsedByUsingWithCscWithKeepFacades.cs @@ -2,7 +2,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.References.Dependencies; -namespace Mono.Linker.Tests.Cases.References { +namespace Mono.Linker.Tests.Cases.References +{ /// <summary> /// We can't detect the using usage in the assembly. As a result, nothing in `library` is going to be marked and that assembly will be deleted. /// Because of that, `copied` needs to have it's reference to `library` removed even though we specified an assembly action of `copy` @@ -11,22 +12,23 @@ namespace Mono.Linker.Tests.Cases.References { // --keep-facades sends the sweep step down a different code path that caused problems for this corner case [SetupLinkerArgument ("--keep-facades", "true")] - [SetupCompileBefore ("library.dll", new [] {"Dependencies/AssemblyOnlyUsedByUsing_Lib.cs"})] - + [SetupCompileBefore ("library.dll", new[] { "Dependencies/AssemblyOnlyUsedByUsing_Lib.cs" })] + // When csc is used, `copied.dll` will have a reference to `library.dll` - [SetupCompileBefore ("copied.dll", new [] {"Dependencies/AssemblyOnlyUsedByUsing_Copied.cs"}, new [] {"library.dll"}, compilerToUse: "csc")] + [SetupCompileBefore ("copied.dll", new[] { "Dependencies/AssemblyOnlyUsedByUsing_Copied.cs" }, new[] { "library.dll" }, compilerToUse: "csc")] // Here to assert that the test is setup correctly to copy the copied assembly. This is an important aspect of the bug [KeptMemberInAssembly ("copied.dll", typeof (AssemblyOnlyUsedByUsing_Copied), "Unused()")] - + // We library should be gone. The `using` statement leaves no traces in the IL so nothing in `library` will be marked [RemovedAssembly ("library.dll")] #if NETCOREAPP [KeptReferencesInAssembly ("copied.dll", new [] {"System.Private.CoreLib"})] #else - [KeptReferencesInAssembly ("copied.dll", new [] {"mscorlib"})] + [KeptReferencesInAssembly ("copied.dll", new[] { "mscorlib" })] #endif - public class AssemblyOnlyUsedByUsingWithCscWithKeepFacades { + public class AssemblyOnlyUsedByUsingWithCscWithKeepFacades + { public static void Main () { // Use something to keep the reference at compile time diff --git a/test/Mono.Linker.Tests.Cases/References/AssemblyOnlyUsedByUsingWithMcs.cs b/test/Mono.Linker.Tests.Cases/References/AssemblyOnlyUsedByUsingWithMcs.cs index ced6d4d39..bff891ee6 100644 --- a/test/Mono.Linker.Tests.Cases/References/AssemblyOnlyUsedByUsingWithMcs.cs +++ b/test/Mono.Linker.Tests.Cases/References/AssemblyOnlyUsedByUsingWithMcs.cs @@ -2,22 +2,24 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.References.Dependencies; -namespace Mono.Linker.Tests.Cases.References { +namespace Mono.Linker.Tests.Cases.References +{ #if NETCOREAPP [IgnoreTestCase ("Don't try to compile with mcs on .NET Core")] #endif [SetupLinkerAction ("copy", "copied")] - [SetupCompileBefore ("library.dll", new [] {"Dependencies/AssemblyOnlyUsedByUsing_Lib.cs"})] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/AssemblyOnlyUsedByUsing_Lib.cs" })] // When mcs is used, `copied.dll` will not have a reference to `library.dll` - [SetupCompileBefore ("copied.dll", new [] {"Dependencies/AssemblyOnlyUsedByUsing_Copied.cs"}, new [] {"library.dll"}, compilerToUse: "mcs")] + [SetupCompileBefore ("copied.dll", new[] { "Dependencies/AssemblyOnlyUsedByUsing_Copied.cs" }, new[] { "library.dll" }, compilerToUse: "mcs")] // Here to assert that the test is setup correctly to copy the copied assembly. This is an important aspect of the bug [KeptMemberInAssembly ("copied.dll", typeof (AssemblyOnlyUsedByUsing_Copied), "Unused()")] [RemovedAssembly ("library.dll")] - [KeptReferencesInAssembly ("copied.dll", new [] {"mscorlib"})] - public class AssemblyOnlyUsedByUsingWithMcs { + [KeptReferencesInAssembly ("copied.dll", new[] { "mscorlib" })] + public class AssemblyOnlyUsedByUsingWithMcs + { public static void Main () { // Use something to keep the reference at compile time diff --git a/test/Mono.Linker.Tests.Cases/References/CopyUsedAreKeptFully.cs b/test/Mono.Linker.Tests.Cases/References/CopyUsedAreKeptFully.cs index 418b56556..b36408df3 100644 --- a/test/Mono.Linker.Tests.Cases/References/CopyUsedAreKeptFully.cs +++ b/test/Mono.Linker.Tests.Cases/References/CopyUsedAreKeptFully.cs @@ -2,13 +2,14 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.References.Dependencies; -namespace Mono.Linker.Tests.Cases.References { +namespace Mono.Linker.Tests.Cases.References +{ // Actions: // link - This assembly // copyused - library1.dll [SetupLinkerUserAction ("copyused")] - [SetupCompileBefore ("library1.dll", new [] { "Dependencies/UserAssembliesAreLinkedByDefault_Library1.cs" })] + [SetupCompileBefore ("library1.dll", new[] { "Dependencies/UserAssembliesAreLinkedByDefault_Library1.cs" })] [KeptAssembly ("library1.dll")] [KeptMemberInAssembly ("library1.dll", typeof (UserAssembliesAreLinkedByDefault_Library1), "UsedMethod()")] diff --git a/test/Mono.Linker.Tests.Cases/References/CopyWithLinkedWillHaveAttributeDepsKept.cs b/test/Mono.Linker.Tests.Cases/References/CopyWithLinkedWillHaveAttributeDepsKept.cs index 9142959e3..7184ea0d1 100644 --- a/test/Mono.Linker.Tests.Cases/References/CopyWithLinkedWillHaveAttributeDepsKept.cs +++ b/test/Mono.Linker.Tests.Cases/References/CopyWithLinkedWillHaveAttributeDepsKept.cs @@ -3,10 +3,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.References.Dependencies; -namespace Mono.Linker.Tests.Cases.References { +namespace Mono.Linker.Tests.Cases.References +{ [SetupLinkerArgument ("--used-attrs-only", "true")] [SetupLinkerAction ("copy", "test")] - [SetupCompileBefore ("linked.dll", new [] {typeof (WithLinked_Attrs)})] + [SetupCompileBefore ("linked.dll", new[] { typeof (WithLinked_Attrs) })] [KeptMember (".ctor()")] [KeptMemberInAssembly ("linked.dll", typeof (WithLinked_Attrs.TypeAttribute), ".ctor()")] @@ -17,7 +18,8 @@ namespace Mono.Linker.Tests.Cases.References { [KeptMemberInAssembly ("linked.dll", typeof (WithLinked_Attrs.ParameterAttribute), ".ctor()")] [KeptTypeInAssembly ("linked.dll", typeof (WithLinked_Attrs.FooEnum))] [KeptTypeInAssembly ("linked.dll", typeof (WithLinked_Attrs.MethodWithEnumValueAttribute))] - public class CopyWithLinkedWillHaveAttributeDepsKept { + public class CopyWithLinkedWillHaveAttributeDepsKept + { public static void Main () { } @@ -26,7 +28,8 @@ namespace Mono.Linker.Tests.Cases.References { [KeptMember (".ctor()")] [KeptAttributeAttribute (typeof (WithLinked_Attrs.TypeAttribute))] [WithLinked_Attrs.Type] - class Foo { + class Foo + { [Kept] [KeptAttributeAttribute (typeof (WithLinked_Attrs.FieldAttribute))] [WithLinked_Attrs.Field] @@ -36,8 +39,7 @@ namespace Mono.Linker.Tests.Cases.References { [KeptBackingField] [KeptAttributeAttribute (typeof (WithLinked_Attrs.PropertyAttribute))] [WithLinked_Attrs.Property] - private static int Property - { + private static int Property { [Kept] get; [Kept] @@ -58,16 +60,16 @@ namespace Mono.Linker.Tests.Cases.References { static void Method () { } - + [Kept] - [KeptAttributeAttribute (typeof(WithLinked_Attrs.MethodWithEnumValueAttribute))] + [KeptAttributeAttribute (typeof (WithLinked_Attrs.MethodWithEnumValueAttribute))] [WithLinked_Attrs.MethodWithEnumValue (WithLinked_Attrs.FooEnum.Three, typeof (WithLinked_Attrs))] static void MethodWithEnum () { } - + [Kept] - static void MethodWithParameter([KeptAttributeAttribute (typeof (WithLinked_Attrs.ParameterAttribute))] [WithLinked_Attrs.Parameter] int arg) + static void MethodWithParameter ([KeptAttributeAttribute (typeof (WithLinked_Attrs.ParameterAttribute))] [WithLinked_Attrs.Parameter] int arg) { } } diff --git a/test/Mono.Linker.Tests.Cases/References/CopyWithLinkedWillHaveMethodDepsKept.cs b/test/Mono.Linker.Tests.Cases/References/CopyWithLinkedWillHaveMethodDepsKept.cs index 2ebb67291..5eb6b71ad 100644 --- a/test/Mono.Linker.Tests.Cases/References/CopyWithLinkedWillHaveMethodDepsKept.cs +++ b/test/Mono.Linker.Tests.Cases/References/CopyWithLinkedWillHaveMethodDepsKept.cs @@ -2,16 +2,18 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.References.Dependencies; -namespace Mono.Linker.Tests.Cases.References { +namespace Mono.Linker.Tests.Cases.References +{ [SetupCSharpCompilerToUse ("csc")] [SetupLinkerAction ("copy", "test")] - [SetupCompileBefore ("linked.dll", new [] {typeof (WithLinked_Methods)})] + [SetupCompileBefore ("linked.dll", new[] { typeof (WithLinked_Methods) })] [KeptMember (".ctor()")] [KeptMemberInAssembly ("linked.dll", typeof (WithLinked_Methods), nameof (WithLinked_Methods.UsedByPublic) + "()")] [KeptMemberInAssembly ("linked.dll", typeof (WithLinked_Methods), nameof (WithLinked_Methods.UsedByInternal) + "()")] [KeptMemberInAssembly ("linked.dll", typeof (WithLinked_Methods), nameof (WithLinked_Methods.UsedByPrivate) + "()")] - public class CopyWithLinkedWillHaveMethodDepsKept { + public class CopyWithLinkedWillHaveMethodDepsKept + { public static void Main () { } @@ -21,15 +23,15 @@ namespace Mono.Linker.Tests.Cases.References { { WithLinked_Methods.UsedByPublic (); } - + [Kept] internal static void UnusedInternal () { WithLinked_Methods.UsedByInternal (); } - + [Kept] - static void UnusedPrivate() + static void UnusedPrivate () { WithLinked_Methods.UsedByPrivate (); } diff --git a/test/Mono.Linker.Tests.Cases/References/Dependencies/AssemblyOnlyUsedByUsing_Copied.cs b/test/Mono.Linker.Tests.Cases/References/Dependencies/AssemblyOnlyUsedByUsing_Copied.cs index 31552b32c..caa846e82 100644 --- a/test/Mono.Linker.Tests.Cases/References/Dependencies/AssemblyOnlyUsedByUsing_Copied.cs +++ b/test/Mono.Linker.Tests.Cases/References/Dependencies/AssemblyOnlyUsedByUsing_Copied.cs @@ -3,8 +3,10 @@ // to this assembly because of this whereas mcs will not using ImportantForBug = Mono.Linker.Tests.Cases.References.Dependencies.AssemblyOnlyUsedByUsing_Lib; -namespace Mono.Linker.Tests.Cases.References.Dependencies { - public class AssemblyOnlyUsedByUsing_Copied { +namespace Mono.Linker.Tests.Cases.References.Dependencies +{ + public class AssemblyOnlyUsedByUsing_Copied + { public static void UsedToKeepReference () { } diff --git a/test/Mono.Linker.Tests.Cases/References/Dependencies/AssemblyOnlyUsedByUsing_Lib.cs b/test/Mono.Linker.Tests.Cases/References/Dependencies/AssemblyOnlyUsedByUsing_Lib.cs index 7ec8becd0..05580f373 100644 --- a/test/Mono.Linker.Tests.Cases/References/Dependencies/AssemblyOnlyUsedByUsing_Lib.cs +++ b/test/Mono.Linker.Tests.Cases/References/Dependencies/AssemblyOnlyUsedByUsing_Lib.cs @@ -1,4 +1,6 @@ -namespace Mono.Linker.Tests.Cases.References.Dependencies { - public class AssemblyOnlyUsedByUsing_Lib { +namespace Mono.Linker.Tests.Cases.References.Dependencies +{ + public class AssemblyOnlyUsedByUsing_Lib + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/References/Dependencies/UserAssembliesAreLinkedByDefault_Library1.cs b/test/Mono.Linker.Tests.Cases/References/Dependencies/UserAssembliesAreLinkedByDefault_Library1.cs index d8a45ab93..55fd8c010 100644 --- a/test/Mono.Linker.Tests.Cases/References/Dependencies/UserAssembliesAreLinkedByDefault_Library1.cs +++ b/test/Mono.Linker.Tests.Cases/References/Dependencies/UserAssembliesAreLinkedByDefault_Library1.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.References.Dependencies { - public class UserAssembliesAreLinkedByDefault_Library1 { +namespace Mono.Linker.Tests.Cases.References.Dependencies +{ + public class UserAssembliesAreLinkedByDefault_Library1 + { public void UsedMethod () { Console.WriteLine ("Used"); diff --git a/test/Mono.Linker.Tests.Cases/References/Dependencies/WithLinked_Attrs.cs b/test/Mono.Linker.Tests.Cases/References/Dependencies/WithLinked_Attrs.cs index 04254a958..b20cea475 100644 --- a/test/Mono.Linker.Tests.Cases/References/Dependencies/WithLinked_Attrs.cs +++ b/test/Mono.Linker.Tests.Cases/References/Dependencies/WithLinked_Attrs.cs @@ -13,30 +13,30 @@ namespace Mono.Linker.Tests.Cases.References.Dependencies public class MethodAttribute : Attribute { } - + public class MethodWithEnumValueAttribute : Attribute { - public MethodWithEnumValueAttribute(FooEnum value, Type t) + public MethodWithEnumValueAttribute (FooEnum value, Type t) { } } - + public class FieldAttribute : Attribute { } - + public class EventAttribute : Attribute { } - + public class PropertyAttribute : Attribute { } - + public class TypeAttribute : Attribute { } - + public class ParameterAttribute : Attribute { } diff --git a/test/Mono.Linker.Tests.Cases/References/Dependencies/WithLinked_Methods.cs b/test/Mono.Linker.Tests.Cases/References/Dependencies/WithLinked_Methods.cs index ee83cdbdf..5b289c1ea 100644 --- a/test/Mono.Linker.Tests.Cases/References/Dependencies/WithLinked_Methods.cs +++ b/test/Mono.Linker.Tests.Cases/References/Dependencies/WithLinked_Methods.cs @@ -2,15 +2,15 @@ namespace Mono.Linker.Tests.Cases.References.Dependencies { public class WithLinked_Methods { - public static void UsedByPublic() + public static void UsedByPublic () { } - - public static void UsedByInternal() + + public static void UsedByInternal () { } - - public static void UsedByPrivate() + + public static void UsedByPrivate () { } } diff --git a/test/Mono.Linker.Tests.Cases/References/Individual/CanSkipUnresolved.cs b/test/Mono.Linker.Tests.Cases/References/Individual/CanSkipUnresolved.cs index ec502e894..d3af5dde6 100644 --- a/test/Mono.Linker.Tests.Cases/References/Individual/CanSkipUnresolved.cs +++ b/test/Mono.Linker.Tests.Cases/References/Individual/CanSkipUnresolved.cs @@ -2,11 +2,13 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.References.Individual.Dependencies; -namespace Mono.Linker.Tests.Cases.References.Individual { - [SetupCompileBefore ("library1.dll", new [] { "Dependencies/CanSkipUnresolved_Library.cs" })] - [SetupCompileAfter ("library1.dll", new [] { "Dependencies/CanSkipUnresolved_Library.cs" }, defines: new [] { "EXCLUDE_STUFF" })] +namespace Mono.Linker.Tests.Cases.References.Individual +{ + [SetupCompileBefore ("library1.dll", new[] { "Dependencies/CanSkipUnresolved_Library.cs" })] + [SetupCompileAfter ("library1.dll", new[] { "Dependencies/CanSkipUnresolved_Library.cs" }, defines: new[] { "EXCLUDE_STUFF" })] [SetupLinkerArgument ("--skip-unresolved", "true")] - public class CanSkipUnresolved { + public class CanSkipUnresolved + { static void Main () { var t1 = new CanSkipUnresolved_Library.TypeWithMissingMethod (); diff --git a/test/Mono.Linker.Tests.Cases/References/Individual/Dependencies/CanSkipUnresolved_Library.cs b/test/Mono.Linker.Tests.Cases/References/Individual/Dependencies/CanSkipUnresolved_Library.cs index 59e5cff44..488cb47a7 100644 --- a/test/Mono.Linker.Tests.Cases/References/Individual/Dependencies/CanSkipUnresolved_Library.cs +++ b/test/Mono.Linker.Tests.Cases/References/Individual/Dependencies/CanSkipUnresolved_Library.cs @@ -1,18 +1,22 @@ using System; -namespace Mono.Linker.Tests.Cases.References.Individual.Dependencies { - public class CanSkipUnresolved_Library { - public class TypeWithMissingMethod { +namespace Mono.Linker.Tests.Cases.References.Individual.Dependencies +{ + public class CanSkipUnresolved_Library + { + public class TypeWithMissingMethod + { #if !EXCLUDE_STUFF public void GoingToBeMissing () { - + } #endif } #if !EXCLUDE_STUFF - public class TypeThatWillBeMissing { + public class TypeThatWillBeMissing + { } #endif } diff --git a/test/Mono.Linker.Tests.Cases/References/ReferencesAreRemovedWhenAllUsagesAreRemoved.cs b/test/Mono.Linker.Tests.Cases/References/ReferencesAreRemovedWhenAllUsagesAreRemoved.cs index 7acd8d630..fbabf8ff8 100644 --- a/test/Mono.Linker.Tests.Cases/References/ReferencesAreRemovedWhenAllUsagesAreRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/References/ReferencesAreRemovedWhenAllUsagesAreRemoved.cs @@ -4,7 +4,8 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.References { +namespace Mono.Linker.Tests.Cases.References +{ [SetupLinkerCoreAction ("link")] // Il8n & the blacklist step pollute the results with extra stuff that didn't need to be // preserved for this test case so we need to disable them @@ -13,12 +14,13 @@ namespace Mono.Linker.Tests.Cases.References { [RemovedAssembly ("System.dll")] [KeptReference (PlatformAssemblies.CoreLib)] // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 - [SkipPeVerify(SkipPeVerifyForToolchian.Pedump)] + [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] // System.Core.dll is referenced by System.dll in the .NET FW class libraries. Our GetType reflection marking code // detects a GetType("SHA256CryptoServiceProvider") in System.dll, which then causes a type in System.Core.dll to be marked. // PeVerify fails on the original GAC copy of System.Core.dll so it's expected that it will also fail on the stripped version we output [SkipPeVerify ("System.Core.dll")] - class ReferencesAreRemovedWhenAllUsagesAreRemoved { + class ReferencesAreRemovedWhenAllUsagesAreRemoved + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/References/SavedWithLinkedWillHaveMethodDepsKept.cs b/test/Mono.Linker.Tests.Cases/References/SavedWithLinkedWillHaveMethodDepsKept.cs index b0ff4dfb5..0e7fb0825 100644 --- a/test/Mono.Linker.Tests.Cases/References/SavedWithLinkedWillHaveMethodDepsKept.cs +++ b/test/Mono.Linker.Tests.Cases/References/SavedWithLinkedWillHaveMethodDepsKept.cs @@ -2,17 +2,19 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.References.Dependencies; -namespace Mono.Linker.Tests.Cases.References { - [SetupCSharpCompilerToUse("csc")] - [SetupLinkerAction("save", "test")] - [SetupCompileBefore("linked.dll", new [] {typeof (WithLinked_Methods)})] +namespace Mono.Linker.Tests.Cases.References +{ + [SetupCSharpCompilerToUse ("csc")] + [SetupLinkerAction ("save", "test")] + [SetupCompileBefore ("linked.dll", new[] { typeof (WithLinked_Methods) })] - [KeptMember(".ctor()")] + [KeptMember (".ctor()")] [KeptMemberInAssembly ("linked.dll", typeof (WithLinked_Methods), nameof (WithLinked_Methods.UsedByPublic) + "()")] [KeptMemberInAssembly ("linked.dll", typeof (WithLinked_Methods), nameof (WithLinked_Methods.UsedByInternal) + "()")] [KeptMemberInAssembly ("linked.dll", typeof (WithLinked_Methods), nameof (WithLinked_Methods.UsedByPrivate) + "()")] - public class SavedWithLinkedWillHaveMethodDepsKept { - public static void Main() + public class SavedWithLinkedWillHaveMethodDepsKept + { + public static void Main () { } @@ -27,9 +29,9 @@ namespace Mono.Linker.Tests.Cases.References { { WithLinked_Methods.UsedByInternal (); } - + [Kept] - static void UnusedPrivate() + static void UnusedPrivate () { WithLinked_Methods.UsedByPrivate (); } diff --git a/test/Mono.Linker.Tests.Cases/References/UserAssembliesAreLinkedByDefault.cs b/test/Mono.Linker.Tests.Cases/References/UserAssembliesAreLinkedByDefault.cs index 0c68e127c..348d078a1 100644 --- a/test/Mono.Linker.Tests.Cases/References/UserAssembliesAreLinkedByDefault.cs +++ b/test/Mono.Linker.Tests.Cases/References/UserAssembliesAreLinkedByDefault.cs @@ -3,13 +3,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.References.Dependencies; -namespace Mono.Linker.Tests.Cases.References { - [SetupCompileBefore ("library1.dll", new [] { "Dependencies/UserAssembliesAreLinkedByDefault_Library1.cs" })] +namespace Mono.Linker.Tests.Cases.References +{ + [SetupCompileBefore ("library1.dll", new[] { "Dependencies/UserAssembliesAreLinkedByDefault_Library1.cs" })] [KeptAssembly ("library1.dll")] [KeptMemberInAssembly ("library1.dll", typeof (UserAssembliesAreLinkedByDefault_Library1), "UsedMethod()")] [RemovedMemberInAssembly ("library1.dll", typeof (UserAssembliesAreLinkedByDefault_Library1), "UnusedMethod()")] - class UserAssembliesAreLinkedByDefault { + class UserAssembliesAreLinkedByDefault + { public static void Main () { new UserAssembliesAreLinkedByDefault_Library1 ().UsedMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs b/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs index 27ca51a66..d4879e501 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs @@ -8,7 +8,7 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Reflection { [SetupCSharpCompilerToUse ("csc")] - [KeptMember(".ctor()")] + [KeptMember (".ctor()")] public class ActivatorCreateInstance { public static void Main () @@ -16,7 +16,7 @@ namespace Mono.Linker.Tests.Cases.Reflection Activator.CreateInstance (typeof (Test1)); Activator.CreateInstance (typeof (Test2), true); Activator.CreateInstance (typeof (Test3), BindingFlags.NonPublic | BindingFlags.Instance, null, null, null); - Activator.CreateInstance (typeof (Test4), new object [] { 1, "ss" }); + Activator.CreateInstance (typeof (Test4), new object[] { 1, "ss" }); var p = new ActivatorCreateInstance (); @@ -130,8 +130,8 @@ namespace Mono.Linker.Tests.Cases.Reflection public FromParameterOnStaticMethodTypeB (int arg) { } } - [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type [] { typeof (Type), typeof (object []) })] - [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type [] { typeof (Type), typeof (BindingFlags), typeof (Binder), typeof (object []), typeof (CultureInfo) })] + [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type[] { typeof (Type), typeof (object[]) })] + [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type[] { typeof (Type), typeof (BindingFlags), typeof (Binder), typeof (object[]), typeof (CultureInfo) })] [Kept] private void FromParameterOnInstanceMethod ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.DefaultConstructor)] @@ -140,8 +140,8 @@ namespace Mono.Linker.Tests.Cases.Reflection { // Only default ctor is available from the parameter, so only the first one should work Activator.CreateInstance (type); - Activator.CreateInstance (type, new object [] { 1 }); - Activator.CreateInstance (type, BindingFlags.NonPublic, null, new object [] { 1, 2 }, null); + Activator.CreateInstance (type, new object[] { 1 }); + Activator.CreateInstance (type, BindingFlags.NonPublic, null, new object[] { 1, 2 }, null); } [Kept] @@ -163,8 +163,8 @@ namespace Mono.Linker.Tests.Cases.Reflection { // All ctors are required by the parameter, so all cases should work Activator.CreateInstance (type); - Activator.CreateInstance (type, new object [] { 1 }); - Activator.CreateInstance (type, BindingFlags.NonPublic, new object [] { 1, 2 }); + Activator.CreateInstance (type, new object[] { 1 }); + Activator.CreateInstance (type, BindingFlags.NonPublic, new object[] { 1, 2 }); } [Kept] @@ -178,7 +178,7 @@ namespace Mono.Linker.Tests.Cases.Reflection private FromParameterWithConstructorsType (int arg, int arg2) { } } - [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type [] { typeof (Type), typeof (BindingFlags), typeof (Binder), typeof (object []), typeof (CultureInfo) })] + [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type[] { typeof (Type), typeof (BindingFlags), typeof (Binder), typeof (object[]), typeof (CultureInfo) })] [Kept] private static void FromParameterWithPublicConstructors ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberKinds.PublicConstructors)] @@ -187,8 +187,8 @@ namespace Mono.Linker.Tests.Cases.Reflection { // Only public ctors and default ctor are required, so only those cases should work Activator.CreateInstance (type); - Activator.CreateInstance (type, new object [] { 1 }); - Activator.CreateInstance (type, BindingFlags.NonPublic, null, new object [] { 1, 2 }, null); + Activator.CreateInstance (type, new object[] { 1 }); + Activator.CreateInstance (type, BindingFlags.NonPublic, null, new object[] { 1, 2 }, null); } [Kept] @@ -262,9 +262,9 @@ namespace Mono.Linker.Tests.Cases.Reflection private static void WithAssemblyName () { Activator.CreateInstance ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+WithAssemblyNameParameterless1"); - Activator.CreateInstance ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+WithAssemblyNameParameterless2", new object [] { }); - Activator.CreateInstance ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+WithAssemblyNamePublicOnly", false, BindingFlags.Public, null, new object [] { }, null, new object [] { }); - Activator.CreateInstance ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+WithAssemblyNamePrivateOnly", false, BindingFlags.NonPublic, null, new object [] { }, null, new object [] { }); + Activator.CreateInstance ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+WithAssemblyNameParameterless2", new object[] { }); + Activator.CreateInstance ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+WithAssemblyNamePublicOnly", false, BindingFlags.Public, null, new object[] { }, null, new object[] { }); + Activator.CreateInstance ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+WithAssemblyNamePrivateOnly", false, BindingFlags.NonPublic, null, new object[] { }, null, new object[] { }); WithNullAssemblyName (); WithNonExistingAssemblyName (); @@ -273,14 +273,14 @@ namespace Mono.Linker.Tests.Cases.Reflection } [Kept] - [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type [] { typeof (string), typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type[] { typeof (string), typeof (string) })] private static void WithNullAssemblyName () { Activator.CreateInstance (null, "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+WithAssemblyNameParameterless1"); } [Kept] - [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type [] { typeof (string), typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type[] { typeof (string), typeof (string) })] private static void WithNonExistingAssemblyName () { Activator.CreateInstance ("NonExisting", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+WithAssemblyNameParameterless1"); @@ -290,17 +290,17 @@ namespace Mono.Linker.Tests.Cases.Reflection private static string _typeNameField; [Kept] - [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type [] { typeof (string), typeof (string), typeof (object []) })] + [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type[] { typeof (string), typeof (string), typeof (object[]) })] private static void WithAssemblyAndUnknownTypeName () { - Activator.CreateInstance ("test", _typeNameField, new object [] { }); + Activator.CreateInstance ("test", _typeNameField, new object[] { }); } [Kept] - [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type [] { typeof (string), typeof (string), typeof (object []) })] + [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance), new Type[] { typeof (string), typeof (string), typeof (object[]) })] private static void WithAssemblyAndNonExistingTypeName () { - Activator.CreateInstance ("test", "NonExisting", new object [] { }); + Activator.CreateInstance ("test", "NonExisting", new object[] { }); } [Kept] @@ -338,34 +338,34 @@ namespace Mono.Linker.Tests.Cases.Reflection // Just a basic test that these are all recognized, we're not testing that it marks correctly as it has the exact same implementation // as the above tested Activator.CreateInstance overloads AppDomain.CurrentDomain.CreateInstance ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType"); - AppDomain.CurrentDomain.CreateInstance ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType", new object [] { }); + AppDomain.CurrentDomain.CreateInstance ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType", new object[] { }); AppDomain.CurrentDomain.CreateInstance ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType", false, BindingFlags.Public, null, null, null, null); AppDomain.CurrentDomain.CreateInstanceAndUnwrap ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType"); - AppDomain.CurrentDomain.CreateInstanceAndUnwrap ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType", new object [] { }); + AppDomain.CurrentDomain.CreateInstanceAndUnwrap ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType", new object[] { }); AppDomain.CurrentDomain.CreateInstanceAndUnwrap ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType", false, BindingFlags.Public, null, null, null, null); AppDomain.CurrentDomain.CreateInstanceFrom ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType"); - AppDomain.CurrentDomain.CreateInstanceFrom ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType", new object [] { }); + AppDomain.CurrentDomain.CreateInstanceFrom ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType", new object[] { }); AppDomain.CurrentDomain.CreateInstanceFrom ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType", false, BindingFlags.Public, null, null, null, null); AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType"); - AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType", new object [] { }); + AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType", new object[] { }); AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap ("test", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+AppDomainCreateInstanceType", false, BindingFlags.Public, null, null, null, null); } [Kept] - [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance) + "<T>", new Type [0])] - [UnrecognizedReflectionAccessPattern (typeof (Assembly), nameof (Assembly.CreateInstance), new Type [] { typeof (string) })] - [UnrecognizedReflectionAccessPattern (typeof (Assembly), nameof (Assembly.CreateInstance), new Type [] { typeof (string), typeof (bool) })] - [UnrecognizedReflectionAccessPattern (typeof (Assembly), nameof (Assembly.CreateInstance), new Type [] { typeof (string), typeof (bool), typeof (BindingFlags), typeof (Binder), typeof (object []), typeof (CultureInfo), typeof (object []) })] + [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance) + "<T>", new Type[0])] + [UnrecognizedReflectionAccessPattern (typeof (Assembly), nameof (Assembly.CreateInstance), new Type[] { typeof (string) })] + [UnrecognizedReflectionAccessPattern (typeof (Assembly), nameof (Assembly.CreateInstance), new Type[] { typeof (string), typeof (bool) })] + [UnrecognizedReflectionAccessPattern (typeof (Assembly), nameof (Assembly.CreateInstance), new Type[] { typeof (string), typeof (bool), typeof (BindingFlags), typeof (Binder), typeof (object[]), typeof (CultureInfo), typeof (object[]) })] private static void UnsupportedCreateInstance () { Activator.CreateInstance<Test1> (); typeof (ActivatorCreateInstance).Assembly.CreateInstance ("NonExistent"); typeof (ActivatorCreateInstance).Assembly.CreateInstance ("NonExistent", ignoreCase: false); - typeof (ActivatorCreateInstance).Assembly.CreateInstance ("NonExistent", false, BindingFlags.Public, null, new object [] { }, null, new object [] { }); + typeof (ActivatorCreateInstance).Assembly.CreateInstance ("NonExistent", false, BindingFlags.Public, null, new object[] { }, null, new object[] { }); } @@ -402,7 +402,7 @@ namespace Mono.Linker.Tests.Cases.Reflection } [Kept] - [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance) + "<T>", new Type [0])] + [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance) + "<T>", new Type[0])] private static void TestCreateInstanceOfTWithNoConstraint<T> () { Activator.CreateInstance<T> (); diff --git a/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflection.cs index 147c31c60..99a5ecbf8 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflection.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflection.cs @@ -6,7 +6,7 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Reflection { [IgnoreTestCase ("Requires support for using a type in an unreferences assembly via reflection")] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/AssemblyDependency.cs" }, addAsReference: false)] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/AssemblyDependency.cs" }, addAsReference: false)] [KeptAssembly ("library.dll")] [KeptTypeInAssembly ("library.dll", "Mono.Linker.Tests.Cases.Reflection.Dependencies.AssemblyDependency")] public class AssemblyImportedViaReflection diff --git a/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithDerivedType.cs b/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithDerivedType.cs index 5f4e8af1e..b5ba17461 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithDerivedType.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithDerivedType.cs @@ -6,8 +6,8 @@ using Mono.Linker.Tests.Cases.Reflection.Dependencies; namespace Mono.Linker.Tests.Cases.Reflection { [IgnoreTestCase ("Requires support for using a type in an unreferences assembly via reflection")] - [SetupCompileBefore ("base.dll", new [] { "Dependencies/AssemblyImportedViaReflectionWithDerivedType_Base.cs" })] - [SetupCompileBefore ("reflection.dll", new [] { "Dependencies/AssemblyImportedViaReflectionWithDerivedType_Reflect.cs" }, references: new [] {"base.dll"}, addAsReference: false)] + [SetupCompileBefore ("base.dll", new[] { "Dependencies/AssemblyImportedViaReflectionWithDerivedType_Base.cs" })] + [SetupCompileBefore ("reflection.dll", new[] { "Dependencies/AssemblyImportedViaReflectionWithDerivedType_Reflect.cs" }, references: new[] { "base.dll" }, addAsReference: false)] [KeptAssembly ("base.dll")] [KeptAssembly ("reflection.dll")] [KeptMemberInAssembly ("base.dll", typeof (AssemblyImportedViaReflectionWithDerivedType_Base), "Method()")] @@ -19,7 +19,7 @@ namespace Mono.Linker.Tests.Cases.Reflection // Cause a the new assembly to be included via reflection usage const string newAssemblyType = "Mono.Linker.Tests.Cases.Reflection.Dependencies.AssemblyImportedViaReflectionWithDerivedType_Reflect, reflection, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"; var res = Type.GetType (newAssemblyType, true); - + // Foo and the reflection assembly both have a class the inherits from the base type. // by using `Method` here and marking the reflection type above, we've introduced a requirement that `Method` be marked on the type in the reflection assembly as well var obj = new Foo (); @@ -29,7 +29,8 @@ namespace Mono.Linker.Tests.Cases.Reflection [Kept] [KeptMember (".ctor()")] [KeptBaseType (typeof (AssemblyImportedViaReflectionWithDerivedType_Base))] - class Foo : AssemblyImportedViaReflectionWithDerivedType_Base { + class Foo : AssemblyImportedViaReflectionWithDerivedType_Base + { [Kept] public override string Method () { diff --git a/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithReference.cs b/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithReference.cs index 716207d22..0cdb848e3 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithReference.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/AssemblyImportedViaReflectionWithReference.cs @@ -5,8 +5,8 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Reflection { [IgnoreTestCase ("Requires support for using a type in an unreferences assembly via reflection")] - [SetupCompileBefore ("reference.dll", new [] { "Dependencies/AssemblyDependency.cs" }, addAsReference: false)] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/AssemblyDependencyWithReference.cs" }, references: new []{"reference.dll"}, addAsReference: false)] + [SetupCompileBefore ("reference.dll", new[] { "Dependencies/AssemblyDependency.cs" }, addAsReference: false)] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/AssemblyDependencyWithReference.cs" }, references: new[] { "reference.dll" }, addAsReference: false)] [KeptAssembly ("reference.dll")] [KeptAssembly ("library.dll")] [KeptTypeInAssembly ("library.dll", "Mono.Linker.Tests.Cases.Reflection.Dependencies.AssemblyDependencyWithReference")] diff --git a/test/Mono.Linker.Tests.Cases/Reflection/ConstructorUsedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/ConstructorUsedViaReflection.cs index db94ee618..19ea84a30 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/ConstructorUsedViaReflection.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/ConstructorUsedViaReflection.cs @@ -19,40 +19,40 @@ namespace Mono.Linker.Tests.Cases.Reflection } [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetConstructor), new Type [] { typeof (Type []) }, - typeof (IntegerParameterConstructor), ".ctor", new Type [0])] + typeof (Type), nameof (Type.GetConstructor), new Type[] { typeof (Type[]) }, + typeof (IntegerParameterConstructor), ".ctor", new Type[0])] [Kept] static void TestWithIntegerParameter () { - var constructor = typeof (IntegerParameterConstructor).GetConstructor (new Type [] { typeof (int) }); - constructor.Invoke (null, new object [] { }); + var constructor = typeof (IntegerParameterConstructor).GetConstructor (new Type[] { typeof (int) }); + constructor.Invoke (null, new object[] { }); } [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetConstructor), new Type [] { typeof (BindingFlags), typeof (Binder), typeof (Type []), typeof (ParameterModifier []) }, - typeof (OnlyUsedViaReflection), ".ctor", new Type [0])] + typeof (Type), nameof (Type.GetConstructor), new Type[] { typeof (BindingFlags), typeof (Binder), typeof (Type[]), typeof (ParameterModifier[]) }, + typeof (OnlyUsedViaReflection), ".ctor", new Type[0])] [Kept] static void TestWithBindingFlags () { - var constructor = typeof (OnlyUsedViaReflection).GetConstructor (BindingFlags.Public, GetNullValue ("some argument", 2, 3), new Type [] { }, new ParameterModifier [] { }); - constructor.Invoke (null, new object [] { }); + var constructor = typeof (OnlyUsedViaReflection).GetConstructor (BindingFlags.Public, GetNullValue ("some argument", 2, 3), new Type[] { }, new ParameterModifier[] { }); + constructor.Invoke (null, new object[] { }); } [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetConstructor), new Type [] { typeof (BindingFlags), typeof (Binder), typeof (CallingConventions), typeof (Type []), typeof (ParameterModifier []) }, - typeof (CallingConventionConstructor), ".ctor", new Type [0])] + typeof (Type), nameof (Type.GetConstructor), new Type[] { typeof (BindingFlags), typeof (Binder), typeof (CallingConventions), typeof (Type[]), typeof (ParameterModifier[]) }, + typeof (CallingConventionConstructor), ".ctor", new Type[0])] [Kept] static void TestWithCallingConvention () { - var constructor = typeof (CallingConventionConstructor).GetConstructor (BindingFlags.Public, GetNullValue ("some argument", 2, 3), CallingConventions.HasThis, new Type [] { }, new ParameterModifier [] { }); - constructor.Invoke (null, new object [] { }); + var constructor = typeof (CallingConventionConstructor).GetConstructor (BindingFlags.Public, GetNullValue ("some argument", 2, 3), CallingConventions.HasThis, new Type[] { }, new ParameterModifier[] { }); + constructor.Invoke (null, new object[] { }); } [Kept] static void TestNullType () { Type type = null; - var constructor = type.GetConstructor (new Type [] { }); + var constructor = type.GetConstructor (new Type[] { }); } [Kept] @@ -62,21 +62,21 @@ namespace Mono.Linker.Tests.Cases.Reflection } [UnrecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetConstructor), new Type [] { typeof (Type []) })] + typeof (Type), nameof (Type.GetConstructor), new Type[] { typeof (Type[]) })] [Kept] static void TestDataFlowType () { Type type = FindType (); - var constructor = type.GetConstructor (new Type [] { }); + var constructor = type.GetConstructor (new Type[] { }); } [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetConstructor), new Type [] { typeof (BindingFlags), typeof (Binder), typeof (Type []), typeof (ParameterModifier []) }, - typeof (IfConstructor), ".ctor", new Type [0])] + typeof (Type), nameof (Type.GetConstructor), new Type[] { typeof (BindingFlags), typeof (Binder), typeof (Type[]), typeof (ParameterModifier[]) }, + typeof (IfConstructor), ".ctor", new Type[0])] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetConstructor), new Type [] { typeof (BindingFlags), typeof (Binder), typeof (Type []), typeof (ParameterModifier []) }, - typeof (ElseConstructor), ".ctor", new Type [0])] + typeof (Type), nameof (Type.GetConstructor), new Type[] { typeof (BindingFlags), typeof (Binder), typeof (Type[]), typeof (ParameterModifier[]) }, + typeof (ElseConstructor), ".ctor", new Type[0])] static void TestIfElse (bool decision) { Type myType; @@ -85,8 +85,8 @@ namespace Mono.Linker.Tests.Cases.Reflection } else { myType = typeof (ElseConstructor); } - var constructor = myType.GetConstructor (BindingFlags.Public, null, new Type [] { }, null); - constructor.Invoke (null, new object [] { }); + var constructor = myType.GetConstructor (BindingFlags.Public, null, new Type[] { }, null); + constructor.Invoke (null, new object[] { }); } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Reflection/CoreLibMessages.cs b/test/Mono.Linker.Tests.Cases/Reflection/CoreLibMessages.cs index 98af67248..884d5b476 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/CoreLibMessages.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/CoreLibMessages.cs @@ -5,7 +5,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [SetupCSharpCompilerToUse ("csc")] [SetupLinkerAction ("copy", "CoreLibEmulator")] - [SetupCompileBefore ("CoreLibEmulator.dll", new string [] { "Dependencies/CoreLibEmulator.cs" }, null, new string [] { "INCLUDE_CORELIB_IMPL" }, compilerToUse: "csc")] + [SetupCompileBefore ("CoreLibEmulator.dll", new string[] { "Dependencies/CoreLibEmulator.cs" }, null, new string[] { "INCLUDE_CORELIB_IMPL" }, compilerToUse: "csc")] // Validate that calls from one overload of Type.Get* to another overload of the same method don't produce warning [LogDoesNotContain ("Reflection call 'System.Reflection.ConstructorInfo System.Type::GetConstructor\\([^)]*\\)' inside 'System.Reflection.ConstructorInfo System.Type::GetConstructor\\([^)]*\\)' does not use detectable instance type extraction")] diff --git a/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyDependency.cs b/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyDependency.cs index 84339ad4b..b18cd8975 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyDependency.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyDependency.cs @@ -12,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Reflection.Dependencies { } - class TypeThatIsUsedViaReflection { + class TypeThatIsUsedViaReflection + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyDependencyWithReference.cs b/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyDependencyWithReference.cs index 889b5e141..551205f70 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyDependencyWithReference.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyDependencyWithReference.cs @@ -1,4 +1,6 @@ -namespace Mono.Linker.Tests.Cases.Reflection.Dependencies { - public class AssemblyDependencyWithReference : AssemblyDependency { +namespace Mono.Linker.Tests.Cases.Reflection.Dependencies +{ + public class AssemblyDependencyWithReference : AssemblyDependency + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyImportedViaReflectionWithDerivedType_Base.cs b/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyImportedViaReflectionWithDerivedType_Base.cs index 6323951ee..003facce6 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyImportedViaReflectionWithDerivedType_Base.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyImportedViaReflectionWithDerivedType_Base.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.Reflection.Dependencies { - public abstract class AssemblyImportedViaReflectionWithDerivedType_Base { +namespace Mono.Linker.Tests.Cases.Reflection.Dependencies +{ + public abstract class AssemblyImportedViaReflectionWithDerivedType_Base + { public abstract string Method (); } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyImportedViaReflectionWithDerivedType_Reflect.cs b/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyImportedViaReflectionWithDerivedType_Reflect.cs index e0c1bcb2a..795ee3c22 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyImportedViaReflectionWithDerivedType_Reflect.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/AssemblyImportedViaReflectionWithDerivedType_Reflect.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.Reflection.Dependencies { - public class AssemblyImportedViaReflectionWithDerivedType_Reflect : AssemblyImportedViaReflectionWithDerivedType_Base { +namespace Mono.Linker.Tests.Cases.Reflection.Dependencies +{ + public class AssemblyImportedViaReflectionWithDerivedType_Reflect : AssemblyImportedViaReflectionWithDerivedType_Base + { public override string Method () { return "Reflect"; diff --git a/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/CoreLibEmulator.cs b/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/CoreLibEmulator.cs index 09f700547..5b0ddff40 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/CoreLibEmulator.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/CoreLibEmulator.cs @@ -8,7 +8,7 @@ namespace Mono.Linker.Tests.Cases.Reflection.Dependencies { public class CoreLibEmulator { - public static void Test() + public static void Test () { #if INCLUDE_CORELIB_IMPL Type t = new Type(); diff --git a/test/Mono.Linker.Tests.Cases/Reflection/EventUsedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/EventUsedViaReflection.cs index 44dccf6ca..ab843b582 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/EventUsedViaReflection.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/EventUsedViaReflection.cs @@ -3,9 +3,11 @@ using System.Reflection; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Reflection { +namespace Mono.Linker.Tests.Cases.Reflection +{ [SetupCSharpCompilerToUse ("csc")] - public class EventUsedViaReflection { + public class EventUsedViaReflection + { public static void Main () { new Foo (); // Needed to avoid lazy body marking stubbing @@ -24,7 +26,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetEvent), new Type [] { typeof (string) }, + typeof (Type), nameof (Type.GetEvent), new Type[] { typeof (string) }, typeof (Foo), nameof (Foo.Event), (Type[]) null)] static void TestByName () { @@ -39,7 +41,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { } [Kept] - static void TestNameWrongBindingFlags() + static void TestNameWrongBindingFlags () { var eventInfo = typeof (Bar).GetEvent ("PublicEvent", BindingFlags.NonPublic); } @@ -77,7 +79,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [UnrecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetEvent), new Type [] { typeof (string) })] + typeof (Type), nameof (Type.GetEvent), new Type[] { typeof (string) })] static void TestDataFlowType () { Type type = FindType (); @@ -86,14 +88,14 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetEvent), new Type [] { typeof (string) }, - typeof (IfClass), nameof (IfClass.IfEvent), (Type [])null)] + typeof (Type), nameof (Type.GetEvent), new Type[] { typeof (string) }, + typeof (IfClass), nameof (IfClass.IfEvent), (Type[]) null)] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetEvent), new Type [] { typeof (string) }, - typeof (IfClass), nameof (IfClass.ElseEvent), (Type [])null)] + typeof (Type), nameof (Type.GetEvent), new Type[] { typeof (string) }, + typeof (IfClass), nameof (IfClass.ElseEvent), (Type[]) null)] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetEvent), new Type [] { typeof (string) }, - typeof (ElseClass), nameof (ElseClass.IfEvent), (Type [])null)] + typeof (Type), nameof (Type.GetEvent), new Type[] { typeof (string) }, + typeof (ElseClass), nameof (ElseClass.IfEvent), (Type[]) null)] static void TestIfElse (int i) { Type myType; @@ -103,7 +105,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { myType = typeof (ElseClass); } String myString; - if(i == 1) { + if (i == 1) { myString = "IfEvent"; } else { myString = "ElseEvent"; @@ -113,8 +115,8 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetEvent), new Type [] { typeof (string) }, - typeof (BaseClass), nameof (BaseClass.PublicEventOnBase), (Type [])null)] + typeof (Type), nameof (Type.GetEvent), new Type[] { typeof (string) }, + typeof (BaseClass), nameof (BaseClass.PublicEventOnBase), (Type[]) null)] static void TestEventInBaseType () { typeof (DerivedClass).GetEvent ("ProtectedEventOnBase"); @@ -122,7 +124,8 @@ namespace Mono.Linker.Tests.Cases.Reflection { } [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] [KeptBackingField] [KeptEventAddMethod] @@ -141,7 +144,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { private event EventHandler<EventArgs> PrivateEvent; public event EventHandler<EventArgs> PublicEvent; } - + class IfClass { [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallString.cs b/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallString.cs index 174492323..4316d95a9 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallString.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallString.cs @@ -56,7 +56,7 @@ namespace Mono.Linker.Tests.Cases.Reflection [Kept] [UnrecognizedReflectionAccessPattern (typeof (Expression), nameof (Expression.Call), - new Type [] { typeof (Type), typeof (string), typeof (Type []), typeof (Expression []) })] + new Type[] { typeof (Type), typeof (string), typeof (Type[]), typeof (Expression[]) })] public static void Test () { // Keep all methods of the type that made the call diff --git a/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallStringAndLocals.cs b/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallStringAndLocals.cs index b41a023da..24c56f00d 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallStringAndLocals.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallStringAndLocals.cs @@ -3,9 +3,11 @@ using System.Linq.Expressions; using System; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Reflection { +namespace Mono.Linker.Tests.Cases.Reflection +{ [Reference ("System.Core.dll")] - public class ExpressionCallStringAndLocals { + public class ExpressionCallStringAndLocals + { public static void Main () { Branch_SystemTypeValueNode_KnownStringValue (); diff --git a/test/Mono.Linker.Tests.Cases/Reflection/ExpressionFieldString.cs b/test/Mono.Linker.Tests.Cases/Reflection/ExpressionFieldString.cs index 8701164f5..aba9bb7c9 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/ExpressionFieldString.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/ExpressionFieldString.cs @@ -10,7 +10,7 @@ namespace Mono.Linker.Tests.Cases.Reflection public class ExpressionFieldString { [UnrecognizedReflectionAccessPattern (typeof (Expression), nameof (Expression.Field), - new Type [] { typeof (Expression), typeof (Type), typeof (string) })] + new Type[] { typeof (Expression), typeof (Type), typeof (string) })] public static void Main () { Expression.Field (Expression.Parameter (typeof (int), ""), typeof (ExpressionFieldString), "Field"); diff --git a/test/Mono.Linker.Tests.Cases/Reflection/ExpressionNewType.cs b/test/Mono.Linker.Tests.Cases/Reflection/ExpressionNewType.cs index 572a1deb7..a4ed52c76 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/ExpressionNewType.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/ExpressionNewType.cs @@ -27,22 +27,22 @@ namespace Mono.Linker.Tests.Cases.Reflection #region RecognizedReflectionAccessPatterns [RecognizedReflectionAccessPattern ( - typeof (Expression), nameof (Expression.New), new Type [] { typeof (Type) }, typeof (A), ".ctor", new Type [0])] + typeof (Expression), nameof (Expression.New), new Type[] { typeof (Type) }, typeof (A), ".ctor", new Type[0])] [RecognizedReflectionAccessPattern ( - typeof (Expression), nameof (Expression.New), new Type [] { typeof (Type) }, typeof (B), ".ctor", new Type [0])] + typeof (Expression), nameof (Expression.New), new Type[] { typeof (Type) }, typeof (B), ".ctor", new Type[0])] [Kept] static void Branch_SystemTypeValueNode (int i) { - Type T = (Type)null; + Type T = (Type) null; switch (i) { - case 0: - T = typeof (A); - break; - case 1: - T = typeof (B); - break; - default: - break; + case 0: + T = typeof (A); + break; + case 1: + T = typeof (B); + break; + default: + break; } Expression.New (T); @@ -50,15 +50,15 @@ namespace Mono.Linker.Tests.Cases.Reflection #endregion #region UnrecognizedReflectionAccessPatterns - [UnrecognizedReflectionAccessPattern (typeof (Expression), nameof (Expression.New), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (Expression), nameof (Expression.New), new Type[] { typeof (Type) })] [Kept] static void Branch_MethodParameterValueNode (Type T) { Expression.New (T); } - [UnrecognizedReflectionAccessPattern (typeof (Expression), nameof (Expression.New), new Type [] { typeof (Type) })] - [UnrecognizedReflectionAccessPattern (typeof (Expression), nameof (Expression.New), new Type [] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (Expression), nameof (Expression.New), new Type[] { typeof (Type) })] + [UnrecognizedReflectionAccessPattern (typeof (Expression), nameof (Expression.New), new Type[] { typeof (Type) })] [Kept] static void Branch_UnrecognizedPatterns () { diff --git a/test/Mono.Linker.Tests.Cases/Reflection/ExpressionPropertyString.cs b/test/Mono.Linker.Tests.Cases/Reflection/ExpressionPropertyString.cs index b4e4bc391..37b9cdb56 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/ExpressionPropertyString.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/ExpressionPropertyString.cs @@ -12,7 +12,7 @@ namespace Mono.Linker.Tests.Cases.Reflection public class ExpressionPropertyString { [UnrecognizedReflectionAccessPattern (typeof (Expression), nameof (Expression.Property), - new Type [] { typeof (Expression), typeof (Type), typeof (string) })] + new Type[] { typeof (Expression), typeof (Type), typeof (string) })] public static void Main () { Expression.Property (Expression.Parameter (typeof (int), ""), typeof (ExpressionPropertyString), "Property"); diff --git a/test/Mono.Linker.Tests.Cases/Reflection/FieldUsedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/FieldUsedViaReflection.cs index 08838ec87..e3b76aa4b 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/FieldUsedViaReflection.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/FieldUsedViaReflection.cs @@ -3,9 +3,11 @@ using System.Reflection; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Reflection { +namespace Mono.Linker.Tests.Cases.Reflection +{ [SetupCSharpCompilerToUse ("csc")] - public class FieldUsedViaReflection { + public class FieldUsedViaReflection + { public static void Main () { TestByName (); @@ -22,8 +24,8 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetField), new Type [] { typeof (string) }, - typeof (FieldUsedViaReflection), nameof (FieldUsedViaReflection.field), (Type [])null)] + typeof (Type), nameof (Type.GetField), new Type[] { typeof (string) }, + typeof (FieldUsedViaReflection), nameof (FieldUsedViaReflection.field), (Type[]) null)] static void TestByName () { var field = typeof (FieldUsedViaReflection).GetField ("field"); @@ -32,8 +34,8 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetField), new Type [] { typeof (string), typeof(BindingFlags) }, - typeof (Foo), nameof (Foo.field), (Type [])null)] + typeof (Type), nameof (Type.GetField), new Type[] { typeof (string), typeof (BindingFlags) }, + typeof (Foo), nameof (Foo.field), (Type[]) null)] static void TestNameBindingFlags () { var field = typeof (Foo).GetField ("field", BindingFlags.Static); @@ -78,7 +80,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [UnrecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetField), new Type [] { typeof (string) })] + typeof (Type), nameof (Type.GetField), new Type[] { typeof (string) })] static void TestDataFlowType () { Type type = FindType (); @@ -87,11 +89,11 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetField), new Type [] { typeof (string)}, - typeof (IfClass), nameof (IfClass.ifField), (Type [])null)] + typeof (Type), nameof (Type.GetField), new Type[] { typeof (string) }, + typeof (IfClass), nameof (IfClass.ifField), (Type[]) null)] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetField), new Type [] { typeof (string) }, - typeof (ElseClass), nameof (ElseClass.elseField), (Type [])null)] + typeof (Type), nameof (Type.GetField), new Type[] { typeof (string) }, + typeof (ElseClass), nameof (ElseClass.elseField), (Type[]) null)] static void TestIfElse (int i) { Type myType; @@ -111,19 +113,19 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetField), new Type [] { typeof (string) }, - typeof (BaseClass), nameof (BaseClass.publicFieldOnBase), (Type [])null)] + typeof (Type), nameof (Type.GetField), new Type[] { typeof (string) }, + typeof (BaseClass), nameof (BaseClass.publicFieldOnBase), (Type[]) null)] static void TestFieldInBaseType () { - var protectedField = typeof(DerivedClass).GetField ("protectedFieldOnBase"); - var publicField = typeof(DerivedClass).GetField ("publicFieldOnBase"); + var protectedField = typeof (DerivedClass).GetField ("protectedFieldOnBase"); + var publicField = typeof (DerivedClass).GetField ("publicFieldOnBase"); } [Kept] static int field; [Kept] - private class Foo + private class Foo { [Kept] public static int field; diff --git a/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflection.cs index 53a75b624..bab30ae53 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflection.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflection.cs @@ -3,10 +3,12 @@ using System.Reflection; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Reflection { +namespace Mono.Linker.Tests.Cases.Reflection +{ [SetupCSharpCompilerToUse ("csc")] - public class MethodUsedViaReflection { + public class MethodUsedViaReflection + { public static void Main () { TestName (); @@ -30,48 +32,48 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetMethod), new Type [] { typeof (string) }, - typeof (MethodUsedViaReflection), nameof (MethodUsedViaReflection.OnlyCalledViaReflection), new Type [0])] + typeof (Type), nameof (Type.GetMethod), new Type[] { typeof (string) }, + typeof (MethodUsedViaReflection), nameof (MethodUsedViaReflection.OnlyCalledViaReflection), new Type[0])] static void TestName () { var method = typeof (MethodUsedViaReflection).GetMethod ("OnlyCalledViaReflection"); - method.Invoke (null, new object [] { }); + method.Invoke (null, new object[] { }); } [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetMethod), new Type [] { typeof (string), typeof (BindingFlags) }, - typeof (TestNameAndExplicitBindingClass), nameof (TestNameAndExplicitBindingClass.OnlyCalledViaReflection), new Type [0])] + typeof (Type), nameof (Type.GetMethod), new Type[] { typeof (string), typeof (BindingFlags) }, + typeof (TestNameAndExplicitBindingClass), nameof (TestNameAndExplicitBindingClass.OnlyCalledViaReflection), new Type[0])] static void TestNameAndExplicitBindingFlags () { var method = typeof (TestNameAndExplicitBindingClass).GetMethod ("OnlyCalledViaReflection", BindingFlags.Static | BindingFlags.NonPublic); - method.Invoke (null, new object [] { }); + method.Invoke (null, new object[] { }); } [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetMethod), new Type [] { typeof (string), typeof (Type []) }, - typeof (TestNameAndTypeClass), nameof (TestNameAndTypeClass.OnlyCalledViaReflection), new Type [0])] + typeof (Type), nameof (Type.GetMethod), new Type[] { typeof (string), typeof (Type[]) }, + typeof (TestNameAndTypeClass), nameof (TestNameAndTypeClass.OnlyCalledViaReflection), new Type[0])] static void TestNameAndType () { - var method = typeof (TestNameAndTypeClass).GetMethod ("OnlyCalledViaReflection", new Type [] { }); - method.Invoke (null, new object [] { }); + var method = typeof (TestNameAndTypeClass).GetMethod ("OnlyCalledViaReflection", new Type[] { }); + method.Invoke (null, new object[] { }); } [Kept] - static void TestNameBindingFlagsAndParameterModifier() + static void TestNameBindingFlagsAndParameterModifier () { - var method = typeof (TestNameBindingFlagsAndParameterClass).GetMethod ("OnlyCalledViaReflection", BindingFlags.Public, null, new Type [] { }, null); - method.Invoke (null, new object [] { }); + var method = typeof (TestNameBindingFlagsAndParameterClass).GetMethod ("OnlyCalledViaReflection", BindingFlags.Public, null, new Type[] { }, null); + method.Invoke (null, new object[] { }); } [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetMethod), new Type [] { typeof (string), typeof (BindingFlags), typeof (Binder), typeof(CallingConventions), typeof (Type []), typeof (ParameterModifier []) }, - typeof (TestNameBindingFlagsCallingConventionParameterClass), nameof (TestNameBindingFlagsCallingConventionParameterClass.OnlyCalledViaReflection), new Type [0])] - static void TestNameBindingFlagsCallingConventionParameterModifier() + typeof (Type), nameof (Type.GetMethod), new Type[] { typeof (string), typeof (BindingFlags), typeof (Binder), typeof (CallingConventions), typeof (Type[]), typeof (ParameterModifier[]) }, + typeof (TestNameBindingFlagsCallingConventionParameterClass), nameof (TestNameBindingFlagsCallingConventionParameterClass.OnlyCalledViaReflection), new Type[0])] + static void TestNameBindingFlagsCallingConventionParameterModifier () { - var method = typeof (TestNameBindingFlagsCallingConventionParameterClass).GetMethod ("OnlyCalledViaReflection", BindingFlags.NonPublic, null, CallingConventions.Standard, new Type [] { }, null); - method.Invoke (null, new object [] { }); + var method = typeof (TestNameBindingFlagsCallingConventionParameterClass).GetMethod ("OnlyCalledViaReflection", BindingFlags.NonPublic, null, CallingConventions.Standard, new Type[] { }, null); + method.Invoke (null, new object[] { }); } #if NETCOREAPP [Kept] @@ -135,7 +137,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [UnrecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetMethod), new Type [] { typeof (string), typeof (BindingFlags) })] + typeof (Type), nameof (Type.GetMethod), new Type[] { typeof (string), typeof (BindingFlags) })] static void TestDataFlowType () { Type type = FindType (); @@ -144,20 +146,20 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetMethod), new Type [] { typeof (string), typeof (BindingFlags), typeof (Binder), typeof (Type []), typeof (ParameterModifier []) }, - typeof (IfClass), nameof (IfClass.OnlyCalledViaReflection), new Type [0])] + typeof (Type), nameof (Type.GetMethod), new Type[] { typeof (string), typeof (BindingFlags), typeof (Binder), typeof (Type[]), typeof (ParameterModifier[]) }, + typeof (IfClass), nameof (IfClass.OnlyCalledViaReflection), new Type[0])] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetMethod), new Type [] { typeof (string), typeof (BindingFlags), typeof (Binder), typeof (Type []), typeof (ParameterModifier []) }, - typeof (IfClass), nameof (IfClass.ElseIfCall), new Type [0])] + typeof (Type), nameof (Type.GetMethod), new Type[] { typeof (string), typeof (BindingFlags), typeof (Binder), typeof (Type[]), typeof (ParameterModifier[]) }, + typeof (IfClass), nameof (IfClass.ElseIfCall), new Type[0])] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetMethod), new Type [] { typeof (string), typeof (BindingFlags), typeof (Binder), typeof (Type []), typeof (ParameterModifier []) }, - typeof (ElseIfClass), nameof (ElseIfClass.OnlyCalledViaReflection), new Type [0])] + typeof (Type), nameof (Type.GetMethod), new Type[] { typeof (string), typeof (BindingFlags), typeof (Binder), typeof (Type[]), typeof (ParameterModifier[]) }, + typeof (ElseIfClass), nameof (ElseIfClass.OnlyCalledViaReflection), new Type[0])] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetMethod), new Type [] { typeof (string), typeof (BindingFlags), typeof (Binder), typeof (Type []), typeof (ParameterModifier []) }, - typeof (ElseIfClass), nameof (ElseIfClass.ElseIfCall), new Type [0])] + typeof (Type), nameof (Type.GetMethod), new Type[] { typeof (string), typeof (BindingFlags), typeof (Binder), typeof (Type[]), typeof (ParameterModifier[]) }, + typeof (ElseIfClass), nameof (ElseIfClass.ElseIfCall), new Type[0])] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetMethod), new Type [] { typeof (string), typeof (BindingFlags), typeof (Binder), typeof (Type []), typeof (ParameterModifier []) }, - typeof (ElseClass), nameof (ElseClass.OnlyCalledViaReflection), new Type [0])] + typeof (Type), nameof (Type.GetMethod), new Type[] { typeof (string), typeof (BindingFlags), typeof (Binder), typeof (Type[]), typeof (ParameterModifier[]) }, + typeof (ElseClass), nameof (ElseClass.OnlyCalledViaReflection), new Type[0])] static void TestIfElse (int i) { Type myType; @@ -176,18 +178,18 @@ namespace Mono.Linker.Tests.Cases.Reflection { } else { mystring = null; } - var method = myType.GetMethod (mystring, BindingFlags.Static, null, new Type [] { typeof (int) }, null); - method.Invoke (null, new object [] { }); + var method = myType.GetMethod (mystring, BindingFlags.Static, null, new Type[] { typeof (int) }, null); + method.Invoke (null, new object[] { }); } [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetMethod), new Type [] { typeof (string) }, - typeof (BaseClass), nameof (BaseClass.OnlyCalledViaReflection), new Type [0])] - static void TestMethodInBaseType() + typeof (Type), nameof (Type.GetMethod), new Type[] { typeof (string) }, + typeof (BaseClass), nameof (BaseClass.OnlyCalledViaReflection), new Type[0])] + static void TestMethodInBaseType () { var method = typeof (DerivedClass).GetMethod ("OnlyCalledViaReflection"); - method.Invoke (null, new object [] { }); + method.Invoke (null, new object[] { }); } [Kept] @@ -267,7 +269,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { { return 42; } - + private int OnlyCalledViaReflection (int foo) { return 43; @@ -382,17 +384,17 @@ namespace Mono.Linker.Tests.Cases.Reflection { private class IfClass { [Kept] - public static int OnlyCalledViaReflection() + public static int OnlyCalledViaReflection () { return 42; } - - private int OnlyCalledViaReflection(int foo) + + private int OnlyCalledViaReflection (int foo) { return 43; } [Kept] - public static int ElseIfCall() + public static int ElseIfCall () { return 44; } diff --git a/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflectionAndLocal.cs b/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflectionAndLocal.cs index e5a3dbf1e..5a7f010e8 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflectionAndLocal.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflectionAndLocal.cs @@ -2,7 +2,8 @@ using System.Reflection; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Reflection { +namespace Mono.Linker.Tests.Cases.Reflection +{ public class MethodUsedViaReflectionAndLocal { public static void Main () @@ -19,7 +20,8 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [KeptMember (".ctor()")] - public class A { + public class A + { [Kept] public int Foo () { @@ -29,7 +31,8 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [KeptMember (".ctor()")] - public class B { + public class B + { public int Foo () { return 43; diff --git a/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflectionWithDefaultBindingFlags.cs b/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflectionWithDefaultBindingFlags.cs index b27623ac6..d6dd87f73 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflectionWithDefaultBindingFlags.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflectionWithDefaultBindingFlags.cs @@ -1,8 +1,10 @@ using System.Reflection; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Reflection { - public class MethodUsedViaReflectionWithDefaultBindingFlags { +namespace Mono.Linker.Tests.Cases.Reflection +{ + public class MethodUsedViaReflectionWithDefaultBindingFlags + { public static void Main () { new Foo (); // Needed to avoid lazy body marking stubbing @@ -11,7 +13,8 @@ namespace Mono.Linker.Tests.Cases.Reflection { } [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] private static int OnlyCalledViaReflection () { diff --git a/test/Mono.Linker.Tests.Cases/Reflection/PropertyUsedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/PropertyUsedViaReflection.cs index 100571fbe..5113151e3 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/PropertyUsedViaReflection.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/PropertyUsedViaReflection.cs @@ -2,7 +2,8 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Reflection { +namespace Mono.Linker.Tests.Cases.Reflection +{ [SetupCSharpCompilerToUse ("csc")] public class PropertyUsedViaReflection { @@ -22,32 +23,32 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetProperty), new Type [] { typeof (string) }, - typeof (PropertyUsedViaReflection), nameof (PropertyUsedViaReflection.OnlyUsedViaReflection), (Type [])null)] + typeof (Type), nameof (Type.GetProperty), new Type[] { typeof (string) }, + typeof (PropertyUsedViaReflection), nameof (PropertyUsedViaReflection.OnlyUsedViaReflection), (Type[]) null)] static void TestGetterAndSetter () { var property = typeof (PropertyUsedViaReflection).GetProperty ("OnlyUsedViaReflection"); - property.GetValue (null, new object [] { }); + property.GetValue (null, new object[] { }); } [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetProperty), new Type [] { typeof (string) }, - typeof (PropertyUsedViaReflection), nameof (PropertyUsedViaReflection.SetterOnly), (Type [])null)] + typeof (Type), nameof (Type.GetProperty), new Type[] { typeof (string) }, + typeof (PropertyUsedViaReflection), nameof (PropertyUsedViaReflection.SetterOnly), (Type[]) null)] static void TestSetterOnly () { var property = typeof (PropertyUsedViaReflection).GetProperty ("SetterOnly"); - property.SetValue (null, 42, new object [] { }); + property.SetValue (null, 42, new object[] { }); } [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetProperty), new Type [] { typeof (string) }, - typeof (PropertyUsedViaReflection), nameof (PropertyUsedViaReflection.GetterOnly), (Type [])null)] + typeof (Type), nameof (Type.GetProperty), new Type[] { typeof (string) }, + typeof (PropertyUsedViaReflection), nameof (PropertyUsedViaReflection.GetterOnly), (Type[]) null)] static void TestGetterOnly () { var property = typeof (PropertyUsedViaReflection).GetProperty ("GetterOnly"); - property.GetValue (null, new object [] { }); + property.GetValue (null, new object[] { }); } [Kept] @@ -83,7 +84,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [UnrecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetProperty), new Type [] { typeof (string) })] + typeof (Type), nameof (Type.GetProperty), new Type[] { typeof (string) })] static void TestDataFlowType () { Type type = FindType (); @@ -92,22 +93,22 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetProperty), new Type [] { typeof (string) }, - typeof (IfClass), nameof (IfClass.SetterOnly), (Type [])null)] + typeof (Type), nameof (Type.GetProperty), new Type[] { typeof (string) }, + typeof (IfClass), nameof (IfClass.SetterOnly), (Type[]) null)] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetProperty), new Type [] { typeof (string) }, - typeof (IfClass), nameof (IfClass.GetterOnly), (Type [])null)] + typeof (Type), nameof (Type.GetProperty), new Type[] { typeof (string) }, + typeof (IfClass), nameof (IfClass.GetterOnly), (Type[]) null)] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetProperty), new Type [] { typeof (string) }, - typeof (ElseClass), nameof (ElseClass.SetterOnly), (Type [])null)] + typeof (Type), nameof (Type.GetProperty), new Type[] { typeof (string) }, + typeof (ElseClass), nameof (ElseClass.SetterOnly), (Type[]) null)] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetProperty), new Type [] { typeof (string) }, - typeof (ElseClass), nameof (ElseClass.GetterOnly), (Type [])null)] + typeof (Type), nameof (Type.GetProperty), new Type[] { typeof (string) }, + typeof (ElseClass), nameof (ElseClass.GetterOnly), (Type[]) null)] static void TestIfElse (int i) { Type myType; if (i == 1) { - myType = typeof(IfClass); + myType = typeof (IfClass); } else { myType = typeof (ElseClass); } @@ -122,11 +123,11 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [RecognizedReflectionAccessPattern ( - typeof (Type), nameof (Type.GetProperty), new Type [] { typeof (string) }, - typeof (BaseClass), nameof (BaseClass.GetterSetterOnBaseClass), (Type [])null)] + typeof (Type), nameof (Type.GetProperty), new Type[] { typeof (string) }, + typeof (BaseClass), nameof (BaseClass.GetterSetterOnBaseClass), (Type[]) null)] static void TestPropertyInBaseType () { - var property = typeof(DerivedClass).GetProperty ("GetterSetterOnBaseClass"); + var property = typeof (DerivedClass).GetProperty ("GetterSetterOnBaseClass"); } [Kept] static int _field; @@ -208,8 +209,8 @@ namespace Mono.Linker.Tests.Cases.Reflection { } [Kept] - [KeptBaseType (typeof(BaseClass))] - class DerivedClass : BaseClass + [KeptBaseType (typeof (BaseClass))] + class DerivedClass : BaseClass { } } diff --git a/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructorUsedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructorUsedViaReflection.cs index 92a516dc1..323892588 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructorUsedViaReflection.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructorUsedViaReflection.cs @@ -29,7 +29,7 @@ namespace Mono.Linker.Tests.Cases.Reflection [Kept] static void TestNonKeptStaticConstructor () { - var a = new NonKeptStaticConstructorClass(); + var a = new NonKeptStaticConstructorClass (); } [Kept] @@ -47,9 +47,9 @@ namespace Mono.Linker.Tests.Cases.Reflection } [Kept] - [UnrecognizedReflectionAccessPattern (typeof (RuntimeHelpers), nameof (RuntimeHelpers.RunClassConstructor), new Type [] { typeof (RuntimeTypeHandle) }, - "A value from unknown source is passed into the parameter 'type' of method "+ - "'System.Void System.Runtime.CompilerServices.RuntimeHelpers::RunClassConstructor(System.RuntimeTypeHandle)'. "+ + [UnrecognizedReflectionAccessPattern (typeof (RuntimeHelpers), nameof (RuntimeHelpers.RunClassConstructor), new Type[] { typeof (RuntimeTypeHandle) }, + "A value from unknown source is passed into the parameter 'type' of method " + + "'System.Void System.Runtime.CompilerServices.RuntimeHelpers::RunClassConstructor(System.RuntimeTypeHandle)'. " + "It's not possible to guarantee availability of the target static constructor.")] static void TestDataFlowType () @@ -60,9 +60,9 @@ namespace Mono.Linker.Tests.Cases.Reflection [Kept] [RecognizedReflectionAccessPattern] - [UnrecognizedReflectionAccessPattern (typeof (RuntimeHelpers), nameof (RuntimeHelpers.RunClassConstructor), new Type [] { typeof (RuntimeTypeHandle) }, - "A value from unknown source is passed into the parameter 'type' of method "+ - "'System.Void System.Runtime.CompilerServices.RuntimeHelpers::RunClassConstructor(System.RuntimeTypeHandle)'. "+ + [UnrecognizedReflectionAccessPattern (typeof (RuntimeHelpers), nameof (RuntimeHelpers.RunClassConstructor), new Type[] { typeof (RuntimeTypeHandle) }, + "A value from unknown source is passed into the parameter 'type' of method " + + "'System.Void System.Runtime.CompilerServices.RuntimeHelpers::RunClassConstructor(System.RuntimeTypeHandle)'. " + "It's not possible to guarantee availability of the target static constructor.")] static void TestIfElseUsingRuntimeTypeHandle (int i) @@ -85,10 +85,9 @@ namespace Mono.Linker.Tests.Cases.Reflection Type myType; if (i == 1) { myType = typeof (IfClass2); - }else if (i==2) { + } else if (i == 2) { myType = null; - } - else { + } else { myType = typeof (ElseClass2); } RuntimeHelpers.RunClassConstructor (myType.TypeHandle); diff --git a/test/Mono.Linker.Tests.Cases/Reflection/RuntimeReflectionExtensionsCalls.cs b/test/Mono.Linker.Tests.Cases/Reflection/RuntimeReflectionExtensionsCalls.cs index 7d0eb3fd0..593d79f77 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/RuntimeReflectionExtensionsCalls.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/RuntimeReflectionExtensionsCalls.cs @@ -20,7 +20,7 @@ namespace Mono.Linker.Tests.Cases.Reflection #region GetRuntimeEvent [Kept] [UnrecognizedReflectionAccessPattern (typeof (RuntimeReflectionExtensions), nameof (RuntimeReflectionExtensions.GetRuntimeEvent), - new Type [] { typeof (Type), typeof (string) })] + new Type[] { typeof (Type), typeof (string) })] public static void TestGetRuntimeEvent () { typeof (ClassWithKeptMembers).GetRuntimeEvent ("PublicEvent"); @@ -35,7 +35,7 @@ namespace Mono.Linker.Tests.Cases.Reflection #region GetRuntimeField [Kept] [UnrecognizedReflectionAccessPattern (typeof (RuntimeReflectionExtensions), nameof (RuntimeReflectionExtensions.GetRuntimeField), - new Type [] { typeof (Type), typeof (string) })] + new Type[] { typeof (Type), typeof (string) })] public static void TestGetRuntimeField () { typeof (ClassWithKeptMembers).GetRuntimeField ("PublicField"); @@ -50,7 +50,7 @@ namespace Mono.Linker.Tests.Cases.Reflection #region GetRuntimeMethod [Kept] [UnrecognizedReflectionAccessPattern (typeof (RuntimeReflectionExtensions), nameof (RuntimeReflectionExtensions.GetRuntimeMethod), - new Type [] { typeof (Type), typeof (string), typeof (Type []) })] + new Type[] { typeof (Type), typeof (string), typeof (Type[]) })] public static void TestGetRuntimeMethod () { typeof (ClassWithKeptMembers).GetRuntimeMethod ("PublicMethod", Type.EmptyTypes); @@ -65,7 +65,7 @@ namespace Mono.Linker.Tests.Cases.Reflection #region GetRuntimeProperty [Kept] [UnrecognizedReflectionAccessPattern (typeof (RuntimeReflectionExtensions), nameof (RuntimeReflectionExtensions.GetRuntimeProperty), - new Type [] { typeof (Type), typeof (string) })] + new Type[] { typeof (Type), typeof (string) })] public static void TestGetRuntimeProperty () { typeof (ClassWithKeptMembers).GetRuntimeProperty ("PublicProperty"); diff --git a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs index 667de3320..29725d6e9 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs @@ -2,8 +2,10 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Reflection { - public class TypeUsedViaReflection { +namespace Mono.Linker.Tests.Cases.Reflection +{ + public class TypeUsedViaReflection + { public static void Main () { TestNull (); @@ -86,7 +88,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] [RecognizedReflectionAccessPattern ( typeof (Type), nameof (Type.GetType), new Type[] { typeof (string), typeof (bool) }, - typeof (AType), null, (Type []) null)] + typeof (AType), null, (Type[]) null)] public static void TestType () { const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+AType"; @@ -165,11 +167,14 @@ namespace Mono.Linker.Tests.Cases.Reflection { } [Kept] - class Nested1 { + class Nested1 + { [Kept] - class N2 { + class N2 + { [Kept] - class N3 { + class N3 + { } } } @@ -186,7 +191,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Kept] static void TestTypeOf () { - var typeKept = typeof(TypeOfToKeep); + var typeKept = typeof (TypeOfToKeep); } [Kept] @@ -199,14 +204,14 @@ namespace Mono.Linker.Tests.Cases.Reflection { { string name = null; switch (b) { - case 0: - name = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+TypeFromBranchA"; - break; - case 1: - name = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+TypeFromBranchB"; - break; - default: - break; + case 0: + name = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+TypeFromBranchA"; + break; + case 1: + name = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+TypeFromBranchB"; + break; + default: + break; } var typeKept = Type.GetType (name); diff --git a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionAssemblyDoesntExist.cs b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionAssemblyDoesntExist.cs index 1311ac46f..22595875d 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionAssemblyDoesntExist.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionAssemblyDoesntExist.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Reflection { - public class TypeUsedViaReflectionAssemblyDoesntExist { +namespace Mono.Linker.Tests.Cases.Reflection +{ + public class TypeUsedViaReflectionAssemblyDoesntExist + { public static void Main () { var typeName = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflectionAssemblyDoesntExist+DoesntExist, test"; diff --git a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionInDifferentAssembly.cs b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionInDifferentAssembly.cs index 8df8ee25d..1bf5479a2 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionInDifferentAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionInDifferentAssembly.cs @@ -3,11 +3,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Reflection.Dependencies; -namespace Mono.Linker.Tests.Cases.Reflection { - [SetupCompileBefore ("library.dll", new [] { "Dependencies/AssemblyDependency.cs" })] +namespace Mono.Linker.Tests.Cases.Reflection +{ + [SetupCompileBefore ("library.dll", new[] { "Dependencies/AssemblyDependency.cs" })] [KeptAssembly ("library.dll")] [KeptTypeInAssembly ("library.dll", "Mono.Linker.Tests.Cases.Reflection.Dependencies.AssemblyDependency/TypeThatIsUsedViaReflection")] - public class TypeUsedViaReflectionInDifferentAssembly { + public class TypeUsedViaReflectionInDifferentAssembly + { public static void Main () { AssemblyDependency.UsedToKeepReferenceAtCompileTime (); diff --git a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionLdstrIncomplete.cs b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionLdstrIncomplete.cs index 56c1077bf..7e10e2285 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionLdstrIncomplete.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionLdstrIncomplete.cs @@ -1,11 +1,13 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Reflection { +namespace Mono.Linker.Tests.Cases.Reflection +{ /// <summary> /// This case we can't detect and need to gracefully do nothing /// </summary> - public class TypeUsedViaReflectionLdstrIncomplete { + public class TypeUsedViaReflectionLdstrIncomplete + { public static void Main () { var typePart = GetTypePart (); diff --git a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionLdstrValidButChanged.cs b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionLdstrValidButChanged.cs index e5f4575be..2a53a2454 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionLdstrValidButChanged.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionLdstrValidButChanged.cs @@ -1,8 +1,10 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Reflection { - public class TypeUsedViaReflectionLdstrValidButChanged { +namespace Mono.Linker.Tests.Cases.Reflection +{ + public class TypeUsedViaReflectionLdstrValidButChanged + { public static void Main () { var replace = "Mono.Linker"; diff --git a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionTypeDoesntExist.cs b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionTypeDoesntExist.cs index 3a74846e0..b7eee3e09 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionTypeDoesntExist.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionTypeDoesntExist.cs @@ -2,10 +2,12 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Reflection { +namespace Mono.Linker.Tests.Cases.Reflection +{ [SetupCSharpCompilerToUse ("csc")] [VerifyAllReflectionAccessPatternsAreValidated] - public class TypeUsedViaReflectionTypeDoesntExist { + public class TypeUsedViaReflectionTypeDoesntExist + { public static void Main () { var typeName = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflectionTypeDoesntExist+Full, DoesntExist"; diff --git a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionTypeNameIsSymbol.cs b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionTypeNameIsSymbol.cs index 70500994e..29ab84946 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionTypeNameIsSymbol.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflectionTypeNameIsSymbol.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Reflection { - public class TypeUsedViaReflectionTypeNameIsSymbol { +namespace Mono.Linker.Tests.Cases.Reflection +{ + public class TypeUsedViaReflectionTypeNameIsSymbol + { public static void Main () { var typeName = "+, test"; diff --git a/test/Mono.Linker.Tests.Cases/Reflection/UsedViaReflectionIntegrationTest.cs b/test/Mono.Linker.Tests.Cases/Reflection/UsedViaReflectionIntegrationTest.cs index e0f7edd79..dd3ca0370 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/UsedViaReflectionIntegrationTest.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/UsedViaReflectionIntegrationTest.cs @@ -10,12 +10,12 @@ namespace Mono.Linker.Tests.Cases.Reflection { var test = 42; - var constructor = typeof (OnlyUsedViaReflection).GetConstructor (BindingFlags.Public, null, new Type [] { }, new ParameterModifier [] { }); - constructor.Invoke(null, new object[] { }); + var constructor = typeof (OnlyUsedViaReflection).GetConstructor (BindingFlags.Public, null, new Type[] { }, new ParameterModifier[] { }); + constructor.Invoke (null, new object[] { }); if (test == 42) { var method = typeof (OnlyUsedViaReflection).GetMethod ("OnlyCalledViaReflection", BindingFlags.Static | BindingFlags.NonPublic); - method.Invoke (null, new object [] { }); + method.Invoke (null, new object[] { }); } } diff --git a/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.cs b/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.cs index e90010c7b..a4f012e7c 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.Resources.Dependencies { - public class EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1 { +namespace Mono.Linker.Tests.Cases.Resources.Dependencies +{ + public class EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1 + { public static void Used () { } diff --git a/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1.cs b/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1.cs index a1ca4d678..6d568ed35 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.Resources.Dependencies { - public class EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1 { +namespace Mono.Linker.Tests.Cases.Resources.Dependencies +{ + public class EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1 + { public static void Used () { } diff --git a/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.cs b/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.cs index 65e1ef600..8f9bfaa57 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.Resources.Dependencies { - public class EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1 { +namespace Mono.Linker.Tests.Cases.Resources.Dependencies +{ + public class EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1 + { public static void Used () { } diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy.cs index 05cb22124..17b66e74b 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy.cs @@ -2,17 +2,19 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Resources.Dependencies; -namespace Mono.Linker.Tests.Cases.Resources { +namespace Mono.Linker.Tests.Cases.Resources +{ [SetupCompileBefore ( "EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.dll", - new [] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.cs" }, - resources: new [] {"Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.xml"})] + new[] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.cs" }, + resources: new[] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.xml" })] [SetupLinkerAction ("copy", "EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1")] [IncludeBlacklistStep (true)] [KeptResourceInAssembly ("EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.dll", "EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.xml")] [KeptMemberInAssembly ("EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.dll", typeof (EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1), "Unused()")] - public class EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy { + public class EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy + { public static void Main () { EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.Used (); diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly.cs index 4259b1c58..dac7038a5 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly.cs @@ -2,16 +2,18 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Resources.Dependencies; -namespace Mono.Linker.Tests.Cases.Resources { +namespace Mono.Linker.Tests.Cases.Resources +{ [SetupCompileBefore ( "library.dll", - new [] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1.cs" }, - resources: new [] {"Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1_NotMatchingName.xml"})] + new[] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1.cs" }, + resources: new[] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1_NotMatchingName.xml" })] [IncludeBlacklistStep (true)] [KeptResourceInAssembly ("library.dll", "EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1_NotMatchingName.xml")] [RemovedMemberInAssembly ("library.dll", typeof (EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1), "Unused()")] - public class EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly { + public class EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly + { public static void Main () { EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1.Used (); diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink.cs index 8b477c037..080eb1736 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink.cs @@ -2,17 +2,19 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Resources.Dependencies; -namespace Mono.Linker.Tests.Cases.Resources { +namespace Mono.Linker.Tests.Cases.Resources +{ [SetupCompileBefore ( "EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.dll", - new [] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.cs" }, - resources: new [] {"Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.xml"})] + new[] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.cs" }, + resources: new[] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.xml" })] [SetupLinkerAction ("link", "EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1")] [IncludeBlacklistStep (true)] [RemovedResourceInAssembly ("EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.dll", "EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.xml")] [KeptMemberInAssembly ("EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.dll", typeof (EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1), "Unused()")] - public class EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink { + public class EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink + { public static void Main () { EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.Used (); diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.cs index 69d1d1dc4..fa9ba66a7 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.cs @@ -2,18 +2,21 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Resources { +namespace Mono.Linker.Tests.Cases.Resources +{ [SetupLinkerCoreAction ("link")] [IncludeBlacklistStep (true)] [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.xml", "NotMatchingAnAssemblyName.xml")] [SkipPeVerify] [KeptResource ("NotMatchingAnAssemblyName.xml")] - public class EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly { + public class EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly + { public static void Main () { } - public class Unused { + public class Unused + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.cs index 604520899..2a8227c24 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.cs @@ -2,7 +2,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Resources { +namespace Mono.Linker.Tests.Cases.Resources +{ [SetupLinkerCoreAction ("link")] [IncludeBlacklistStep (false)] @@ -10,12 +11,14 @@ namespace Mono.Linker.Tests.Cases.Resources { [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.xml", "test.xml")] [SkipPeVerify] [KeptResource ("test.xml")] - public class EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled { + public class EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled + { public static void Main () { } - public class Unused { + public class Unused + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessed.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessed.cs index c7a043aaf..c49525f77 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessed.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessed.cs @@ -2,21 +2,24 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Resources { +namespace Mono.Linker.Tests.Cases.Resources +{ [SetupLinkerCoreAction ("link")] [IncludeBlacklistStep (true)] // We need to rename the resource so that it matches the name of an assembly being processed. This is a requriement of the black list step [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsProcessed.xml", "test.xml")] [SkipPeVerify] - public class EmbeddedLinkXmlFileIsProcessed { + public class EmbeddedLinkXmlFileIsProcessed + { public static void Main () { } [Kept] [KeptMember (".ctor()")] - public class Unused { + public class Unused + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessedAndKept.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessedAndKept.cs index a6b25d31b..a93db9e9c 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessedAndKept.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessedAndKept.cs @@ -12,14 +12,16 @@ namespace Mono.Linker.Tests.Cases.Resources [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsProcessedAndKept.xml", "test.xml")] [SkipPeVerify] [KeptResource ("test.xml")] - public class EmbeddedLinkXmlFileIsProcessedAndKept { + public class EmbeddedLinkXmlFileIsProcessedAndKept + { public static void Main () { } [Kept] [KeptMember (".ctor()")] - public class Unused { + public class Unused + { } } } diff --git a/test/Mono.Linker.Tests.Cases/Resources/NonLinkerEmbeddedResourceHasNoImpact.cs b/test/Mono.Linker.Tests.Cases/Resources/NonLinkerEmbeddedResourceHasNoImpact.cs index b2112b92f..76797b42d 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/NonLinkerEmbeddedResourceHasNoImpact.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/NonLinkerEmbeddedResourceHasNoImpact.cs @@ -2,7 +2,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Resources { +namespace Mono.Linker.Tests.Cases.Resources +{ [SetupLinkerCoreAction ("link")] [IncludeBlacklistStep (true)] @@ -10,7 +11,8 @@ namespace Mono.Linker.Tests.Cases.Resources { [SetupCompileResource ("Dependencies/NonLinkerEmbeddedResourceHasNoImpact.xml", "test.xml")] [SkipPeVerify] [KeptResource ("test.xml")] - public class NonLinkerEmbeddedResourceHasNoImpact { + public class NonLinkerEmbeddedResourceHasNoImpact + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Sealer/MethodsDevirtualization.cs b/test/Mono.Linker.Tests.Cases/Sealer/MethodsDevirtualization.cs index ecfae8485..12f9c0427 100644 --- a/test/Mono.Linker.Tests.Cases/Sealer/MethodsDevirtualization.cs +++ b/test/Mono.Linker.Tests.Cases/Sealer/MethodsDevirtualization.cs @@ -7,7 +7,7 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Sealer { [SetupLinkerArgument ("--enable-opt", "sealer")] - [AddedPseudoAttributeAttribute ((uint)TypeAttributes.Sealed)] + [AddedPseudoAttributeAttribute ((uint) TypeAttributes.Sealed)] public class MethodsDevirtualization { public static void Main () @@ -43,12 +43,12 @@ namespace Mono.Linker.Tests.Cases.Sealer.Data } [Kept] - [AddedPseudoAttributeAttribute ((uint)MethodAttributes.Final)] + [AddedPseudoAttributeAttribute ((uint) MethodAttributes.Final)] public virtual bool A () => true; [Kept] public virtual bool B () => false; [Kept] - [AddedPseudoAttributeAttribute ((uint)MethodAttributes.Final)] + [AddedPseudoAttributeAttribute ((uint) MethodAttributes.Final)] public virtual bool C () => false; [Kept] public virtual bool D () => false; @@ -56,7 +56,7 @@ namespace Mono.Linker.Tests.Cases.Sealer.Data [Kept] [KeptBaseType (typeof (BaseClassMethods))] - [AddedPseudoAttributeAttribute ((uint)TypeAttributes.Sealed)] + [AddedPseudoAttributeAttribute ((uint) TypeAttributes.Sealed)] public class Sealable : BaseClassMethods { [Kept] @@ -65,12 +65,12 @@ namespace Mono.Linker.Tests.Cases.Sealer.Data } [Kept] - [AddedPseudoAttributeAttribute ((uint)MethodAttributes.Final)] + [AddedPseudoAttributeAttribute ((uint) MethodAttributes.Final)] public override bool B () => true; [Kept] - [RemovedPseudoAttributeAttribute ((uint)MethodAttributes.Virtual)] - [RemovedPseudoAttributeAttribute ((uint)MethodAttributes.VtableLayoutMask)] + [RemovedPseudoAttributeAttribute ((uint) MethodAttributes.Virtual)] + [RemovedPseudoAttributeAttribute ((uint) MethodAttributes.VtableLayoutMask)] public virtual bool B2 () => false; [Kept] @@ -94,7 +94,7 @@ namespace Mono.Linker.Tests.Cases.Sealer.Data [Kept] [KeptBaseType (typeof (BaseAbstractClassMethods))] - [AddedPseudoAttributeAttribute ((uint)TypeAttributes.Sealed)] + [AddedPseudoAttributeAttribute ((uint) TypeAttributes.Sealed)] public class SealableAbstract : BaseAbstractClassMethods { [Kept] @@ -103,7 +103,7 @@ namespace Mono.Linker.Tests.Cases.Sealer.Data } [Kept] - [AddedPseudoAttributeAttribute ((uint)MethodAttributes.Final)] + [AddedPseudoAttributeAttribute ((uint) MethodAttributes.Final)] public override bool A () => true; } @@ -129,12 +129,12 @@ namespace Mono.Linker.Tests.Cases.Sealer.Data [Kept] [KeptBaseType (typeof (BaseA))] [KeptInterface (typeof (IA))] - [AddedPseudoAttributeAttribute ((uint)TypeAttributes.Sealed)] + [AddedPseudoAttributeAttribute ((uint) TypeAttributes.Sealed)] public class Subclass : BaseA, IA { [Kept] public Subclass () { } - } + } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Sealer/TypesCanBeSealed.cs b/test/Mono.Linker.Tests.Cases/Sealer/TypesCanBeSealed.cs index 93110ab9f..92c366ffa 100644 --- a/test/Mono.Linker.Tests.Cases/Sealer/TypesCanBeSealed.cs +++ b/test/Mono.Linker.Tests.Cases/Sealer/TypesCanBeSealed.cs @@ -7,7 +7,7 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Sealer { [SetupLinkerArgument ("--enable-opt", "sealer")] - [AddedPseudoAttributeAttribute ((uint)TypeAttributes.Sealed)] + [AddedPseudoAttributeAttribute ((uint) TypeAttributes.Sealed)] public class TypesCanBeSealed { public static void Main () @@ -25,7 +25,7 @@ namespace Mono.Linker.Tests.Cases.Sealer } [Kept] - [AddedPseudoAttributeAttribute ((uint)TypeAttributes.Sealed)] + [AddedPseudoAttributeAttribute ((uint) TypeAttributes.Sealed)] class SimpleNestedClass { } @@ -40,7 +40,7 @@ namespace Mono.Linker.Tests.Cases.Sealer namespace Mono.Linker.Tests.Cases.Sealer.Data { [Kept] - [AddedPseudoAttributeAttribute ((uint)TypeAttributes.Sealed)] + [AddedPseudoAttributeAttribute ((uint) TypeAttributes.Sealed)] class SimpleClass { } @@ -57,7 +57,7 @@ namespace Mono.Linker.Tests.Cases.Sealer.Data [Kept] [KeptBaseType (typeof (Base))] - [AddedPseudoAttributeAttribute ((uint)TypeAttributes.Sealed)] + [AddedPseudoAttributeAttribute ((uint) TypeAttributes.Sealed)] class Derived : Base { } @@ -66,7 +66,7 @@ namespace Mono.Linker.Tests.Cases.Sealer.Data class BaseWithNested { [Kept] - [AddedPseudoAttributeAttribute ((uint)TypeAttributes.Sealed)] + [AddedPseudoAttributeAttribute ((uint) TypeAttributes.Sealed)] internal class Nested { } @@ -74,7 +74,7 @@ namespace Mono.Linker.Tests.Cases.Sealer.Data [Kept] [KeptBaseType (typeof (BaseWithNested))] - [AddedPseudoAttributeAttribute ((uint)TypeAttributes.Sealed)] + [AddedPseudoAttributeAttribute ((uint) TypeAttributes.Sealed)] class DerivedWithNested : BaseWithNested { } @@ -84,13 +84,13 @@ namespace Mono.Linker.Tests.Cases.Sealer.Data } [Kept] - [AddedPseudoAttributeAttribute ((uint)TypeAttributes.Sealed)] + [AddedPseudoAttributeAttribute ((uint) TypeAttributes.Sealed)] class BaseWithUnusedDerivedClass { } - class UnusedDerivedClass: BaseWithUnusedDerivedClass + class UnusedDerivedClass : BaseWithUnusedDerivedClass { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Statics/ExplicitStaticCtor.cs b/test/Mono.Linker.Tests.Cases/Statics/ExplicitStaticCtor.cs index 5c1d85343..d379e78c1 100644 --- a/test/Mono.Linker.Tests.Cases/Statics/ExplicitStaticCtor.cs +++ b/test/Mono.Linker.Tests.Cases/Statics/ExplicitStaticCtor.cs @@ -28,7 +28,7 @@ namespace Mono.Linker.Tests.Cases.Statics } } - [AddedPseudoAttributeAttribute ((uint)TypeAttributes.BeforeFieldInit)] + [AddedPseudoAttributeAttribute ((uint) TypeAttributes.BeforeFieldInit)] static class CEmpty { static CEmpty () diff --git a/test/Mono.Linker.Tests.Cases/Statics/StaticFieldInitializer.cs b/test/Mono.Linker.Tests.Cases/Statics/StaticFieldInitializer.cs index 8e460e091..995ff4375 100644 --- a/test/Mono.Linker.Tests.Cases/Statics/StaticFieldInitializer.cs +++ b/test/Mono.Linker.Tests.Cases/Statics/StaticFieldInitializer.cs @@ -9,7 +9,7 @@ namespace Mono.Linker.Tests.Cases.Statics C.Foo (); } - [KeptMember(".cctor()")] + [KeptMember (".cctor()")] static class C { [Kept] diff --git a/test/Mono.Linker.Tests.Cases/Statics/UnusedStaticConstructorGetsRemoved.cs b/test/Mono.Linker.Tests.Cases/Statics/UnusedStaticConstructorGetsRemoved.cs index 83c1d1ea8..f9484271b 100644 --- a/test/Mono.Linker.Tests.Cases/Statics/UnusedStaticConstructorGetsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Statics/UnusedStaticConstructorGetsRemoved.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Statics { - class UnusedStaticConstructorGetsRemoved { +namespace Mono.Linker.Tests.Cases.Statics +{ + class UnusedStaticConstructorGetsRemoved + { public static void Main () { } @@ -11,7 +13,8 @@ namespace Mono.Linker.Tests.Cases.Statics { new B (); } - class B { + class B + { static B () { } diff --git a/test/Mono.Linker.Tests.Cases/Statics/UnusedStaticMethodGetsRemoved.cs b/test/Mono.Linker.Tests.Cases/Statics/UnusedStaticMethodGetsRemoved.cs index 31c7c6ef0..47405c80e 100644 --- a/test/Mono.Linker.Tests.Cases/Statics/UnusedStaticMethodGetsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Statics/UnusedStaticMethodGetsRemoved.cs @@ -1,8 +1,10 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.Statics { - public class UnusedStaticMethodGetsRemoved { +namespace Mono.Linker.Tests.Cases.Statics +{ + public class UnusedStaticMethodGetsRemoved + { public static void Main () { A.UsedMethod (); @@ -10,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Statics { } [Kept] - class A { + class A + { [Kept] public static void UsedMethod () { diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutions.cs b/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutions.cs index 479be2d6f..3a3d6cef4 100644 --- a/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutions.cs +++ b/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutions.cs @@ -13,7 +13,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldstr", "newobj", "throw" diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/FeatureSubstitutions.cs b/test/Mono.Linker.Tests.Cases/Substitutions/FeatureSubstitutions.cs index 980451da4..a4ec6bf0e 100644 --- a/test/Mono.Linker.Tests.Cases/Substitutions/FeatureSubstitutions.cs +++ b/test/Mono.Linker.Tests.Cases/Substitutions/FeatureSubstitutions.cs @@ -10,7 +10,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions [Kept] static bool IsOptionalFeatureEnabled { [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.0", "ret", })] @@ -24,7 +24,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions [Kept] [ExpectBodyModified] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "brfalse", "call", diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/FeatureSubstitutionsNested.cs b/test/Mono.Linker.Tests.Cases/Substitutions/FeatureSubstitutionsNested.cs index 5e124ee48..a54b37f78 100644 --- a/test/Mono.Linker.Tests.Cases/Substitutions/FeatureSubstitutionsNested.cs +++ b/test/Mono.Linker.Tests.Cases/Substitutions/FeatureSubstitutionsNested.cs @@ -14,47 +14,52 @@ namespace Mono.Linker.Tests.Cases.Substitutions [SetupLinkerArgument ("--feature", "FieldCondition", "true")] public class FeatureSubstitutionsNested { - public static void Main () { + public static void Main () + { GlobalConditionMethod (); AssemblyConditionMethod (); TypeConditionMethod (); MethodConditionMethod (); _ = FieldConditionField; } - + [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.1", "ret", })] - static bool GlobalConditionMethod () { + static bool GlobalConditionMethod () + { throw new NotImplementedException (); } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.0", "ret", })] - static bool AssemblyConditionMethod () { + static bool AssemblyConditionMethod () + { throw new NotImplementedException (); } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.1", "ret", })] - static bool TypeConditionMethod () { + static bool TypeConditionMethod () + { throw new NotImplementedException (); } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.0", "ret", })] - static bool MethodConditionMethod () { + static bool MethodConditionMethod () + { throw new NotImplementedException (); } @@ -62,7 +67,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions static readonly bool FieldConditionField; [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "nop", "ldc.i4.1", "stsfld", diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/InitField.cs b/test/Mono.Linker.Tests.Cases/Substitutions/InitField.cs index 1cc85c334..9db2951f6 100644 --- a/test/Mono.Linker.Tests.Cases/Substitutions/InitField.cs +++ b/test/Mono.Linker.Tests.Cases/Substitutions/InitField.cs @@ -10,7 +10,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions [Kept] static readonly bool BoolValue; - public static void Main() + public static void Main () { TestField_1 (); } diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/InitFieldExistingCctor.cs b/test/Mono.Linker.Tests.Cases/Substitutions/InitFieldExistingCctor.cs index 4095116a7..a831266e8 100644 --- a/test/Mono.Linker.Tests.Cases/Substitutions/InitFieldExistingCctor.cs +++ b/test/Mono.Linker.Tests.Cases/Substitutions/InitFieldExistingCctor.cs @@ -8,7 +8,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions public class InitFieldExistingCctor { [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.s", "pop", "ldc.i4", @@ -23,7 +23,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions [Kept] static readonly int IntValue; - public static void Main() + public static void Main () { TestField_1 (); } diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/RemoveBody.cs b/test/Mono.Linker.Tests.Cases/Substitutions/RemoveBody.cs index cd9f5285c..0ee0e188e 100644 --- a/test/Mono.Linker.Tests.Cases/Substitutions/RemoveBody.cs +++ b/test/Mono.Linker.Tests.Cases/Substitutions/RemoveBody.cs @@ -18,7 +18,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions struct NestedType { [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldstr", "newobj", "throw" @@ -29,7 +29,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldarg.0", "call", "ldstr", @@ -41,7 +41,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldstr", "newobj", "throw" @@ -51,7 +51,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldstr", "newobj", "throw" diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/StubBody.cs b/test/Mono.Linker.Tests.Cases/Substitutions/StubBody.cs index a22e9b9bd..f046b25ff 100644 --- a/test/Mono.Linker.Tests.Cases/Substitutions/StubBody.cs +++ b/test/Mono.Linker.Tests.Cases/Substitutions/StubBody.cs @@ -2,9 +2,11 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Substitutions { +namespace Mono.Linker.Tests.Cases.Substitutions +{ [SetupLinkerSubstitutionFile ("StubBody.xml")] - public class StubBody { + public class StubBody + { public static void Main () { new StubBody (); @@ -25,9 +27,10 @@ namespace Mono.Linker.Tests.Cases.Substitutions { TestMethod_13 (); } - struct NestedType { + struct NestedType + { [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ret", })] public NestedType (int arg) @@ -37,7 +40,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions { } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldarg.0", "call", "ret", @@ -48,7 +51,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions { } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldnull", "ret", })] @@ -58,7 +61,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions { } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.0", "ret", })] @@ -68,7 +71,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions { } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.0", "ret", })] @@ -78,7 +81,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions { } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldloca.s", "initobj", "ldloc.0", @@ -91,7 +94,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions { } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.0", "ret", })] @@ -101,7 +104,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions { } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ret", })] static void TestMethod_6 () @@ -110,7 +113,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions { } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.r8", "ret", })] @@ -122,7 +125,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions { } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldloca.s", "initobj", "ldloc.0", @@ -135,7 +138,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions { } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.r4", "ret", })] @@ -147,7 +150,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions { } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i8", "ret", })] @@ -157,17 +160,17 @@ namespace Mono.Linker.Tests.Cases.Substitutions { } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldnull", "ret", })] - static long [] TestMethod_11 () + static long[] TestMethod_11 () { throw new NotImplementedException (); } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldnull", "ret", })] @@ -177,7 +180,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions { } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldnull", "ret", })] diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/StubBodyInvalidSyntax.cs b/test/Mono.Linker.Tests.Cases/Substitutions/StubBodyInvalidSyntax.cs index a5c302d10..a10c02fbe 100644 --- a/test/Mono.Linker.Tests.Cases/Substitutions/StubBodyInvalidSyntax.cs +++ b/test/Mono.Linker.Tests.Cases/Substitutions/StubBodyInvalidSyntax.cs @@ -7,7 +7,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions [SetupLinkerSubstitutionFile ("StubBodyInvalidSyntax.xml")] public class StubBodyInvalidSyntax { - public static void Main() + public static void Main () { new StubBodyInvalidSyntax (); @@ -26,7 +26,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - public StubBodyInvalidSyntax() + public StubBodyInvalidSyntax () { throw new NotImplementedException (); } @@ -56,19 +56,19 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - static bool TestMethod_5() + static bool TestMethod_5 () { return true; } [Kept] - static void TestMethod_6() + static void TestMethod_6 () { TestMethod_5 (); } [Kept] - static double TestMethod_7() + static double TestMethod_7 () { throw new NotImplementedException (); } @@ -80,25 +80,25 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - static float TestMethod_9() + static float TestMethod_9 () { throw new NotImplementedException (); } [Kept] - static ulong TestMethod_10() + static ulong TestMethod_10 () { throw new NotImplementedException (); - } + } [Kept] - static long[] TestMethod_11() + static long[] TestMethod_11 () { throw new NotImplementedException (); - } + } [Kept] - static object TestMethod_12() + static object TestMethod_12 () { throw new NotImplementedException (); } diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/StubBodyUnsafe.cs b/test/Mono.Linker.Tests.Cases/Substitutions/StubBodyUnsafe.cs index 6b95568b1..184808279 100644 --- a/test/Mono.Linker.Tests.Cases/Substitutions/StubBodyUnsafe.cs +++ b/test/Mono.Linker.Tests.Cases/Substitutions/StubBodyUnsafe.cs @@ -2,18 +2,20 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Substitutions { +namespace Mono.Linker.Tests.Cases.Substitutions +{ [SetupLinkerSubstitutionFile ("StubBodyUnsafe.xml")] [SetupCompileArgument ("/unsafe")] [SkipPeVerify] - public class StubBodyUnsafe { + public class StubBodyUnsafe + { public static unsafe void Main () { TestMethod_1 (); } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.0", "conv.i", "ret", diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/StubBodyWithValue.cs b/test/Mono.Linker.Tests.Cases/Substitutions/StubBodyWithValue.cs index 77d6716d4..7d5ae69b2 100644 --- a/test/Mono.Linker.Tests.Cases/Substitutions/StubBodyWithValue.cs +++ b/test/Mono.Linker.Tests.Cases/Substitutions/StubBodyWithValue.cs @@ -7,7 +7,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions [SetupLinkerSubstitutionFile ("StubBodyWithValue.xml")] public class StubBodyWithValue { - public static void Main() + public static void Main () { TestMethod_1 (); TestMethod_2 (); @@ -24,7 +24,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldstr", "ret", })] @@ -34,7 +34,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4", "ret", })] @@ -44,7 +44,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4", "ret", })] @@ -54,7 +54,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4", "ret" })] @@ -64,37 +64,37 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.1", "ret", })] - static bool TestMethod_5() + static bool TestMethod_5 () { throw new NotImplementedException (); } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.1", "ret", })] - static bool TestMethod_6() + static bool TestMethod_6 () { throw new NotImplementedException (); } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.r8", "ret", })] - static double TestMethod_7() + static double TestMethod_7 () { throw new NotImplementedException (); } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4", "ret" })] @@ -104,27 +104,27 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.r4", "ret", })] - static float TestMethod_9() + static float TestMethod_9 () { throw new NotImplementedException (); } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i8", "ret", })] - static ulong TestMethod_10() + static ulong TestMethod_10 () { throw new NotImplementedException (); } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i8", "ret", })] @@ -134,7 +134,7 @@ namespace Mono.Linker.Tests.Cases.Substitutions } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4", "ret", })] diff --git a/test/Mono.Linker.Tests.Cases/Symbols/AssemblyWithDefaultSymbols.cs b/test/Mono.Linker.Tests.Cases/Symbols/AssemblyWithDefaultSymbols.cs index 5ce300138..290f1ea11 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/AssemblyWithDefaultSymbols.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/AssemblyWithDefaultSymbols.cs @@ -1,11 +1,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileArgument ("/debug:full")] [SetupLinkerLinkSymbols ("false")] [RemovedSymbols ("test.exe")] - public class AssemblyWithDefaultSymbols { + public class AssemblyWithDefaultSymbols + { static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/AssemblyWithDefaultSymbolsAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/AssemblyWithDefaultSymbolsAndSymbolLinkingEnabled.cs index 3c9ea4df7..d8bfaf69a 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/AssemblyWithDefaultSymbolsAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/AssemblyWithDefaultSymbolsAndSymbolLinkingEnabled.cs @@ -1,11 +1,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileArgument ("/debug:full")] [SetupLinkerLinkSymbols ("true")] [KeptSymbols ("test.exe")] - public class AssemblyWithDefaultSymbolsAndSymbolLinkingEnabled { + public class AssemblyWithDefaultSymbolsAndSymbolLinkingEnabled + { static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithCompilerDefaultSymbols.cs b/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithCompilerDefaultSymbols.cs index 38de58e93..f54c08cdd 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithCompilerDefaultSymbols.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithCompilerDefaultSymbols.cs @@ -1,9 +1,11 @@ -namespace Mono.Linker.Tests.Cases.Symbols.Dependencies { - public class LibraryWithCompilerDefaultSymbols { +namespace Mono.Linker.Tests.Cases.Symbols.Dependencies +{ + public class LibraryWithCompilerDefaultSymbols + { public static void SomeMethod () { } - + static void NotUsed () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithEmbeddedPdbSymbols.cs b/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithEmbeddedPdbSymbols.cs index 578d8bf36..6450080e7 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithEmbeddedPdbSymbols.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithEmbeddedPdbSymbols.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Symbols.Dependencies { - public class LibraryWithEmbeddedPdbSymbols { +namespace Mono.Linker.Tests.Cases.Symbols.Dependencies +{ + public class LibraryWithEmbeddedPdbSymbols + { public static void SomeMethod () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithMdb/LibraryWithMdb.cs b/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithMdb/LibraryWithMdb.cs index efb2d5481..5712f5ce7 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithMdb/LibraryWithMdb.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithMdb/LibraryWithMdb.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.Symbols.Dependencies { - public class LibraryWithMdb { +namespace Mono.Linker.Tests.Cases.Symbols.Dependencies +{ + public class LibraryWithMdb + { public static void SomeMethod () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithPdb/LibraryWithPdb.cs b/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithPdb/LibraryWithPdb.cs index 339c836fe..4584818e7 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithPdb/LibraryWithPdb.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithPdb/LibraryWithPdb.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.Symbols.Dependencies { - public class LibraryWithPdb { +namespace Mono.Linker.Tests.Cases.Symbols.Dependencies +{ + public class LibraryWithPdb + { public static void SomeMethod () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithPortablePdbSymbols.cs b/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithPortablePdbSymbols.cs index 0c574f554..39ee56304 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithPortablePdbSymbols.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/Dependencies/LibraryWithPortablePdbSymbols.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.Symbols.Dependencies { - public class LibraryWithPortablePdbSymbols { +namespace Mono.Linker.Tests.Cases.Symbols.Dependencies +{ + public class LibraryWithPortablePdbSymbols + { public static void SomeMethod () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdb.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdb.cs index d79b85df3..8eb4836ce 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdb.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdb.cs @@ -3,7 +3,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithEmbeddedPdbSymbols.dll", new[] { "Dependencies/LibraryWithEmbeddedPdbSymbols.cs" }, additionalArguments: "/debug:embedded", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("false")] @@ -11,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Symbols { [KeptMemberInAssembly ("LibraryWithEmbeddedPdbSymbols.dll", typeof (LibraryWithEmbeddedPdbSymbols), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithEmbeddedPdbSymbols.dll", typeof (LibraryWithEmbeddedPdbSymbols), "NotUsed()")] - class ReferenceWithEmbeddedPdb { + class ReferenceWithEmbeddedPdb + { static void Main () { LibraryWithEmbeddedPdbSymbols.SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbAndSymbolLinkingEnabled.cs index e99e5701b..1265d927e 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbAndSymbolLinkingEnabled.cs @@ -3,7 +3,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithEmbeddedPdbSymbols.dll", new[] { "Dependencies/LibraryWithEmbeddedPdbSymbols.cs" }, additionalArguments: "/debug:embedded", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("true")] @@ -11,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Symbols { [KeptMemberInAssembly ("LibraryWithEmbeddedPdbSymbols.dll", typeof (LibraryWithEmbeddedPdbSymbols), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithEmbeddedPdbSymbols.dll", typeof (LibraryWithEmbeddedPdbSymbols), "NotUsed()")] - class ReferenceWithEmbeddedPdbAndSymbolLinkingEnabled { + class ReferenceWithEmbeddedPdbAndSymbolLinkingEnabled + { static void Main () { LibraryWithEmbeddedPdbSymbols.SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbAndSymbolLinkingEnabledAndDeterministicMvid.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbAndSymbolLinkingEnabledAndDeterministicMvid.cs index b8beb1abc..228c31fe0 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbAndSymbolLinkingEnabledAndDeterministicMvid.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbAndSymbolLinkingEnabledAndDeterministicMvid.cs @@ -2,7 +2,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithEmbeddedPdbSymbols.dll", new[] { "Dependencies/LibraryWithEmbeddedPdbSymbols.cs" }, additionalArguments: "/debug:embedded", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("true")] [SetupLinkerArgument ("--deterministic")] @@ -11,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Symbols { [KeptMemberInAssembly ("LibraryWithEmbeddedPdbSymbols.dll", typeof (LibraryWithEmbeddedPdbSymbols), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithEmbeddedPdbSymbols.dll", typeof (LibraryWithEmbeddedPdbSymbols), "NotUsed()")] - public class ReferenceWithEmbeddedPdbAndSymbolLinkingEnabledAndDeterministicMvid { + public class ReferenceWithEmbeddedPdbAndSymbolLinkingEnabledAndDeterministicMvid + { static void Main () { LibraryWithEmbeddedPdbSymbols.SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbAndSymbolLinkingEnabledAndNewMvid.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbAndSymbolLinkingEnabledAndNewMvid.cs index 17381c954..772ee3635 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbAndSymbolLinkingEnabledAndNewMvid.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbAndSymbolLinkingEnabledAndNewMvid.cs @@ -2,7 +2,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithEmbeddedPdbSymbols.dll", new[] { "Dependencies/LibraryWithEmbeddedPdbSymbols.cs" }, additionalArguments: "/debug:embedded", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("true")] [SetupLinkerArgument ("--deterministic")] @@ -11,7 +12,8 @@ namespace Mono.Linker.Tests.Cases.Symbols { [KeptMemberInAssembly ("LibraryWithEmbeddedPdbSymbols.dll", typeof (LibraryWithEmbeddedPdbSymbols), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithEmbeddedPdbSymbols.dll", typeof (LibraryWithEmbeddedPdbSymbols), "NotUsed()")] - public class ReferenceWithEmbeddedPdbAndSymbolLinkingEnabledAndNewMvid { + public class ReferenceWithEmbeddedPdbAndSymbolLinkingEnabledAndNewMvid + { static void Main () { LibraryWithEmbeddedPdbSymbols.SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbCopyAction.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbCopyAction.cs index d58ef3041..15ee534aa 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbCopyAction.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbCopyAction.cs @@ -2,17 +2,19 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithEmbeddedPdbSymbols.dll", new[] { "Dependencies/LibraryWithEmbeddedPdbSymbols.cs" }, additionalArguments: "/debug:embedded", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("false")] [SetupLinkerAction ("copy", "LibraryWithEmbeddedPdbSymbols")] [RemovedSymbols ("LibraryWithEmbeddedPdbSymbols.dll")] - + // Copying with symbol linking off is a little more complex for embedded pdbs. // Do a little extra asserting here to make sure the assembly wasn't accidentally linked [KeptMemberInAssembly ("LibraryWithEmbeddedPdbSymbols.dll", typeof (LibraryWithEmbeddedPdbSymbols), "NotUsed()")] - public class ReferenceWithEmbeddedPdbCopyAction { + public class ReferenceWithEmbeddedPdbCopyAction + { static void Main () { LibraryWithEmbeddedPdbSymbols.SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbCopyActionAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbCopyActionAndSymbolLinkingEnabled.cs index ca173f827..5e2022746 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbCopyActionAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbCopyActionAndSymbolLinkingEnabled.cs @@ -2,13 +2,15 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithEmbeddedPdbSymbols.dll", new[] { "Dependencies/LibraryWithEmbeddedPdbSymbols.cs" }, additionalArguments: "/debug:embedded", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("true")] [SetupLinkerAction ("copy", "LibraryWithEmbeddedPdbSymbols")] [KeptSymbols ("LibraryWithEmbeddedPdbSymbols.dll")] - public class ReferenceWithEmbeddedPdbCopyActionAndSymbolLinkingEnabled { + public class ReferenceWithEmbeddedPdbCopyActionAndSymbolLinkingEnabled + { static void Main () { LibraryWithEmbeddedPdbSymbols.SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbDeleteAction.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbDeleteAction.cs index ecbe6aa89..a1facb303 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbDeleteAction.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbDeleteAction.cs @@ -2,13 +2,15 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithEmbeddedPdbSymbols.dll", new[] { "Dependencies/LibraryWithEmbeddedPdbSymbols.cs" }, additionalArguments: "/debug:embedded", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("false")] [RemovedAssembly ("LibraryWithEmbeddedPdbSymbols.dll")] [RemovedSymbols ("LibraryWithEmbeddedPdbSymbols.dll")] - public class ReferenceWithEmbeddedPdbDeleteAction { + public class ReferenceWithEmbeddedPdbDeleteAction + { static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbDeleteActionAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbDeleteActionAndSymbolLinkingEnabled.cs index d31e0753f..57ae72a72 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbDeleteActionAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithEmbeddedPdbDeleteActionAndSymbolLinkingEnabled.cs @@ -2,13 +2,15 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithEmbeddedPdbSymbols.dll", new[] { "Dependencies/LibraryWithEmbeddedPdbSymbols.cs" }, additionalArguments: "/debug:embedded", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("true")] [RemovedAssembly ("LibraryWithEmbeddedPdbSymbols.dll")] [RemovedSymbols ("LibraryWithEmbeddedPdbSymbols.dll")] - public class ReferenceWithEmbeddedPdbDeleteActionAndSymbolLinkingEnabled { + public class ReferenceWithEmbeddedPdbDeleteActionAndSymbolLinkingEnabled + { static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdb.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdb.cs index 657317dda..fe2255de2 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdb.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdb.cs @@ -3,7 +3,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll.mdb")] [SetupLinkerLinkSymbols ("false")] @@ -12,8 +13,9 @@ namespace Mono.Linker.Tests.Cases.Symbols { [KeptMemberInAssembly ("LibraryWithMdb.dll", typeof (LibraryWithMdb), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithMdb.dll", typeof (LibraryWithMdb), "NotUsed()")] - public class ReferenceWithMdb { - static void Main() + public class ReferenceWithMdb + { + static void Main () { // Use some stuff so that we can verify that the linker output correct results SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbAndSymbolLinkingEnabled.cs index a30a2d1d9..ae5a3f3b9 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbAndSymbolLinkingEnabled.cs @@ -5,7 +5,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll.mdb")] [SetupLinkerLinkSymbols ("true")] @@ -14,7 +15,8 @@ namespace Mono.Linker.Tests.Cases.Symbols { [KeptMemberInAssembly ("LibraryWithMdb.dll", typeof (LibraryWithMdb), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithMdb.dll", typeof (LibraryWithMdb), "NotUsed()")] - public class ReferenceWithMdbAndSymbolLinkingEnabled { + public class ReferenceWithMdbAndSymbolLinkingEnabled + { static void Main () { // Use some stuff so that we can verify that the linker output correct results diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbAndSymbolLinkingEnabledAndDeterministicMvid.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbAndSymbolLinkingEnabledAndDeterministicMvid.cs index e304375b0..b1503ae52 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbAndSymbolLinkingEnabledAndDeterministicMvid.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbAndSymbolLinkingEnabledAndDeterministicMvid.cs @@ -2,7 +2,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [IgnoreTestCase ("Requires cecil updated with fix for https://github.com/jbevain/cecil/issues/583")] [Reference ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll.mdb")] @@ -13,7 +14,8 @@ namespace Mono.Linker.Tests.Cases.Symbols { [KeptMemberInAssembly ("LibraryWithMdb.dll", typeof (LibraryWithMdb), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithMdb.dll", typeof (LibraryWithMdb), "NotUsed()")] - public class ReferenceWithMdbAndSymbolLinkingEnabledAndDeterministicMvid { + public class ReferenceWithMdbAndSymbolLinkingEnabledAndDeterministicMvid + { static void Main () { // Use some stuff so that we can verify that the linker output correct results diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbAndSymbolLinkingEnabledAndNewMvid.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbAndSymbolLinkingEnabledAndNewMvid.cs index 3e124c012..e90df9201 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbAndSymbolLinkingEnabledAndNewMvid.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbAndSymbolLinkingEnabledAndNewMvid.cs @@ -4,7 +4,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll.mdb")] [SetupLinkerLinkSymbols ("true")] @@ -14,7 +15,8 @@ namespace Mono.Linker.Tests.Cases.Symbols { [KeptMemberInAssembly ("LibraryWithMdb.dll", typeof (LibraryWithMdb), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithMdb.dll", typeof (LibraryWithMdb), "NotUsed()")] - public class ReferenceWithMdbAndSymbolLinkingEnabledAndNewMvid { + public class ReferenceWithMdbAndSymbolLinkingEnabledAndNewMvid + { static void Main () { // Use some stuff so that we can verify that the linker output correct results diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbCopyAction.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbCopyAction.cs index 9be79875e..7ca36cb2a 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbCopyAction.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbCopyAction.cs @@ -2,14 +2,16 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll.mdb")] [SetupLinkerLinkSymbols ("false")] [SetupLinkerAction ("copy", "LibraryWithMdb")] [RemovedSymbols ("LibraryWithMdb.dll")] - public class ReferenceWithMdbCopyAction { + public class ReferenceWithMdbCopyAction + { static void Main () { LibraryWithMdb.SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbCopyActionAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbCopyActionAndSymbolLinkingEnabled.cs index 766da8771..11a0b5e34 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbCopyActionAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbCopyActionAndSymbolLinkingEnabled.cs @@ -4,14 +4,16 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll.mdb")] [SetupLinkerLinkSymbols ("true")] [SetupLinkerAction ("copy", "LibraryWithMdb")] [KeptSymbols ("LibraryWithMdb.dll")] - public class ReferenceWithMdbCopyActionAndSymbolLinkingEnabled { + public class ReferenceWithMdbCopyActionAndSymbolLinkingEnabled + { static void Main () { LibraryWithMdb.SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbDeleteAction.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbDeleteAction.cs index 7b8ce67d7..16d4f799e 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbDeleteAction.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbDeleteAction.cs @@ -2,14 +2,16 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll.mdb")] [SetupLinkerLinkSymbols ("false")] [RemovedAssembly ("LibraryWithMdb.dll")] [RemovedSymbols ("LibraryWithMdb.dll")] - public class ReferenceWithMdbDeleteAction { + public class ReferenceWithMdbDeleteAction + { static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbDeleteActionAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbDeleteActionAndSymbolLinkingEnabled.cs index 1f32f61ef..34f9be8b1 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbDeleteActionAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbDeleteActionAndSymbolLinkingEnabled.cs @@ -2,14 +2,16 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll.mdb")] [SetupLinkerLinkSymbols ("true")] [RemovedAssembly ("LibraryWithMdb.dll")] [RemovedSymbols ("LibraryWithMdb.dll")] - public class ReferenceWithMdbDeleteActionAndSymbolLinkingEnabled { + public class ReferenceWithMdbDeleteActionAndSymbolLinkingEnabled + { static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdb.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdb.cs index fd51cdb07..6ec054dcd 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdb.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdb.cs @@ -2,7 +2,8 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithPdb/LibraryWithPdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithPdb/LibraryWithPdb.pdb")] [SetupLinkerLinkSymbols ("false")] @@ -10,8 +11,9 @@ namespace Mono.Linker.Tests.Cases.Symbols { [RemovedSymbols ("LibraryWithPdb.dll")] [KeptMemberInAssembly ("LibraryWithPdb.dll", typeof (LibraryWithPdb), "SomeMethod()")] - [RemovedMemberInAssembly ("LibraryWithPdb.dll",typeof (LibraryWithPdb), "NotUsed()")] - public class ReferenceWithPdb { + [RemovedMemberInAssembly ("LibraryWithPdb.dll", typeof (LibraryWithPdb), "NotUsed()")] + public class ReferenceWithPdb + { static void Main () { // Use some stuff so that we can verify that the linker output correct results diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabled.cs index 1749b2e69..d7f9ff889 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabled.cs @@ -3,10 +3,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithPdb/LibraryWithPdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithPdb/LibraryWithPdb.pdb")] - [SetupLinkerLinkSymbols( "true")] + [SetupLinkerLinkSymbols ("true")] #if WIN32 [KeptSymbols ("LibraryWithPdb.dll")] @@ -15,11 +16,12 @@ namespace Mono.Linker.Tests.Cases.Symbols { #endif [KeptMemberInAssembly ("LibraryWithPdb.dll", typeof (LibraryWithPdb), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithPdb.dll", typeof (LibraryWithPdb), "NotUsed()")] - class ReferenceWithPdbAndSymbolLinkingEnabled { + class ReferenceWithPdbAndSymbolLinkingEnabled + { static void Main () { // Use some stuff so that we can verify that the linker output correct results - SomeMethod(); + SomeMethod (); LibraryWithPdb.SomeMethod (); } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabledAndDeterministicMvid.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabledAndDeterministicMvid.cs index 32f7fb568..bfaf6f9fe 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabledAndDeterministicMvid.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabledAndDeterministicMvid.cs @@ -2,10 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithPdb/LibraryWithPdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithPdb/LibraryWithPdb.pdb")] - [SetupLinkerLinkSymbols( "true")] + [SetupLinkerLinkSymbols ("true")] [SetupLinkerArgument ("--deterministic")] #if WIN32 @@ -15,11 +16,12 @@ namespace Mono.Linker.Tests.Cases.Symbols { #endif [KeptMemberInAssembly ("LibraryWithPdb.dll", typeof (LibraryWithPdb), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithPdb.dll", typeof (LibraryWithPdb), "NotUsed()")] - public class ReferenceWithPdbAndSymbolLinkingEnabledAndDeterministicMvid { + public class ReferenceWithPdbAndSymbolLinkingEnabledAndDeterministicMvid + { static void Main () { // Use some stuff so that we can verify that the linker output correct results - SomeMethod(); + SomeMethod (); LibraryWithPdb.SomeMethod (); } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabledAndNewMvid.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabledAndNewMvid.cs index eda780122..dc26e804c 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabledAndNewMvid.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabledAndNewMvid.cs @@ -2,10 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithPdb/LibraryWithPdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithPdb/LibraryWithPdb.pdb")] - [SetupLinkerLinkSymbols( "true")] + [SetupLinkerLinkSymbols ("true")] [SetupLinkerArgument ("--new-mvid", "true")] #if WIN32 @@ -15,11 +16,12 @@ namespace Mono.Linker.Tests.Cases.Symbols { #endif [KeptMemberInAssembly ("LibraryWithPdb.dll", typeof (LibraryWithPdb), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithPdb.dll", typeof (LibraryWithPdb), "NotUsed()")] - public class ReferenceWithPdbAndSymbolLinkingEnabledAndNewMvid { + public class ReferenceWithPdbAndSymbolLinkingEnabledAndNewMvid + { static void Main () { // Use some stuff so that we can verify that the linker output correct results - SomeMethod(); + SomeMethod (); LibraryWithPdb.SomeMethod (); } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbCopyAction.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbCopyAction.cs index 18e6c817a..b3cac848c 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbCopyAction.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbCopyAction.cs @@ -2,14 +2,16 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithPdb/LibraryWithPdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithPdb/LibraryWithPdb.pdb")] [SetupLinkerLinkSymbols ("false")] [SetupLinkerAction ("copy", "LibraryWithPdb")] [RemovedSymbols ("LibraryWithPdb.dll")] - public class ReferenceWithPdbCopyAction { + public class ReferenceWithPdbCopyAction + { static void Main () { LibraryWithPdb.SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbCopyActionAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbCopyActionAndSymbolLinkingEnabled.cs index 28e62e1d5..e457b9952 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbCopyActionAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbCopyActionAndSymbolLinkingEnabled.cs @@ -2,7 +2,8 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ #if NETCOREAPP && !WIN32 // .NET Core type forwarders cause the assembly action to be // changed from "copy" to "save" (to remove references to removed @@ -16,7 +17,8 @@ namespace Mono.Linker.Tests.Cases.Symbols { [SetupLinkerAction ("copy", "LibraryWithPdb")] [KeptSymbols ("LibraryWithPdb.dll")] - public class ReferenceWithPdbCopyActionAndSymbolLinkingEnabled { + public class ReferenceWithPdbCopyActionAndSymbolLinkingEnabled + { static void Main () { LibraryWithPdb.SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbDeleteAction.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbDeleteAction.cs index 8f5e037f8..f691a7c6b 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbDeleteAction.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbDeleteAction.cs @@ -2,14 +2,16 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithPdb/LibraryWithPdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithPdb/LibraryWithPdb.pdb")] [SetupLinkerLinkSymbols ("false")] [RemovedAssembly ("LibraryWithPdb.dll")] [RemovedSymbols ("LibraryWithPdb.dll")] - public class ReferenceWithPdbDeleteAction { + public class ReferenceWithPdbDeleteAction + { static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbDeleteActionAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbDeleteActionAndSymbolLinkingEnabled.cs index 44b3df38c..668ed239d 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbDeleteActionAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbDeleteActionAndSymbolLinkingEnabled.cs @@ -2,14 +2,16 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithPdb/LibraryWithPdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithPdb/LibraryWithPdb.pdb")] [SetupLinkerLinkSymbols ("true")] [RemovedAssembly ("LibraryWithPdb.dll")] [RemovedSymbols ("LibraryWithPdb.dll")] - public class ReferenceWithPdbDeleteActionAndSymbolLinkingEnabled { + public class ReferenceWithPdbDeleteActionAndSymbolLinkingEnabled + { static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdb.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdb.cs index cb16c5dd1..7fa2733ad 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdb.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdb.cs @@ -3,15 +3,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithPortablePdbSymbols.dll", new[] { "Dependencies/LibraryWithPortablePdbSymbols.cs" }, additionalArguments: "/debug:portable", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("false")] [RemovedSymbols ("LibraryWithPortablePdbSymbols.dll")] - [KeptMemberInAssembly("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "SomeMethod()")] - [RemovedMemberInAssembly("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "NotUsed()")] - class ReferenceWithPortablePdb { + [KeptMemberInAssembly ("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "SomeMethod()")] + [RemovedMemberInAssembly ("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "NotUsed()")] + class ReferenceWithPortablePdb + { static void Main () { LibraryWithPortablePdbSymbols.SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbAndSymbolLinkingEnabled.cs index dd35d6abc..291ec6bdd 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbAndSymbolLinkingEnabled.cs @@ -3,7 +3,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithPortablePdbSymbols.dll", new[] { "Dependencies/LibraryWithPortablePdbSymbols.cs" }, additionalArguments: "/debug:portable", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("true")] @@ -11,8 +12,9 @@ namespace Mono.Linker.Tests.Cases.Symbols { [KeptMemberInAssembly ("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "NotUsed()")] - class ReferenceWithPortablePdbAndSymbolLinkingEnabled { - static void Main() + class ReferenceWithPortablePdbAndSymbolLinkingEnabled + { + static void Main () { LibraryWithPortablePdbSymbols.SomeMethod (); } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbAndSymbolLinkingEnabledAndDeterministicMvid.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbAndSymbolLinkingEnabledAndDeterministicMvid.cs index 33e9cb8a6..25f9808eb 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbAndSymbolLinkingEnabledAndDeterministicMvid.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbAndSymbolLinkingEnabledAndDeterministicMvid.cs @@ -2,7 +2,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [IgnoreTestCase ("Requires cecil updated with fix for https://github.com/jbevain/cecil/issues/583")] [SetupCompileBefore ("LibraryWithPortablePdbSymbols.dll", new[] { "Dependencies/LibraryWithPortablePdbSymbols.cs" }, additionalArguments: "/debug:portable", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("true")] @@ -12,8 +13,9 @@ namespace Mono.Linker.Tests.Cases.Symbols { [KeptMemberInAssembly ("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "NotUsed()")] - public class ReferenceWithPortablePdbAndSymbolLinkingEnabledAndDeterministicMvid { - static void Main() + public class ReferenceWithPortablePdbAndSymbolLinkingEnabledAndDeterministicMvid + { + static void Main () { LibraryWithPortablePdbSymbols.SomeMethod (); } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbAndSymbolLinkingEnabledAndNewMvid.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbAndSymbolLinkingEnabledAndNewMvid.cs index 7245433f4..a63248b8a 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbAndSymbolLinkingEnabledAndNewMvid.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbAndSymbolLinkingEnabledAndNewMvid.cs @@ -2,7 +2,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithPortablePdbSymbols.dll", new[] { "Dependencies/LibraryWithPortablePdbSymbols.cs" }, additionalArguments: "/debug:portable", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("true")] [SetupLinkerArgument ("--new-mvid", "true")] @@ -11,8 +12,9 @@ namespace Mono.Linker.Tests.Cases.Symbols { [KeptMemberInAssembly ("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "NotUsed()")] - public class ReferenceWithPortablePdbAndSymbolLinkingEnabledAndNewMvid { - static void Main() + public class ReferenceWithPortablePdbAndSymbolLinkingEnabledAndNewMvid + { + static void Main () { LibraryWithPortablePdbSymbols.SomeMethod (); } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbCopyAction.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbCopyAction.cs index 2f4e428f2..de06cb99d 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbCopyAction.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbCopyAction.cs @@ -2,13 +2,15 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithPortablePdbSymbols.dll", new[] { "Dependencies/LibraryWithPortablePdbSymbols.cs" }, additionalArguments: "/debug:portable", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("false")] [SetupLinkerAction ("copy", "LibraryWithPortablePdbSymbols")] [RemovedSymbols ("LibraryWithPortablePdbSymbols.dll")] - public class ReferenceWithPortablePdbCopyAction { + public class ReferenceWithPortablePdbCopyAction + { static void Main () { LibraryWithPortablePdbSymbols.SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbCopyActionAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbCopyActionAndSymbolLinkingEnabled.cs index 292ed8bc0..42813cc99 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbCopyActionAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbCopyActionAndSymbolLinkingEnabled.cs @@ -2,13 +2,15 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithPortablePdbSymbols.dll", new[] { "Dependencies/LibraryWithPortablePdbSymbols.cs" }, additionalArguments: "/debug:portable", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("true")] [SetupLinkerAction ("copy", "LibraryWithPortablePdbSymbols")] [KeptSymbols ("LibraryWithPortablePdbSymbols.dll")] - public class ReferenceWithPortablePdbCopyActionAndSymbolLinkingEnabled { + public class ReferenceWithPortablePdbCopyActionAndSymbolLinkingEnabled + { static void Main () { LibraryWithPortablePdbSymbols.SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbDeleteAction.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbDeleteAction.cs index f9382472f..0a278cdcc 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbDeleteAction.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbDeleteAction.cs @@ -2,13 +2,15 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithPortablePdbSymbols.dll", new[] { "Dependencies/LibraryWithPortablePdbSymbols.cs" }, additionalArguments: "/debug:portable", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("false")] [RemovedAssembly ("LibraryWithPortablePdbSymbols.dll")] [RemovedSymbols ("LibraryWithPortablePdbSymbols.dll")] - public class ReferenceWithPortablePdbDeleteAction { + public class ReferenceWithPortablePdbDeleteAction + { static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbDeleteActionAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbDeleteActionAndSymbolLinkingEnabled.cs index 3ec76815f..b6fd73fde 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbDeleteActionAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPortablePdbDeleteActionAndSymbolLinkingEnabled.cs @@ -2,13 +2,15 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [SetupCompileBefore ("LibraryWithPortablePdbSymbols.dll", new[] { "Dependencies/LibraryWithPortablePdbSymbols.cs" }, additionalArguments: "/debug:portable", compilerToUse: "csc")] [SetupLinkerLinkSymbols ("true")] [RemovedAssembly ("LibraryWithPortablePdbSymbols.dll")] [RemovedSymbols ("LibraryWithPortablePdbSymbols.dll")] - public class ReferenceWithPortablePdbDeleteActionAndSymbolLinkingEnabled { + public class ReferenceWithPortablePdbDeleteActionAndSymbolLinkingEnabled + { static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferencesWithMixedSymbolTypes.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferencesWithMixedSymbolTypes.cs index d468407bd..8b16c99b9 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferencesWithMixedSymbolTypes.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferencesWithMixedSymbolTypes.cs @@ -3,7 +3,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ [Reference ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll.mdb")] @@ -11,8 +12,8 @@ namespace Mono.Linker.Tests.Cases.Symbols { [ReferenceDependency ("Dependencies/LibraryWithPdb/LibraryWithPdb.pdb")] [SetupCompileBefore ("LibraryWithCompilerDefaultSymbols.dll", new[] { "Dependencies/LibraryWithCompilerDefaultSymbols.cs" }, additionalArguments: "/debug:full")] - [SetupCompileBefore("LibraryWithPortablePdbSymbols.dll", new[] { "Dependencies/LibraryWithPortablePdbSymbols.cs" }, additionalArguments: "/debug:portable", compilerToUse: "csc")] - [SetupCompileBefore("LibraryWithEmbeddedPdbSymbols.dll", new[] { "Dependencies/LibraryWithEmbeddedPdbSymbols.cs" }, additionalArguments: "/debug:embedded", compilerToUse: "csc")] + [SetupCompileBefore ("LibraryWithPortablePdbSymbols.dll", new[] { "Dependencies/LibraryWithPortablePdbSymbols.cs" }, additionalArguments: "/debug:portable", compilerToUse: "csc")] + [SetupCompileBefore ("LibraryWithEmbeddedPdbSymbols.dll", new[] { "Dependencies/LibraryWithEmbeddedPdbSymbols.cs" }, additionalArguments: "/debug:embedded", compilerToUse: "csc")] [SetupCompileArgument ("/debug:full")] [SetupLinkerLinkSymbols ("false")] @@ -34,13 +35,14 @@ namespace Mono.Linker.Tests.Cases.Symbols { [KeptMemberInAssembly ("LibraryWithCompilerDefaultSymbols.dll", typeof (LibraryWithCompilerDefaultSymbols), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithCompilerDefaultSymbols.dll", typeof (LibraryWithCompilerDefaultSymbols), "NotUsed()")] - [KeptMemberInAssembly ("LibraryWithEmbeddedPdbSymbols.dll", typeof(LibraryWithEmbeddedPdbSymbols), "SomeMethod()")] - [RemovedMemberInAssembly ("LibraryWithEmbeddedPdbSymbols.dll", typeof(LibraryWithEmbeddedPdbSymbols), "NotUsed()")] + [KeptMemberInAssembly ("LibraryWithEmbeddedPdbSymbols.dll", typeof (LibraryWithEmbeddedPdbSymbols), "SomeMethod()")] + [RemovedMemberInAssembly ("LibraryWithEmbeddedPdbSymbols.dll", typeof (LibraryWithEmbeddedPdbSymbols), "NotUsed()")] [KeptMemberInAssembly ("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "NotUsed()")] - public class ReferencesWithMixedSymbolTypes { - static void Main() + public class ReferencesWithMixedSymbolTypes + { + static void Main () { // Use some stuff so that we can verify that the linker output correct results SomeMethod (); diff --git a/test/Mono.Linker.Tests.Cases/Symbols/ReferencesWithMixedSymbolTypesAndSymbolLinkingEnabled.cs b/test/Mono.Linker.Tests.Cases/Symbols/ReferencesWithMixedSymbolTypesAndSymbolLinkingEnabled.cs index f6deaf36e..09e39401a 100644 --- a/test/Mono.Linker.Tests.Cases/Symbols/ReferencesWithMixedSymbolTypesAndSymbolLinkingEnabled.cs +++ b/test/Mono.Linker.Tests.Cases/Symbols/ReferencesWithMixedSymbolTypesAndSymbolLinkingEnabled.cs @@ -3,7 +3,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.Symbols.Dependencies; -namespace Mono.Linker.Tests.Cases.Symbols { +namespace Mono.Linker.Tests.Cases.Symbols +{ #if !NETCOREAPP [Reference ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll")] [ReferenceDependency ("Dependencies/LibraryWithMdb/LibraryWithMdb.dll.mdb")] @@ -49,7 +50,8 @@ namespace Mono.Linker.Tests.Cases.Symbols { [KeptMemberInAssembly ("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "SomeMethod()")] [RemovedMemberInAssembly ("LibraryWithPortablePdbSymbols.dll", typeof (LibraryWithPortablePdbSymbols), "NotUsed()")] - public class ReferencesWithMixedSymbolTypesAndSymbolLinkingEnabled { + public class ReferencesWithMixedSymbolTypesAndSymbolLinkingEnabled + { static void Main () { // Use some stuff so that we can verify that the linker output correct results diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/CanCheckInitializersByIndex.cs b/test/Mono.Linker.Tests.Cases/TestFramework/CanCheckInitializersByIndex.cs index 6f7747398..acf7ec886 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/CanCheckInitializersByIndex.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/CanCheckInitializersByIndex.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.TestFramework { - public class CanCheckInitializersByIndex { +namespace Mono.Linker.Tests.Cases.TestFramework +{ + public class CanCheckInitializersByIndex + { public static void Main () { Method1 (); @@ -14,20 +16,20 @@ namespace Mono.Linker.Tests.Cases.TestFramework { [KeptInitializerData (2)] static void Method1 () { - Helper (new [] {1, 2, 3}); - Helper (new [] {1, 2, 3, 4}); - Helper (new [] {3, 4, 5}); + Helper (new[] { 1, 2, 3 }); + Helper (new[] { 1, 2, 3, 4 }); + Helper (new[] { 3, 4, 5 }); } [Kept] [KeptInitializerData (0)] static void Method2 () { - Helper(new [] {10, 11, 12}); + Helper (new[] { 10, 11, 12 }); } [Kept] - static void Helper<T> (T [] arr) + static void Helper<T> (T[] arr) { } } diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs index 73388f592..a00328925 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs @@ -2,9 +2,10 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.TestFramework { +namespace Mono.Linker.Tests.Cases.TestFramework +{ [Define ("IL_ASSEMBLY_AVAILABLE")] - [SetupCompileBefore ("ILAssembly.dll", new [] { "Dependencies/ILAssemblySample.il" })] + [SetupCompileBefore ("ILAssembly.dll", new[] { "Dependencies/ILAssemblySample.il" })] [KeptMemberInAssembly ("ILAssembly.dll", "Mono.Linker.Tests.Cases.TestFramework.Dependencies.ILAssemblySample", "GiveMeAValue()")] public class CanCompileILAssembly { diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesUsingTypes.cs b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesUsingTypes.cs index 0bcddb212..f20876f4c 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesUsingTypes.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesUsingTypes.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.TestFramework.Dependencies; -namespace Mono.Linker.Tests.Cases.TestFramework { - [SetupCompileBefore ("library1.dll", new [] { typeof (CanCompileReferencesUsingTypes_LibSource1), typeof (CanCompileReferencesUsingTypes_LibSource2.Nested1.Nested2) })] - public class CanCompileReferencesUsingTypes { +namespace Mono.Linker.Tests.Cases.TestFramework +{ + [SetupCompileBefore ("library1.dll", new[] { typeof (CanCompileReferencesUsingTypes_LibSource1), typeof (CanCompileReferencesUsingTypes_LibSource2.Nested1.Nested2) })] + public class CanCompileReferencesUsingTypes + { public static void Main () { // Only the compile before assembly types are used because we wouldn't have access to the after types diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesWithResources.cs b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesWithResources.cs index c55e96a98..b6bfba94a 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesWithResources.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesWithResources.cs @@ -2,19 +2,21 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.TestFramework.Dependencies; -namespace Mono.Linker.Tests.Cases.TestFramework { +namespace Mono.Linker.Tests.Cases.TestFramework +{ [SetupCompileBefore ("library.dll", - new [] { "Dependencies/CanCompileReferencesWithResources_Lib1.cs" }, - resources: new [] { "Dependencies/CanCompileReferencesWithResources_Lib1.txt" })] - + new[] { "Dependencies/CanCompileReferencesWithResources_Lib1.cs" }, + resources: new[] { "Dependencies/CanCompileReferencesWithResources_Lib1.txt" })] + // Compile the same assembly again with another resource to get coverage on SetupCompileAfter [SetupCompileAfter ("library.dll", - new [] { "Dependencies/CanCompileReferencesWithResources_Lib1.cs" }, - resources: new [] { "Dependencies/CanCompileReferencesWithResources_Lib1.txt", "Dependencies/CanCompileReferencesWithResources_Lib1.log" })] - + new[] { "Dependencies/CanCompileReferencesWithResources_Lib1.cs" }, + resources: new[] { "Dependencies/CanCompileReferencesWithResources_Lib1.txt", "Dependencies/CanCompileReferencesWithResources_Lib1.log" })] + [KeptResourceInAssembly ("library.dll", "CanCompileReferencesWithResources_Lib1.txt")] [KeptResourceInAssembly ("library.dll", "CanCompileReferencesWithResources_Lib1.log")] - public class CanCompileReferencesWithResources { + public class CanCompileReferencesWithResources + { public static void Main () { // Use something so that reference isn't removed at compile time diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesWithResourcesWithCsc.cs b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesWithResourcesWithCsc.cs index 75e85d8b7..62431c05b 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesWithResourcesWithCsc.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesWithResourcesWithCsc.cs @@ -2,21 +2,23 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.TestFramework.Dependencies; -namespace Mono.Linker.Tests.Cases.TestFramework { +namespace Mono.Linker.Tests.Cases.TestFramework +{ [SetupCompileBefore ("library.dll", - new [] { "Dependencies/CanCompileReferencesWithResources_Lib1.cs" }, - resources: new [] { "Dependencies/CanCompileReferencesWithResources_Lib1.txt" }, + new[] { "Dependencies/CanCompileReferencesWithResources_Lib1.cs" }, + resources: new[] { "Dependencies/CanCompileReferencesWithResources_Lib1.txt" }, compilerToUse: "csc")] - + // Compile the same assembly again with another resource to get coverage on SetupCompileAfter [SetupCompileAfter ("library.dll", - new [] { "Dependencies/CanCompileReferencesWithResources_Lib1.cs" }, - resources: new [] { "Dependencies/CanCompileReferencesWithResources_Lib1.txt", "Dependencies/CanCompileReferencesWithResources_Lib1.log" }, + new[] { "Dependencies/CanCompileReferencesWithResources_Lib1.cs" }, + resources: new[] { "Dependencies/CanCompileReferencesWithResources_Lib1.txt", "Dependencies/CanCompileReferencesWithResources_Lib1.log" }, compilerToUse: "csc")] - + [KeptResourceInAssembly ("library.dll", "CanCompileReferencesWithResources_Lib1.txt")] [KeptResourceInAssembly ("library.dll", "CanCompileReferencesWithResources_Lib1.log")] - public class CanCompileReferencesWithResourcesWithCsc { + public class CanCompileReferencesWithResourcesWithCsc + { public static void Main () { // Use something so that reference isn't removed at compile time diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesWithResourcesWithMcs.cs b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesWithResourcesWithMcs.cs index 1190c7604..4b6a828d0 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesWithResourcesWithMcs.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileReferencesWithResourcesWithMcs.cs @@ -2,24 +2,26 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.TestFramework.Dependencies; -namespace Mono.Linker.Tests.Cases.TestFramework { +namespace Mono.Linker.Tests.Cases.TestFramework +{ #if NETCOREAPP [IgnoreTestCase ("Don't try to compile with mcs on .NET Core")] #endif [SetupCompileBefore ("library.dll", - new [] { "Dependencies/CanCompileReferencesWithResources_Lib1.cs" }, - resources: new [] { "Dependencies/CanCompileReferencesWithResources_Lib1.txt" }, + new[] { "Dependencies/CanCompileReferencesWithResources_Lib1.cs" }, + resources: new[] { "Dependencies/CanCompileReferencesWithResources_Lib1.txt" }, compilerToUse: "mcs")] - + // Compile the same assembly again with another resource to get coverage on SetupCompileAfter [SetupCompileAfter ("library.dll", - new [] { "Dependencies/CanCompileReferencesWithResources_Lib1.cs" }, - resources: new [] { "Dependencies/CanCompileReferencesWithResources_Lib1.txt", "Dependencies/CanCompileReferencesWithResources_Lib1.log" }, + new[] { "Dependencies/CanCompileReferencesWithResources_Lib1.cs" }, + resources: new[] { "Dependencies/CanCompileReferencesWithResources_Lib1.txt", "Dependencies/CanCompileReferencesWithResources_Lib1.log" }, compilerToUse: "mcs")] - + [KeptResourceInAssembly ("library.dll", "CanCompileReferencesWithResources_Lib1.txt")] [KeptResourceInAssembly ("library.dll", "CanCompileReferencesWithResources_Lib1.log")] - public class CanCompileReferencesWithResourcesWithMcs { + public class CanCompileReferencesWithResourcesWithMcs + { public static void Main () { // Use something so that reference isn't removed at compile time diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithCsc.cs b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithCsc.cs index a2d94d87b..823e114a9 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithCsc.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithCsc.cs @@ -3,7 +3,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.TestFramework.Dependencies; -namespace Mono.Linker.Tests.Cases.TestFramework { +namespace Mono.Linker.Tests.Cases.TestFramework +{ [SetupCSharpCompilerToUse ("csc")] // Use all of the compiler setup attributes so that we can verify they all work @@ -13,11 +14,12 @@ namespace Mono.Linker.Tests.Cases.TestFramework { [Define ("VERIFY_DEFINE_WORKS")] [Reference ("System.dll")] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/CanCompileTestCaseWithCsc_Lib.cs" }, compilerToUse: "csc")] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/CanCompileTestCaseWithCsc_Lib.cs" }, compilerToUse: "csc")] [KeptResource ("CanCompileTestCaseWithCsc.txt")] [KeptMemberInAssembly ("library.dll", typeof (CanCompileTestCaseWithCsc_Lib), "Used()")] - class CanCompileTestCaseWithCsc { + class CanCompileTestCaseWithCsc + { static void Main () { #if VERIFY_DEFINE_WORKS diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithDebugPdbs.cs b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithDebugPdbs.cs index 557ca5466..b07ae4db2 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithDebugPdbs.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithDebugPdbs.cs @@ -2,9 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.TestFramework { +namespace Mono.Linker.Tests.Cases.TestFramework +{ [SetupCompileArgument ("/debug:pdbonly")] - class CanCompileTestCaseWithDebugPdbs { + class CanCompileTestCaseWithDebugPdbs + { static void Main () { new Foo ().Method (); @@ -12,7 +14,8 @@ namespace Mono.Linker.Tests.Cases.TestFramework { [Kept] [KeptMember (".ctor()")] - class Foo { + class Foo + { [Kept] public void Method () { diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithMcs.cs b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithMcs.cs index cad804398..b7986d035 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithMcs.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithMcs.cs @@ -3,7 +3,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.TestFramework.Dependencies; -namespace Mono.Linker.Tests.Cases.TestFramework { +namespace Mono.Linker.Tests.Cases.TestFramework +{ #if NETCOREAPP [IgnoreTestCase ("Don't try to compile with mcs on .NET Core.")] #endif @@ -20,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.TestFramework { [KeptResource ("CanCompileTestCaseWithMcs.txt")] [KeptMemberInAssembly ("library.dll", typeof (CanCompileTestCaseWithMcs_Lib), "Used()")] - class CanCompileTestCaseWithMcs { + class CanCompileTestCaseWithMcs + { static void Main () { #if VERIFY_DEFINE_WORKS diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/CanSandboxDependenciesUsingType.cs b/test/Mono.Linker.Tests.Cases/TestFramework/CanSandboxDependenciesUsingType.cs index baa322be1..8c9c96b55 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/CanSandboxDependenciesUsingType.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/CanSandboxDependenciesUsingType.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.TestFramework.Dependencies; -namespace Mono.Linker.Tests.Cases.TestFramework { +namespace Mono.Linker.Tests.Cases.TestFramework +{ [SandboxDependency (typeof (CanSandboxDependenciesUsingType_Source1))] [SandboxDependency (typeof (CanSandboxDependenciesUsingType_Source2.Nested1.Nested2), "NameChanged.cs")] - public class CanSandboxDependenciesUsingType { + public class CanSandboxDependenciesUsingType + { public static void Main () { CanSandboxDependenciesUsingType_Source1.Method (); diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/CanVerifyInterfacesOnTypesInAssembly.cs b/test/Mono.Linker.Tests.Cases/TestFramework/CanVerifyInterfacesOnTypesInAssembly.cs index 964d5e779..33410aaa7 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/CanVerifyInterfacesOnTypesInAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/CanVerifyInterfacesOnTypesInAssembly.cs @@ -2,11 +2,13 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.TestFramework.Dependencies; -namespace Mono.Linker.Tests.Cases.TestFramework { - [SetupCompileBefore ("library.dll", new [] {"Dependencies/CanVerifyInterfacesOnTypesInAssembly_Lib.cs"})] +namespace Mono.Linker.Tests.Cases.TestFramework +{ + [SetupCompileBefore ("library.dll", new[] { "Dependencies/CanVerifyInterfacesOnTypesInAssembly_Lib.cs" })] [KeptInterfaceOnTypeInAssembly ("library", typeof (CanVerifyInterfacesOnTypesInAssembly_Lib.A), "library", typeof (CanVerifyInterfacesOnTypesInAssembly_Lib.IFoo))] [RemovedInterfaceOnTypeInAssembly ("library", typeof (CanVerifyInterfacesOnTypesInAssembly_Lib.A), "library", typeof (CanVerifyInterfacesOnTypesInAssembly_Lib.IBar))] - public class CanVerifyInterfacesOnTypesInAssembly { + public class CanVerifyInterfacesOnTypesInAssembly + { public static void Main () { CanVerifyInterfacesOnTypesInAssembly_Lib.IFoo a = new CanVerifyInterfacesOnTypesInAssembly_Lib.A (); diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileReferencesUsingTypes_LibSource1.cs b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileReferencesUsingTypes_LibSource1.cs index 01e15ec32..3375f7ec7 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileReferencesUsingTypes_LibSource1.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileReferencesUsingTypes_LibSource1.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies { - public class CanCompileReferencesUsingTypes_LibSource1 { +namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies +{ + public class CanCompileReferencesUsingTypes_LibSource1 + { public static void MethodFromParentType () { } diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileReferencesUsingTypes_LibSource2.cs b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileReferencesUsingTypes_LibSource2.cs index b9c983b77..6c339f8d2 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileReferencesUsingTypes_LibSource2.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileReferencesUsingTypes_LibSource2.cs @@ -1,7 +1,11 @@ -namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies { - public class CanCompileReferencesUsingTypes_LibSource2 { - public class Nested1 { - public class Nested2 { +namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies +{ + public class CanCompileReferencesUsingTypes_LibSource2 + { + public class Nested1 + { + public class Nested2 + { public static void MethodFromNestedNested () { } diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileReferencesWithResources_Lib1.cs b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileReferencesWithResources_Lib1.cs index 358cd3c42..e4e1aaa0b 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileReferencesWithResources_Lib1.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileReferencesWithResources_Lib1.cs @@ -1,5 +1,7 @@ -namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies { - public class CanCompileReferencesWithResources_Lib1 { +namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies +{ + public class CanCompileReferencesWithResources_Lib1 + { public static void Used () { } diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileTestCaseWithCsc_Lib.cs b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileTestCaseWithCsc_Lib.cs index 120b2d367..8cd7344ad 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileTestCaseWithCsc_Lib.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileTestCaseWithCsc_Lib.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies { - public class CanCompileTestCaseWithCsc_Lib { +namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies +{ + public class CanCompileTestCaseWithCsc_Lib + { public static void Used () { } diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileTestCaseWithMcs_Lib.cs b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileTestCaseWithMcs_Lib.cs index 09b05174c..7c2cdf753 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileTestCaseWithMcs_Lib.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanCompileTestCaseWithMcs_Lib.cs @@ -1,7 +1,9 @@ using System; -namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies { - public class CanCompileTestCaseWithMcs_Lib { +namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies +{ + public class CanCompileTestCaseWithMcs_Lib + { public static void Used () { } diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanSandboxDependenciesUsingType_Source1.cs b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanSandboxDependenciesUsingType_Source1.cs index ada073096..78c705522 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanSandboxDependenciesUsingType_Source1.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanSandboxDependenciesUsingType_Source1.cs @@ -1,8 +1,10 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies { +namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies +{ [Kept] - public class CanSandboxDependenciesUsingType_Source1 { + public class CanSandboxDependenciesUsingType_Source1 + { [Kept] public static void Method () { diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanSandboxDependenciesUsingType_Source2.cs b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanSandboxDependenciesUsingType_Source2.cs index 2a730074f..d5ed716e0 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanSandboxDependenciesUsingType_Source2.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanSandboxDependenciesUsingType_Source2.cs @@ -1,12 +1,16 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies { +namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies +{ [Kept] - public class CanSandboxDependenciesUsingType_Source2 { + public class CanSandboxDependenciesUsingType_Source2 + { [Kept] - public class Nested1 { + public class Nested1 + { [Kept] - public class Nested2 { + public class Nested2 + { [Kept] public static void Method () { diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanVerifyInterfacesOnTypesInAssembly_Lib.cs b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanVerifyInterfacesOnTypesInAssembly_Lib.cs index 06aa2f050..c035df10b 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanVerifyInterfacesOnTypesInAssembly_Lib.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/CanVerifyInterfacesOnTypesInAssembly_Lib.cs @@ -1,13 +1,18 @@ -namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies { - public class CanVerifyInterfacesOnTypesInAssembly_Lib { - public interface IFoo { +namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies +{ + public class CanVerifyInterfacesOnTypesInAssembly_Lib + { + public interface IFoo + { void Foo (); } - public interface IBar { + public interface IBar + { void Bar (); } - public class A : IFoo, IBar { + public class A : IFoo, IBar + { public void Foo () { } diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/VerifyAttributesInAssemblyWorks_Base.cs b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/VerifyAttributesInAssemblyWorks_Base.cs index 92eb9ef8a..eca6b41b8 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/VerifyAttributesInAssemblyWorks_Base.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/VerifyAttributesInAssemblyWorks_Base.cs @@ -1,11 +1,15 @@ using System; -namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies { - public class VerifyAttributesInAssemblyWorks_Base { - public class ForAssertingKeptAttribute : Attribute { +namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies +{ + public class VerifyAttributesInAssemblyWorks_Base + { + public class ForAssertingKeptAttribute : Attribute + { } - - public class ForAssertingRemoveAttribute : Attribute { + + public class ForAssertingRemoveAttribute : Attribute + { } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/VerifyAttributesInAssemblyWorks_Lib.cs b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/VerifyAttributesInAssemblyWorks_Lib.cs index 57dd0c380..1cf5bfe70 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/VerifyAttributesInAssemblyWorks_Lib.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/Dependencies/VerifyAttributesInAssemblyWorks_Lib.cs @@ -4,10 +4,13 @@ using Mono.Linker.Tests.Cases.TestFramework.Dependencies; [assembly: VerifyAttributesInAssemblyWorks_Base.ForAssertingKept] [assembly: VerifyAttributesInAssemblyWorks_Base.ForAssertingRemove] -namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies { - public class VerifyAttributesInAssemblyWorks_Lib { +namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies +{ + public class VerifyAttributesInAssemblyWorks_Lib + { [VerifyAttributesInAssemblyWorks_Base.ForAssertingKept] - public static class TypeWithKeptAttribute { + public static class TypeWithKeptAttribute + { [VerifyAttributesInAssemblyWorks_Base.ForAssertingKept] public static int Field; @@ -15,13 +18,14 @@ namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies { public static void Method () { } - + [VerifyAttributesInAssemblyWorks_Base.ForAssertingKept] public static int Property { get; set; } } [VerifyAttributesInAssemblyWorks_Base.ForAssertingRemove] - public class TypeWithRemovedAttribute { + public class TypeWithRemovedAttribute + { [VerifyAttributesInAssemblyWorks_Base.ForAssertingRemove] public static int Field; @@ -29,7 +33,7 @@ namespace Mono.Linker.Tests.Cases.TestFramework.Dependencies { public static void Method () { } - + [VerifyAttributesInAssemblyWorks_Base.ForAssertingRemove] public static int Property { get; set; } } diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/VerifyAttributesInAssemblyWorks.cs b/test/Mono.Linker.Tests.Cases/TestFramework/VerifyAttributesInAssemblyWorks.cs index ae450e2a5..2dfd16094 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/VerifyAttributesInAssemblyWorks.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/VerifyAttributesInAssemblyWorks.cs @@ -2,34 +2,36 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.TestFramework.Dependencies; -namespace Mono.Linker.Tests.Cases.TestFramework { +namespace Mono.Linker.Tests.Cases.TestFramework +{ [SetupLinkerArgument ("--used-attrs-only", "true")] // Put the attribute types in a different assembly than where we will assert since that is a more complex use case - [SetupCompileBefore ("base.dll", new [] { "Dependencies/VerifyAttributesInAssemblyWorks_Base.cs" })] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/VerifyAttributesInAssemblyWorks_Lib.cs" }, new [] { "base.dll" })] - + [SetupCompileBefore ("base.dll", new[] { "Dependencies/VerifyAttributesInAssemblyWorks_Base.cs" })] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/VerifyAttributesInAssemblyWorks_Lib.cs" }, new[] { "base.dll" })] + [KeptAttributeInAssembly ("library.dll", typeof (VerifyAttributesInAssemblyWorks_Base.ForAssertingKeptAttribute))] [KeptAttributeInAssembly ("library.dll", typeof (VerifyAttributesInAssemblyWorks_Base.ForAssertingKeptAttribute), typeof (VerifyAttributesInAssemblyWorks_Lib.TypeWithKeptAttribute))] [KeptAttributeInAssembly ("library.dll", typeof (VerifyAttributesInAssemblyWorks_Base.ForAssertingKeptAttribute), typeof (VerifyAttributesInAssemblyWorks_Lib.TypeWithKeptAttribute), "Field")] [KeptAttributeInAssembly ("library.dll", typeof (VerifyAttributesInAssemblyWorks_Base.ForAssertingKeptAttribute), typeof (VerifyAttributesInAssemblyWorks_Lib.TypeWithKeptAttribute), "Property")] [KeptAttributeInAssembly ("library.dll", typeof (VerifyAttributesInAssemblyWorks_Base.ForAssertingKeptAttribute), typeof (VerifyAttributesInAssemblyWorks_Lib.TypeWithKeptAttribute), "Method()")] - + [RemovedAttributeInAssembly ("library.dll", typeof (VerifyAttributesInAssemblyWorks_Base.ForAssertingRemoveAttribute))] [RemovedAttributeInAssembly ("library.dll", typeof (VerifyAttributesInAssemblyWorks_Base.ForAssertingRemoveAttribute), typeof (VerifyAttributesInAssemblyWorks_Lib.TypeWithRemovedAttribute))] [RemovedAttributeInAssembly ("library.dll", typeof (VerifyAttributesInAssemblyWorks_Base.ForAssertingRemoveAttribute), typeof (VerifyAttributesInAssemblyWorks_Lib.TypeWithRemovedAttribute), "Field")] [RemovedAttributeInAssembly ("library.dll", typeof (VerifyAttributesInAssemblyWorks_Base.ForAssertingRemoveAttribute), typeof (VerifyAttributesInAssemblyWorks_Lib.TypeWithRemovedAttribute), "Property")] [RemovedAttributeInAssembly ("library.dll", typeof (VerifyAttributesInAssemblyWorks_Base.ForAssertingRemoveAttribute), typeof (VerifyAttributesInAssemblyWorks_Lib.TypeWithRemovedAttribute), "Method()")] - public class VerifyAttributesInAssemblyWorks { + public class VerifyAttributesInAssemblyWorks + { public static void Main () { // Use the attribute type we want to keep var tmp = typeof (VerifyAttributesInAssemblyWorks_Base.ForAssertingKeptAttribute).ToString (); - + // Now use the members of both types VerifyAttributesInAssemblyWorks_Lib.TypeWithKeptAttribute.Field = 1; VerifyAttributesInAssemblyWorks_Lib.TypeWithKeptAttribute.Property = 1; VerifyAttributesInAssemblyWorks_Lib.TypeWithKeptAttribute.Method (); - + VerifyAttributesInAssemblyWorks_Lib.TypeWithRemovedAttribute.Field = 1; VerifyAttributesInAssemblyWorks_Lib.TypeWithRemovedAttribute.Property = 1; VerifyAttributesInAssemblyWorks_Lib.TypeWithRemovedAttribute.Method (); diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/VerifyAttributesInAssemblyWorksWithStrings.cs b/test/Mono.Linker.Tests.Cases/TestFramework/VerifyAttributesInAssemblyWorksWithStrings.cs index bf1e0f18f..7836c0ac2 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/VerifyAttributesInAssemblyWorksWithStrings.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/VerifyAttributesInAssemblyWorksWithStrings.cs @@ -2,11 +2,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.TestFramework.Dependencies; -namespace Mono.Linker.Tests.Cases.TestFramework { +namespace Mono.Linker.Tests.Cases.TestFramework +{ [SetupLinkerArgument ("--used-attrs-only", "true")] // Put the attribute types in a different assembly than where we will assert since that is a more complex use case - [SetupCompileBefore ("base.dll", new [] { "Dependencies/VerifyAttributesInAssemblyWorks_Base.cs"} )] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/VerifyAttributesInAssemblyWorks_Lib.cs"}, new [] { "base.dll" })] + [SetupCompileBefore ("base.dll", new[] { "Dependencies/VerifyAttributesInAssemblyWorks_Base.cs" })] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/VerifyAttributesInAssemblyWorks_Lib.cs" }, new[] { "base.dll" })] [KeptAttributeInAssembly ("library.dll", "Mono.Linker.Tests.Cases.TestFramework.Dependencies.VerifyAttributesInAssemblyWorks_Base/ForAssertingKeptAttribute")] [KeptAttributeInAssembly ("library.dll", "Mono.Linker.Tests.Cases.TestFramework.Dependencies.VerifyAttributesInAssemblyWorks_Base/ForAssertingKeptAttribute", "Mono.Linker.Tests.Cases.TestFramework.Dependencies.VerifyAttributesInAssemblyWorks_Lib/TypeWithKeptAttribute")] @@ -19,17 +20,18 @@ namespace Mono.Linker.Tests.Cases.TestFramework { [RemovedAttributeInAssembly ("library.dll", "Mono.Linker.Tests.Cases.TestFramework.Dependencies.VerifyAttributesInAssemblyWorks_Base/ForAssertingRemoveAttribute", "Mono.Linker.Tests.Cases.TestFramework.Dependencies.VerifyAttributesInAssemblyWorks_Lib/TypeWithRemovedAttribute", "Field")] [RemovedAttributeInAssembly ("library.dll", "Mono.Linker.Tests.Cases.TestFramework.Dependencies.VerifyAttributesInAssemblyWorks_Base/ForAssertingRemoveAttribute", "Mono.Linker.Tests.Cases.TestFramework.Dependencies.VerifyAttributesInAssemblyWorks_Lib/TypeWithRemovedAttribute", "Property")] [RemovedAttributeInAssembly ("library.dll", "Mono.Linker.Tests.Cases.TestFramework.Dependencies.VerifyAttributesInAssemblyWorks_Base/ForAssertingRemoveAttribute", "Mono.Linker.Tests.Cases.TestFramework.Dependencies.VerifyAttributesInAssemblyWorks_Lib/TypeWithRemovedAttribute", "Method()")] - public class VerifyAttributesInAssemblyWorksWithStrings { + public class VerifyAttributesInAssemblyWorksWithStrings + { public static void Main () { // Use the attribute type we want to keep var tmp = typeof (VerifyAttributesInAssemblyWorks_Base.ForAssertingKeptAttribute).ToString (); - + // Now use the members of both types VerifyAttributesInAssemblyWorks_Lib.TypeWithKeptAttribute.Field = 1; VerifyAttributesInAssemblyWorks_Lib.TypeWithKeptAttribute.Property = 1; VerifyAttributesInAssemblyWorks_Lib.TypeWithKeptAttribute.Method (); - + VerifyAttributesInAssemblyWorks_Lib.TypeWithRemovedAttribute.Field = 1; VerifyAttributesInAssemblyWorks_Lib.TypeWithRemovedAttribute.Property = 1; VerifyAttributesInAssemblyWorks_Lib.TypeWithRemovedAttribute.Method (); diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/VerifyDefineAttributeBehavior.cs b/test/Mono.Linker.Tests.Cases/TestFramework/VerifyDefineAttributeBehavior.cs index abe143042..e265807ee 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/VerifyDefineAttributeBehavior.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/VerifyDefineAttributeBehavior.cs @@ -2,13 +2,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.TestFramework { +namespace Mono.Linker.Tests.Cases.TestFramework +{ /// <summary> /// The purpose of this test is to verify that the testing framework's define attribute is working correctly /// </summary> - [Define("SOME_DEFINE")] - public class VerifyDefineAttributeBehavior { + [Define ("SOME_DEFINE")] + public class VerifyDefineAttributeBehavior + { static void Main () { #if SOME_DEFINE @@ -16,7 +18,7 @@ namespace Mono.Linker.Tests.Cases.TestFramework { #endif } - + [Kept] static void MethodThatIsUsedIfDefineIsWorkingProperly () { diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/VerifyExpectModifiedAttributesWork.cs b/test/Mono.Linker.Tests.Cases/TestFramework/VerifyExpectModifiedAttributesWork.cs index 787c5179e..8ac41d040 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/VerifyExpectModifiedAttributesWork.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/VerifyExpectModifiedAttributesWork.cs @@ -3,7 +3,8 @@ using System.Diagnostics.Tracing; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.TestFramework { +namespace Mono.Linker.Tests.Cases.TestFramework +{ /// <summary> /// This test is here to give some coverage to the attribute to ensure it doesn't break. We need to leverage the ETW feature since it is the only /// one that modifies bodies currently @@ -16,30 +17,34 @@ namespace Mono.Linker.Tests.Cases.TestFramework { [SetupLinkerCoreAction ("skip")] // Used to avoid different compilers generating different IL which can mess up the instruction asserts [SetupCompileArgument ("/optimize+")] - public class VerifyExpectModifiedAttributesWork { + public class VerifyExpectModifiedAttributesWork + { public static void Main () { var b = VerifyExpectModifiedAttributesWork_RemovedEventSource.Log.IsEnabled (); if (b) VerifyExpectModifiedAttributesWork_RemovedEventSource.Log.SomeMethod (); } - - public class ClassForLocal { + + public class ClassForLocal + { } public static void CallsToForceALocal (int arg1, int arg2, int arg3) { } } - + [Kept] [KeptBaseType (typeof (EventSource))] [KeptMember (".ctor()")] [KeptMember (".cctor()")] [EventSource (Name = "MyCompany")] - class VerifyExpectModifiedAttributesWork_RemovedEventSource : EventSource { - public class Keywords { - public const EventKeywords Page = (EventKeywords)1; + class VerifyExpectModifiedAttributesWork_RemovedEventSource : EventSource + { + public class Keywords + { + public const EventKeywords Page = (EventKeywords) 1; public int Unused; } @@ -59,7 +64,7 @@ namespace Mono.Linker.Tests.Cases.TestFramework { VerifyExpectModifiedAttributesWork.CallsToForceALocal (1, 3, 4); VerifyExpectModifiedAttributesWork.CallsToForceALocal (1, 4, 4); var hashcode = tmp.GetHashCode (); - VerifyExpectModifiedAttributesWork.CallsToForceALocal(1, hashcode, 3); + VerifyExpectModifiedAttributesWork.CallsToForceALocal (1, hashcode, 3); } catch { try { Removed (); @@ -68,7 +73,7 @@ namespace Mono.Linker.Tests.Cases.TestFramework { VerifyExpectModifiedAttributesWork.CallsToForceALocal (1, 3, 4); VerifyExpectModifiedAttributesWork.CallsToForceALocal (1, 4, 4); var hashcode = tmp.GetHashCode (); - VerifyExpectModifiedAttributesWork.CallsToForceALocal(1, hashcode, 3); + VerifyExpectModifiedAttributesWork.CallsToForceALocal (1, hashcode, 3); throw; } throw; diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/VerifyResourceInAssemblyAttributesBehavior.cs b/test/Mono.Linker.Tests.Cases/TestFramework/VerifyResourceInAssemblyAttributesBehavior.cs index c54be7565..e39b9f3f2 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/VerifyResourceInAssemblyAttributesBehavior.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/VerifyResourceInAssemblyAttributesBehavior.cs @@ -2,7 +2,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.TestFramework { +namespace Mono.Linker.Tests.Cases.TestFramework +{ [SetupCompileResource ("Dependencies/VerifyResourceInAssemblyAttributesBehavior.txt")] [KeptResource ("VerifyResourceInAssemblyAttributesBehavior.txt")] // These are technically redundant, but the goal of this test is to verify the attributes are working which we can do @@ -10,7 +11,8 @@ namespace Mono.Linker.Tests.Cases.TestFramework { // supporting assemblies [KeptResourceInAssembly ("test.exe", "VerifyResourceInAssemblyAttributesBehavior.txt")] [RemovedResourceInAssembly ("test.exe", "NeverExistedResource.txt")] - public class VerifyResourceInAssemblyAttributesBehavior { + public class VerifyResourceInAssemblyAttributesBehavior + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Tracing/DependencyRecorder/BasicDependencies.cs b/test/Mono.Linker.Tests.Cases/Tracing/DependencyRecorder/BasicDependencies.cs index 484253644..b1507515b 100644 --- a/test/Mono.Linker.Tests.Cases/Tracing/DependencyRecorder/BasicDependencies.cs +++ b/test/Mono.Linker.Tests.Cases/Tracing/DependencyRecorder/BasicDependencies.cs @@ -3,12 +3,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; namespace Mono.Linker.Tests.Cases.Tracing.DependencyRecorder { - [DependencyRecorded("System.Void Mono.Linker.Tests.Cases.Tracing.DependencyRecorder.BasicDependencies::Main()", "Mono.Linker.Tests.Cases.Tracing.DependencyRecorder.UsedType")] + [DependencyRecorded ("System.Void Mono.Linker.Tests.Cases.Tracing.DependencyRecorder.BasicDependencies::Main()", "Mono.Linker.Tests.Cases.Tracing.DependencyRecorder.UsedType")] [DependencyRecorded ("System.Void Mono.Linker.Tests.Cases.Tracing.DependencyRecorder.BasicDependencies::Main()", "System.Void Mono.Linker.Tests.Cases.Tracing.DependencyRecorder.UsedType::.ctor()")] [DependencyRecorded ("System.Void Mono.Linker.Tests.Cases.Tracing.DependencyRecorder.BasicDependencies::Main()", "System.Void Mono.Linker.Tests.Cases.Tracing.DependencyRecorder.UsedType::UsedMethod()")] public class BasicDependencies { - public static void Main() + public static void Main () { UsedType ut = new UsedType (); ut.UsedMethod (); @@ -19,12 +19,12 @@ namespace Mono.Linker.Tests.Cases.Tracing.DependencyRecorder class UsedType { [Kept] - public UsedType() + public UsedType () { } [Kept] - public void UsedMethod() + public void UsedMethod () { } } diff --git a/test/Mono.Linker.Tests.Cases/Tracing/Individual/CanDumpDependenciesToUncompressedXml.cs b/test/Mono.Linker.Tests.Cases/Tracing/Individual/CanDumpDependenciesToUncompressedXml.cs index 5e4d82e8e..c9a33a301 100644 --- a/test/Mono.Linker.Tests.Cases/Tracing/Individual/CanDumpDependenciesToUncompressedXml.cs +++ b/test/Mono.Linker.Tests.Cases/Tracing/Individual/CanDumpDependenciesToUncompressedXml.cs @@ -1,11 +1,13 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Tracing.Individual { +namespace Mono.Linker.Tests.Cases.Tracing.Individual +{ [SetupLinkerArgument ("--dump-dependencies")] [SetupLinkerArgument ("--dependencies-file", "linker-dependencies.xml")] - public class CanDumpDependenciesToUncompressedXml { + public class CanDumpDependenciesToUncompressedXml + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableDependenciesDump.cs b/test/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableDependenciesDump.cs index 810023860..2e312a67b 100644 --- a/test/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableDependenciesDump.cs +++ b/test/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableDependenciesDump.cs @@ -1,10 +1,12 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Tracing.Individual { +namespace Mono.Linker.Tests.Cases.Tracing.Individual +{ [SetupLinkerArgument ("--dump-dependencies")] - public class CanEnableDependenciesDump { + public class CanEnableDependenciesDump + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableReducedTracing.cs b/test/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableReducedTracing.cs index 3a7fcadae..dd0160976 100644 --- a/test/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableReducedTracing.cs +++ b/test/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableReducedTracing.cs @@ -1,7 +1,8 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.Tracing.Individual { +namespace Mono.Linker.Tests.Cases.Tracing.Individual +{ [SetupLinkerArgument ("--dump-dependencies")] [SetupLinkerArgument ("--reduced-tracing", "true")] @@ -10,7 +11,8 @@ namespace Mono.Linker.Tests.Cases.Tracing.Individual { // Need to define a custom name so that the linker outputs in uncompressed format, which is more useful for making assertions [SetupLinkerArgument ("--dependencies-file", "linker-dependencies.xml")] - public class CanEnableReducedTracing { + public class CanEnableReducedTracing + { public static void Main () { } diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwarded.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwarded.cs index 1e795e333..72c261520 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwarded.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwarded.cs @@ -24,7 +24,7 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding [KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary))] class AttributeArgumentForwarded { - static void Main() + static void Main () { Test_1 (); Test_1b (); @@ -50,14 +50,14 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding [Kept] [KeptAttributeAttribute (typeof (TestTypeAttribute))] - [TestType (typeof (ImplementationLibrary [,] []))] + [TestType (typeof (ImplementationLibrary[,][]))] public static void Test_1c () { } [Kept] [KeptAttributeAttribute (typeof (TestTypeAttribute))] - [TestType (TestProperty = new object [] { typeof (ImplementationLibrary) })] + [TestType (TestProperty = new object[] { typeof (ImplementationLibrary) })] public static void Test_2 () { } @@ -79,7 +79,8 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding } [KeptBaseType (typeof (Attribute))] - public class TestTypeAttribute : Attribute { + public class TestTypeAttribute : Attribute + { [Kept] public TestTypeAttribute () { @@ -99,6 +100,7 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding } [Kept] - public class SomeGenericType<T> { + public class SomeGenericType<T> + { } } diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwardedWithCopyAction.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwardedWithCopyAction.cs index 6d211a151..9855ae444 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwardedWithCopyAction.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwardedWithCopyAction.cs @@ -27,7 +27,7 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding [KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary))] static class AttributeArgumentForwardedWithCopyAction { - static void Main() + static void Main () { Test_1 (); } @@ -48,14 +48,14 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding [Kept] [KeptAttributeAttribute (typeof (TestType2Attribute))] - [TestType2 (typeof (ImplementationLibrary [,] []))] + [TestType2 (typeof (ImplementationLibrary[,][]))] public static void Test_1c () { } [Kept] [KeptAttributeAttribute (typeof (TestType2Attribute))] - [TestType2 (TestProperty = new object [] { typeof (ImplementationLibrary) })] + [TestType2 (TestProperty = new object[] { typeof (ImplementationLibrary) })] public static void Test_2 () { } @@ -77,7 +77,8 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding } [KeptBaseType (typeof (Attribute))] - public class TestType2Attribute : Attribute { + public class TestType2Attribute : Attribute + { [Kept] public TestType2Attribute () { @@ -97,6 +98,7 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding } [Kept] - static class SomeGenericType2<T> { + static class SomeGenericType2<T> + { } } diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/AnotherLibrary.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/AnotherLibrary.cs index fde1f82f9..c7e0b9756 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/AnotherLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/AnotherLibrary.cs @@ -2,8 +2,10 @@ using System; using System.Reflection; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies { - public class AnotherLibrary<T> { +namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies +{ + public class AnotherLibrary<T> + { public string Prop { get; set; } } } diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwarderLibrary_3.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwarderLibrary_3.cs index 8b4ae26e0..d7aea07d7 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwarderLibrary_3.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwarderLibrary_3.cs @@ -6,6 +6,6 @@ using System; namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies { public class RealClassInForwarder3 - { + { } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs index 137414032..98fab0dba 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs @@ -4,8 +4,10 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; //[assembly: AssemblyVersion ("2.0")] -namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies { - public class ImplementationLibrary { +namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies +{ + public class ImplementationLibrary + { public string GetSomeValue () { return "Hello"; diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary_3.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary_3.cs index 30c3b61d9..29223748b 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary_3.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary_3.cs @@ -1,7 +1,8 @@ using System; using System.Reflection; -namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies { +namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies +{ public class ImplementationLibrary3A { } diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/LibraryUsingForwarder.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/LibraryUsingForwarder.cs index 97c728e7d..c88dd625e 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/LibraryUsingForwarder.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/LibraryUsingForwarder.cs @@ -1,9 +1,11 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies { +namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies +{ [NotATestCase] - public class LibraryUsingForwarder { + public class LibraryUsingForwarder + { public string GetValueFromOtherAssembly () { return new ImplementationLibrary ().GetSomeValue (); diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ReferenceImplementationLibrary.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ReferenceImplementationLibrary.cs index 00bb1e30c..ff4def7c9 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ReferenceImplementationLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ReferenceImplementationLibrary.cs @@ -1,9 +1,11 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies { +namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies +{ [NotATestCase] - public class ReferenceImplementationLibrary { + public class ReferenceImplementationLibrary + { } #if INCLUDE_REFERENCE_IMPL diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs index a0731064f..3d53f356c 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs @@ -2,10 +2,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.TypeForwarding { +namespace Mono.Linker.Tests.Cases.TypeForwarding +{ [SkipUnresolved (true)] [Define ("IL_ASSEMBLY_AVAILABLE")] - [SetupCompileBefore ("TypeForwarderMissingReference.dll", new [] { "Dependencies/TypeForwarderMissingReference.il" })] + [SetupCompileBefore ("TypeForwarderMissingReference.dll", new[] { "Dependencies/TypeForwarderMissingReference.il" })] [SetupLinkerAction ("link", "TypeForwarderMissingReference.dll")] [KeptMemberInAssembly ("TypeForwarderMissingReference.dll", "DummyClass", ".ctor()")] diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesKept.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesKept.cs index e8a41a259..407cdab90 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesKept.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesKept.cs @@ -3,7 +3,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.TypeForwarding.Dependencies; -namespace Mono.Linker.Tests.Cases.TypeForwarding { +namespace Mono.Linker.Tests.Cases.TypeForwarding +{ [KeepTypeForwarderOnlyAssemblies ("true")] [SetupCompileBefore ("Forwarder.dll", new[] { "Dependencies/ReferenceImplementationLibrary.cs" }, defines: new[] { "INCLUDE_REFERENCE_IMPL" })] // Add another assembly in that uses the forwarder just to make things a little more complex @@ -16,7 +17,8 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding { [KeptAssembly ("Forwarder.dll")] [KeptMemberInAssembly ("Library.dll", typeof (LibraryUsingForwarder), "GetValueFromOtherAssembly()")] [KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary), "GetSomeValue()")] - public class TypeForwarderOnlyAssembliesKept { + public class TypeForwarderOnlyAssembliesKept + { public static void Main () { Console.WriteLine (new ImplementationLibrary ().GetSomeValue ()); diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssemblyCanBePreservedViaLinkXml.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssemblyCanBePreservedViaLinkXml.cs index 95a0ad138..02a1a7cad 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssemblyCanBePreservedViaLinkXml.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssemblyCanBePreservedViaLinkXml.cs @@ -3,7 +3,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.TypeForwarding.Dependencies; -namespace Mono.Linker.Tests.Cases.TypeForwarding { +namespace Mono.Linker.Tests.Cases.TypeForwarding +{ [KeepTypeForwarderOnlyAssemblies ("false")] [SetupCompileBefore ("Forwarder.dll", new[] { "Dependencies/ReferenceImplementationLibrary.cs" }, defines: new[] { "INCLUDE_REFERENCE_IMPL" })] // Add another assembly in that uses the forwarder just to make things a little more complex @@ -16,10 +17,11 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding { [KeptAssembly ("Forwarder.dll")] [KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary), "GetSomeValue()")] [KeptMemberInAssembly ("Library.dll", typeof (LibraryUsingForwarder), "GetValueFromOtherAssembly()")] - - [KeptTypeInAssembly("Forwarder.dll", typeof (ImplementationLibrary))] - public class TypeForwarderOnlyAssemblyCanBePreservedViaLinkXml { - static void Main() + + [KeptTypeInAssembly ("Forwarder.dll", typeof (ImplementationLibrary))] + public class TypeForwarderOnlyAssemblyCanBePreservedViaLinkXml + { + static void Main () { Console.WriteLine (new ImplementationLibrary ().GetSomeValue ()); Console.WriteLine (new LibraryUsingForwarder ().GetValueFromOtherAssembly ()); diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/UnusedForwarderWithAssemblyCopyUsed.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/UnusedForwarderWithAssemblyCopyUsed.cs index 1f8a11011..74630d2b0 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/UnusedForwarderWithAssemblyCopyUsed.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/UnusedForwarderWithAssemblyCopyUsed.cs @@ -17,7 +17,7 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding [SetupCompileAfter ("Forwarder.dll", new[] { "Dependencies/ForwarderLibrary.cs" }, references: new[] { "Implementation.dll" })] [RemovedAssembly ("Forwarder.dll")] - [RemovedAssembly("Implementation.dll")] + [RemovedAssembly ("Implementation.dll")] class UnusedForwarderWithAssemblyCopyUsed { static void Main () diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedAndUnusedForwarderWithAssemblyCopy.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedAndUnusedForwarderWithAssemblyCopy.cs index fe957f90a..90e5b6391 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedAndUnusedForwarderWithAssemblyCopy.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedAndUnusedForwarderWithAssemblyCopy.cs @@ -26,7 +26,7 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding [RemovedAssemblyReference ("Forwarder.dll", "Unused")] class UsedAndUnusedForwarderWithAssemblyCopy { - static void Main() + static void Main () { new ImplementationLibrary ().GetSomeValue (); } diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderIsRemovedWhenLink.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderIsRemovedWhenLink.cs index 2366cf96b..deef0e497 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderIsRemovedWhenLink.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderIsRemovedWhenLink.cs @@ -22,7 +22,7 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding [KeptMemberInAssembly ("Library.dll", typeof (LibraryUsingForwarder), "GetValueFromOtherAssembly()")] class UsedForwarderIsRemovedWhenLink { - static void Main() + static void Main () { Console.WriteLine (new ImplementationLibrary ().GetSomeValue ()); Console.WriteLine (new LibraryUsingForwarder ().GetValueFromOtherAssembly ()); diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderWithAssemblyCopy.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderWithAssemblyCopy.cs index 1b1c6d56c..a0be84bb7 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderWithAssemblyCopy.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderWithAssemblyCopy.cs @@ -21,7 +21,7 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding [KeptMemberInAssembly ("Forwarder.dll", typeof (ImplementationLibrary))] class UsedForwarderWithAssemblyCopy { - static void Main() + static void Main () { new ImplementationLibrary ().GetSomeValue (); } diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderWithAssemblyCopyUsed.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderWithAssemblyCopyUsed.cs index f27148a88..01e8c7d9d 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderWithAssemblyCopyUsed.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderWithAssemblyCopyUsed.cs @@ -20,7 +20,7 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding [KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary), "GetSomeValue()")] class UsedForwarderWithAssemblyCopyUsed { - static void Main() + static void Main () { new ImplementationLibrary ().GetSomeValue (); } diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderWithAssemblyCopyUsedAndFacadesKept.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderWithAssemblyCopyUsedAndFacadesKept.cs index 988d42712..7ccc53062 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderWithAssemblyCopyUsedAndFacadesKept.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/UsedForwarderWithAssemblyCopyUsedAndFacadesKept.cs @@ -21,7 +21,7 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding [KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary), "GetSomeValue()")] class UsedForwarderWithAssemblyCopyUsedAndFacadesKept { - static void Main() + static void Main () { new ImplementationLibrary ().GetSomeValue (); } diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBlock/BodiesWithSubstitutions.cs b/test/Mono.Linker.Tests.Cases/UnreachableBlock/BodiesWithSubstitutions.cs index 668d5142e..6b347bb1d 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBlock/BodiesWithSubstitutions.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBlock/BodiesWithSubstitutions.cs @@ -17,7 +17,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock static int field; - public static void Main() + public static void Main () { TestProperty_int_1 (); TestField_int_1 (); diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBlock/DeadVariables.cs b/test/Mono.Linker.Tests.Cases/UnreachableBlock/DeadVariables.cs index f0f96f0f6..80a3908f9 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBlock/DeadVariables.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBlock/DeadVariables.cs @@ -18,7 +18,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock [Kept] [ExpectBodyModified] - [ExpectedLocalsSequence (new string [0])] + [ExpectedLocalsSequence (new string[0])] static void Test_1 () { if (!AlwaysTrue) { @@ -29,7 +29,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock [Kept] [ExpectBodyModified] - [ExpectedLocalsSequence (new string [] { "System.Object", "System.Int32" })] + [ExpectedLocalsSequence (new string[] { "System.Object", "System.Int32" })] static int Test_2 (int arg) { if (!AlwaysTrue) { @@ -47,7 +47,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock [Kept] [ExpectBodyModified] - [ExpectedLocalsSequence (new string [] { "System.Int32", "System.DateTime", "System.DateTimeOffset", "System.DateTimeOffset" })] + [ExpectedLocalsSequence (new string[] { "System.Int32", "System.DateTime", "System.DateTimeOffset", "System.DateTimeOffset" })] static int Test_3 () { var b = 3; diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBlock/MultiStageRemoval.cs b/test/Mono.Linker.Tests.Cases/UnreachableBlock/MultiStageRemoval.cs index 7f9d02fad..95a435eea 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBlock/MultiStageRemoval.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBlock/MultiStageRemoval.cs @@ -8,7 +8,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock [SetupLinkerArgument ("--enable-opt", "ipconstprop")] public class MultiStageRemoval { - public static void Main() + public static void Main () { TestMethod_1 (); TestMethod_2 (); @@ -53,7 +53,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock return -1; return 0; - } + } [Kept] static int Prop { @@ -69,14 +69,14 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock get { return true; } - } - + } + static void NeverReached_1 () - { + { } static void NeverReached_2 () - { - } + { + } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBlock/ReplacedReturns.cs b/test/Mono.Linker.Tests.Cases/UnreachableBlock/ReplacedReturns.cs index 9af58122f..0758e32c7 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBlock/ReplacedReturns.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBlock/ReplacedReturns.cs @@ -32,7 +32,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "pop", "call", @@ -50,7 +50,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "pop", "call", @@ -68,7 +68,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "pop", "ldsfld", @@ -87,7 +87,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "pop", "ldsfld", @@ -108,7 +108,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "pop", "ldsfld", @@ -132,7 +132,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "pop", "call", @@ -161,7 +161,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "pop", "call", @@ -192,7 +192,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.0", "stloc.0", "call", @@ -231,7 +231,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock [Kept] [ExpectedExceptionHandlerSequence (new string[0])] [ExpectedLocalsSequence (new string[0])] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "pop", "call", @@ -250,7 +250,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "pop", "call", diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBlock/SimpleConditionalProperty.cs b/test/Mono.Linker.Tests.Cases/UnreachableBlock/SimpleConditionalProperty.cs index a2708177f..5309bd332 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBlock/SimpleConditionalProperty.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBlock/SimpleConditionalProperty.cs @@ -9,7 +9,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock [SetupLinkerArgument ("--enable-opt", "ipconstprop")] public class SimpleConditionalProperty { - public static void Main() + public static void Main () { TestProperty_int_1 (); TestProperty_int_2 (); @@ -23,7 +23,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "ldc.i4.3", "beq.s", @@ -36,7 +36,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "ldc.i4.3", "call", "beq.s", @@ -52,7 +52,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "ldc.i4.5", "ble.s", @@ -69,7 +69,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "pop", "ldloca.s", @@ -86,7 +86,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "brfalse.s", "ret" @@ -101,7 +101,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "brfalse.s", "ret" @@ -114,7 +114,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "call", "beq.s", @@ -128,7 +128,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "br.s", "call", "pop", @@ -142,7 +142,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "brfalse.s", "ret" @@ -187,13 +187,14 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } static void NeverReached_1 () - { + { } [Kept] [KeptMember ("value__")] [KeptBaseType (typeof (Enum))] - enum TestEnum { + enum TestEnum + { [Kept] A = 0, [Kept] diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBlock/SizeOfInConditions.cs b/test/Mono.Linker.Tests.Cases/UnreachableBlock/SizeOfInConditions.cs index e5d97a702..fffd2c268 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBlock/SizeOfInConditions.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBlock/SizeOfInConditions.cs @@ -2,7 +2,8 @@ using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBlock { +namespace Mono.Linker.Tests.Cases.UnreachableBlock +{ #if ILLINK [SetupLinkerSubstitutionFile ("SizeOfInConditions.netcore.xml")] #else @@ -10,7 +11,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock { #endif [SetupCompileArgument ("/unsafe")] [SetupLinkerArgument ("--enable-opt", "ipconstprop")] - public unsafe class SizeOfInConditions { + public unsafe class SizeOfInConditions + { public static void Main () { TestIntPtr (); diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBlock/TryCatchBlocks.cs b/test/Mono.Linker.Tests.Cases/UnreachableBlock/TryCatchBlocks.cs index e0a8132bd..dca8e0cfa 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBlock/TryCatchBlocks.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBlock/TryCatchBlocks.cs @@ -14,7 +14,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "ldc.i4.6", "beq.s", @@ -26,13 +26,13 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock static int TestSimpleTryUnreachable () { if (Prop != 6) { - try { + try { Unreached_1 (); return 1; - } catch { - return 2; - } - } + } catch { + return 2; + } + } return 3; } diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBlock/TryFinallyBlocks.cs b/test/Mono.Linker.Tests.Cases/UnreachableBlock/TryFinallyBlocks.cs index 07a17b804..e39a2f936 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBlock/TryFinallyBlocks.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBlock/TryFinallyBlocks.cs @@ -14,7 +14,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBlock } [Kept] - [ExpectedInstructionSequence (new [] { + [ExpectedInstructionSequence (new[] { "call", "ldc.i4.3", "beq.s", diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBlock/UninitializedLocals.cs b/test/Mono.Linker.Tests.Cases/UnreachableBlock/UninitializedLocals.cs index 31283486a..dafdd100d 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBlock/UninitializedLocals.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBlock/UninitializedLocals.cs @@ -4,12 +4,12 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.UnreachableBlock { [Define ("IL_ASSEMBLY_AVAILABLE")] - [SetupCompileBefore ("library.dll", new [] { "Dependencies/LocalsWithoutStore.il" })] + [SetupCompileBefore ("library.dll", new[] { "Dependencies/LocalsWithoutStore.il" })] [SetupLinkerArgument ("--enable-opt", "ipconstprop")] [SkipPeVerify] public class UninitializedLocals { - public static void Main() + public static void Main () { #if IL_ASSEMBLY_AVAILABLE Mono.Linker.Tests.Cases.UnreachableBlock.Dependencies.ClassA.Method_1 (); diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/BodyWithManyVariables.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/BodyWithManyVariables.cs index 57fc9311f..d3b732189 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/BodyWithManyVariables.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/BodyWithManyVariables.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class BodyWithManyVariables { - public static void Main() + public class BodyWithManyVariables + { + public static void Main () { UsedToMarkMethod (null); } @@ -16,7 +18,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - class Foo { + class Foo + { [Kept] [ExpectBodyModified] [ExpectLocalsModified] @@ -37,37 +40,43 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } } - class Bar1 { + class Bar1 + { public void Method () { } } - class Bar2 { + class Bar2 + { public void Method () { } } - - class Bar3 { + + class Bar3 + { public void Method () { } } - class Bar4 { + class Bar4 + { public void Method () { } } - - class Bar5 { + + class Bar5 + { public void Method () { } } - class Bar6 { + class Bar6 + { public void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/BodyWithManyVariablesWithSymbols.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/BodyWithManyVariablesWithSymbols.cs index 4861e9675..70f576379 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/BodyWithManyVariablesWithSymbols.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/BodyWithManyVariablesWithSymbols.cs @@ -1,13 +1,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupCompileArgument ("/debug:full")] [SetupLinkerLinkSymbols ("true")] [KeptSymbols ("test.exe")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class BodyWithManyVariablesWithSymbols { - public static void Main() + public class BodyWithManyVariablesWithSymbols + { + public static void Main () { UsedToMarkMethod (null); } @@ -19,58 +21,65 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - class Foo { + class Foo + { [Kept] [ExpectBodyModified] [ExpectLocalsModified] public void Method () { - var b1 = new Bar1(); - var b2 = new Bar2(); - var b3 = new Bar3(); - var b4 = new Bar4(); - var b5 = new Bar5(); - var b6 = new Bar6(); - b1.Method(); - b2.Method(); - b3.Method(); - b4.Method(); - b5.Method(); - b6.Method(); + var b1 = new Bar1 (); + var b2 = new Bar2 (); + var b3 = new Bar3 (); + var b4 = new Bar4 (); + var b5 = new Bar5 (); + var b6 = new Bar6 (); + b1.Method (); + b2.Method (); + b3.Method (); + b4.Method (); + b5.Method (); + b6.Method (); } } - class Bar1 { + class Bar1 + { public void Method () { } } - class Bar2 { + class Bar2 + { public void Method () { } } - class Bar3 { + class Bar3 + { public void Method () { } } - class Bar4 { + class Bar4 + { public void Method () { } } - - class Bar5 { + + class Bar5 + { public void Method () { } } - class Bar6 { + class Bar6 + { public void Method () { } diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/CanDisableLazyBodyMarking.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/CanDisableLazyBodyMarking.cs index 4f72c7798..4c79dbbe1 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/CanDisableLazyBodyMarking.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/CanDisableLazyBodyMarking.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--disable-opt", "unreachablebodies")] - public class CanDisableLazyBodyMarking { - public static void Main() + public class CanDisableLazyBodyMarking + { + public static void Main () { UsedToMarkMethod (null); } @@ -16,7 +18,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - class Foo { + class Foo + { [Kept] public void Method () { diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/Dependencies/OtherAssembly.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/Dependencies/OtherAssembly.cs index 8e7abcd65..82819c391 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/Dependencies/OtherAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/Dependencies/OtherAssembly.cs @@ -1,10 +1,13 @@ -namespace Mono.Linker.Tests.Cases.UnreachableBody.Dependencies { - public class OtherAssembly { +namespace Mono.Linker.Tests.Cases.UnreachableBody.Dependencies +{ + public class OtherAssembly + { public static void UnusedSanityCheck () { } - public class Foo { + public class Foo + { public void Method () { UsedByMethod (); diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToCopiedAssembly.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToCopiedAssembly.cs index daed76fd1..4b6d1f3e1 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToCopiedAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToCopiedAssembly.cs @@ -2,15 +2,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.UnreachableBody.Dependencies; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerAction ("copy", "other2")] - [SetupCompileBefore ("other2.dll", new [] {typeof (OtherAssembly)})] + [SetupCompileBefore ("other2.dll", new[] { typeof (OtherAssembly) })] [KeptMemberInAssembly ("other2.dll", typeof (OtherAssembly.Foo), "Method()")] [KeptMemberInAssembly ("other2.dll", typeof (OtherAssembly.Foo), "UsedByMethod()")] [KeptMemberInAssembly ("other2.dll", typeof (OtherAssembly), "UnusedSanityCheck()")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class DoesNotApplyToCopiedAssembly { - public static void Main() + public class DoesNotApplyToCopiedAssembly + { + public static void Main () { UsedToMarkMethod (null); } diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToCopiedAssembly2.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToCopiedAssembly2.cs index 4b04bd953..29353e642 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToCopiedAssembly2.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToCopiedAssembly2.cs @@ -1,15 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [Define ("OTHER_INCLUDED")] [SetupLinkerAction ("copy", "other")] - [SetupCompileBefore ("other.dll", new [] { "Dependencies/OtherAssemblyNoInstanceCtor.il" })] + [SetupCompileBefore ("other.dll", new[] { "Dependencies/OtherAssemblyNoInstanceCtor.il" })] [KeptMemberInAssembly ("other.dll", "Mono.Linker.Tests.Cases.UnreachableBody.Dependencies.OtherAssemblyNoInstanceCtor/Foo", "Method()")] [KeptMemberInAssembly ("other.dll", "Mono.Linker.Tests.Cases.UnreachableBody.Dependencies.OtherAssemblyNoInstanceCtor/Foo", "UsedByMethod()")] [KeptMemberInAssembly ("other.dll", "Mono.Linker.Tests.Cases.UnreachableBody.Dependencies.OtherAssemblyNoInstanceCtor", "UnusedSanityCheck()")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class DoesNotApplyToCopiedAssembly2 { + public class DoesNotApplyToCopiedAssembly2 + { public static void Main () { #if OTHER_INCLUDED diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToSavedAssembly.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToSavedAssembly.cs index 10cf7d529..525e8b130 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToSavedAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToSavedAssembly.cs @@ -2,15 +2,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.UnreachableBody.Dependencies; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerAction ("save", "other2")] - [SetupCompileBefore ("other2.dll", new [] {typeof (OtherAssembly)})] + [SetupCompileBefore ("other2.dll", new[] { typeof (OtherAssembly) })] [KeptMemberInAssembly ("other2.dll", typeof (OtherAssembly.Foo), "Method()")] [KeptMemberInAssembly ("other2.dll", typeof (OtherAssembly.Foo), "UsedByMethod()")] [KeptMemberInAssembly ("other2.dll", typeof (OtherAssembly), "UnusedSanityCheck()")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class DoesNotApplyToSavedAssembly { - public static void Main() + public class DoesNotApplyToSavedAssembly + { + public static void Main () { UsedToMarkMethod (null); } diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToSavedAssembly2.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToSavedAssembly2.cs index 5ffde19bc..67a94430d 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToSavedAssembly2.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToSavedAssembly2.cs @@ -1,15 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [Define ("OTHER_INCLUDED")] [SetupLinkerAction ("save", "other")] - [SetupCompileBefore ("other.dll", new [] { "Dependencies/OtherAssemblyNoInstanceCtor.il" })] + [SetupCompileBefore ("other.dll", new[] { "Dependencies/OtherAssemblyNoInstanceCtor.il" })] [KeptMemberInAssembly ("other.dll", "Mono.Linker.Tests.Cases.UnreachableBody.Dependencies.OtherAssemblyNoInstanceCtor/Foo", "Method()")] [KeptMemberInAssembly ("other.dll", "Mono.Linker.Tests.Cases.UnreachableBody.Dependencies.OtherAssemblyNoInstanceCtor/Foo", "UsedByMethod()")] [KeptMemberInAssembly ("other.dll", "Mono.Linker.Tests.Cases.UnreachableBody.Dependencies.OtherAssemblyNoInstanceCtor", "UnusedSanityCheck()")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class DoesNotApplyToSavedAssembly2 { + public class DoesNotApplyToSavedAssembly2 + { public static void Main () { #if OTHER_INCLUDED diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/ExplicitInstructionCheck.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/ExplicitInstructionCheck.cs index 36f25980d..222700ddd 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/ExplicitInstructionCheck.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/ExplicitInstructionCheck.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class ExplicitInstructionCheck { - public static void Main() + public class ExplicitInstructionCheck + { + public static void Main () { UsedToMarkMethod (null); } @@ -16,9 +18,10 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - class Foo { + class Foo + { [Kept] - [ExpectedInstructionSequence(new [] + [ExpectedInstructionSequence (new[] { "ldstr", "newobj", diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/InterfaceMethod.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/InterfaceMethod.cs index 22e2b55c2..abe14867f 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/InterfaceMethod.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/InterfaceMethod.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class InterfaceMethod { - public static void Main() + public class InterfaceMethod + { + public static void Main () { UsedToMarkMethod (null); } @@ -17,14 +19,16 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - interface IFoo { + interface IFoo + { [Kept] void Method (); } [Kept] [KeptInterface (typeof (IFoo))] - class Foo : IFoo { + class Foo : IFoo + { [Kept] [ExpectBodyModified] public void Method () diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/LinkedOtherIncludedLibrary.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/LinkedOtherIncludedLibrary.cs index e0dcd48e0..63c8a9e06 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/LinkedOtherIncludedLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/LinkedOtherIncludedLibrary.cs @@ -2,15 +2,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Cases.UnreachableBody.Dependencies; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("-r", "other2")] - [SetupCompileBefore ("other2.dll", new [] {typeof (OtherAssembly)})] + [SetupCompileBefore ("other2.dll", new[] { typeof (OtherAssembly) })] [KeptMemberInAssembly ("other2.dll", typeof (OtherAssembly.Foo), "Method()")] [KeptMemberInAssembly ("other2.dll", typeof (OtherAssembly.Foo), "UsedByMethod()")] [KeptMemberInAssembly ("other2.dll", typeof (OtherAssembly), "UnusedSanityCheck()")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class LinkedOtherIncludedLibrary { - public static void Main() + public class LinkedOtherIncludedLibrary + { + public static void Main () { UsedToMarkMethod (null); } diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/LinkedOtherIncludedLibraryNoInstanceCtor.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/LinkedOtherIncludedLibraryNoInstanceCtor.cs index 29f06e96e..9405f540b 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/LinkedOtherIncludedLibraryNoInstanceCtor.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/LinkedOtherIncludedLibraryNoInstanceCtor.cs @@ -1,15 +1,17 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [Define ("OTHER_INCLUDED")] [SetupLinkerArgument ("-r", "other")] - [SetupCompileBefore ("other.dll", new [] { "Dependencies/OtherAssemblyNoInstanceCtor.il" })] + [SetupCompileBefore ("other.dll", new[] { "Dependencies/OtherAssemblyNoInstanceCtor.il" })] [KeptMemberInAssembly ("other.dll", "Mono.Linker.Tests.Cases.UnreachableBody.Dependencies.OtherAssemblyNoInstanceCtor/Foo", "Method()")] [RemovedMemberInAssembly ("other.dll", "Mono.Linker.Tests.Cases.UnreachableBody.Dependencies.OtherAssemblyNoInstanceCtor/Foo", "UsedByMethod()")] [KeptMemberInAssembly ("other.dll", "Mono.Linker.Tests.Cases.UnreachableBody.Dependencies.OtherAssemblyNoInstanceCtor", "UnusedSanityCheck()")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class LinkedOtherIncludedLibraryNoInstanceCtor { + public class LinkedOtherIncludedLibraryNoInstanceCtor + { public static void Main () { #if OTHER_INCLUDED diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/MixOfMethods.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/MixOfMethods.cs index 9f62b7f5b..990ab2261 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/MixOfMethods.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/MixOfMethods.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class MixOfMethods { + public class MixOfMethods + { public static void Main () { UseInstanceMethods (null); @@ -18,18 +20,19 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { f.Method1 (); f.Method2 (); f.Method3 (); - + f.BaseMethod1 (); f.BaseMethod2 (); f.BaseMethod3 (); - + f.Base2Method1 (); f.Base2Method2 (); f.Base2Method3 (); } - + [Kept] - class Base { + class Base + { [Kept] [ExpectBodyModified] public void BaseMethod1 () @@ -54,11 +57,11 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { void UsedByInstance () { } - + [Kept] public static void BasePublicStatic () { - UsedByStatic(); + UsedByStatic (); } [Kept] @@ -69,7 +72,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { [Kept] [KeptBaseType (typeof (Base))] - class Base2 : Base { + class Base2 : Base + { [Kept] [ExpectBodyModified] public void Base2Method1 () @@ -94,11 +98,11 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { void UsedByInstance () { } - + [Kept] public static void Base2PublicStatic () { - UsedByStatic(); + UsedByStatic (); } [Kept] @@ -109,7 +113,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { [Kept] [KeptBaseType (typeof (Base2))] - class Foo : Base2 { + class Foo : Base2 + { [Kept] [ExpectBodyModified] public void Method1 () @@ -138,7 +143,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { [Kept] public static void PublicStatic () { - UsedByStatic(); + UsedByStatic (); } [Kept] diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingEmpty.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingEmpty.cs index 609506c13..b2b931a1e 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingEmpty.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingEmpty.cs @@ -1,13 +1,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ /// <summary> /// Stubbing an empty method would result in more instructions. It's more size efficient to just leave it alone /// </summary> [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class NotWorthConvertingEmpty { - public static void Main() + public class NotWorthConvertingEmpty + { + public static void Main () { UsedToMarkMethod (null); } @@ -19,7 +21,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - class Foo { + class Foo + { [Kept] public void Method () { diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnDouble.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnDouble.cs index 3ae5da068..c40fd355d 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnDouble.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnDouble.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupCompileArgument ("/optimize+")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class NotWorthConvertingReturnDouble { + public class NotWorthConvertingReturnDouble + { public static void Main () { UsedToMarkMethod (null); diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnFalse.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnFalse.cs index 78f295976..c32933e53 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnFalse.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnFalse.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupCompileArgument ("/optimize+")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class NotWorthConvertingReturnFalse { + public class NotWorthConvertingReturnFalse + { public static void Main () { UsedToMarkMethod (null); @@ -17,7 +19,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - class Foo { + class Foo + { [Kept] public bool Method () { diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnFloat.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnFloat.cs index a8204535a..de7209d4e 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnFloat.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnFloat.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupCompileArgument ("/optimize+")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class NotWorthConvertingReturnFloat { + public class NotWorthConvertingReturnFloat + { public static void Main () { UsedToMarkMethod (null); diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnInt.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnInt.cs index c33d126c1..2133024b0 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnInt.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnInt.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupCompileArgument ("/optimize+")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class NotWorthConvertingReturnInt { + public class NotWorthConvertingReturnInt + { public static void Main () { UsedToMarkMethod (null); @@ -26,61 +28,62 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - class Foo { + class Foo + { [Kept] public int Method () { return 0; } - + [Kept] public int Method1 () { return 1; } - + [Kept] public int Method2 () { return 2; } - + [Kept] public int Method3 () { return 3; } - + [Kept] public int Method4 () { return 4; } - + [Kept] public int Method5 () { return 5; } - + [Kept] public int Method6 () { return 6; } - + [Kept] public int Method7 () { return 7; } - + [Kept] public int Method8 () { return 8; } - + [Kept] public int Method9 () { diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnLong.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnLong.cs index daad06c9f..5cd97fbbb 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnLong.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnLong.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupCompileArgument ("/optimize+")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class NotWorthConvertingReturnLong { + public class NotWorthConvertingReturnLong + { public static void Main () { UsedToMarkMethod (null); diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnNull.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnNull.cs index d2c66f479..468b3490f 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnNull.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnNull.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupCompileArgument ("/optimize+")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class NotWorthConvertingReturnNull { + public class NotWorthConvertingReturnNull + { public static void Main () { UsedToMarkMethod (null); @@ -17,7 +19,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - class Foo { + class Foo + { [Kept] public object Method () { diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnTrue.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnTrue.cs index 0883c9fdf..713ced928 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnTrue.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/NotWorthConvertingReturnTrue.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupCompileArgument ("/optimize+")] [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class NotWorthConvertingReturnTrue { + public class NotWorthConvertingReturnTrue + { public static void Main () { UsedToMarkMethod (null); @@ -17,7 +19,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - class Foo { + class Foo + { [Kept] public bool Method () { diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAVirtual.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAVirtual.cs index 814a09353..69bc5c801 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAVirtual.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAVirtual.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class OverrideOfAVirtual { - public static void Main() + public class OverrideOfAVirtual + { + public static void Main () { UsedToMarkMethod (null); } @@ -16,14 +18,15 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - class Base { + class Base + { [Kept] [ExpectBodyModified] public virtual void Method () { - UsedByMethod(); + UsedByMethod (); } - + void UsedByMethod () { } @@ -31,7 +34,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { [Kept] [KeptBaseType (typeof (Base))] - class Foo : Base { + class Foo : Base + { // A callvirt to Base.Method() appears in the IL so this override can be removed entirely public override void Method () { diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodCalledFromLocal.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodCalledFromLocal.cs index f5c7f942b..ff4b7c785 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodCalledFromLocal.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodCalledFromLocal.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class OverrideOfAbstractAndInterfaceMethodCalledFromLocal { + public class OverrideOfAbstractAndInterfaceMethodCalledFromLocal + { public static void Main () { Foo b = HelperToMarkFooAndRequireBase (); @@ -18,7 +20,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - abstract class Base { + abstract class Base + { [Kept] // FIXME : Technically this can be removed public abstract void Method (); } @@ -26,7 +29,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { [Kept] [KeptBaseType (typeof (Base))] [KeptInterface (typeof (IBar))] - class Foo : Base, IBar { + class Foo : Base, IBar + { [Kept] [ExpectBodyModified] public override void Method () @@ -40,7 +44,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - interface IBar { + interface IBar + { [Kept] void Method (); } diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodCalledFromLocal2.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodCalledFromLocal2.cs index be97dff57..57cb508c3 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodCalledFromLocal2.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodCalledFromLocal2.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class OverrideOfAbstractAndInterfaceMethodCalledFromLocal2 { + public class OverrideOfAbstractAndInterfaceMethodCalledFromLocal2 + { public static void Main () { Foo f = HelperToMarkFooAndRequireBase (); @@ -25,7 +27,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - abstract class Base { + abstract class Base + { [Kept] // FIXME : Technically this can be removed public abstract void Method (); } @@ -33,7 +36,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { [Kept] [KeptBaseType (typeof (Base))] [KeptInterface (typeof (IBar))] - class Foo : Base, IBar { + class Foo : Base, IBar + { [Kept] [ExpectBodyModified] public override void Method () @@ -47,9 +51,10 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - interface IBar { + interface IBar + { [Kept] - void Method(); + void Method (); } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodCalledFromLocal3.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodCalledFromLocal3.cs index aa5dcd903..665d6d342 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodCalledFromLocal3.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodCalledFromLocal3.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class OverrideOfAbstractAndInterfaceMethodCalledFromLocal3 { + public class OverrideOfAbstractAndInterfaceMethodCalledFromLocal3 + { public static void Main () { Foo b = null; @@ -12,7 +14,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - abstract class Base { + abstract class Base + { [Kept] // FIXME : Technically this can be removed public abstract void Method (); } @@ -20,7 +23,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { [Kept] [KeptBaseType (typeof (Base))] [KeptInterface (typeof (IBar))] - class Foo : Base, IBar { + class Foo : Base, IBar + { [Kept] [ExpectBodyModified] public override void Method () @@ -34,7 +38,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - interface IBar { + interface IBar + { [Kept] void Method (); } diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved2.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved2.cs index 18337629a..0f6ed0d7d 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved2.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved2.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved2 { + public class OverrideOfAbstractAndInterfaceMethodWhenInterfaceRemoved2 + { public static void Main () { Foo f = HelperToMarkFooAndRequireBase (); @@ -23,22 +25,24 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { { return null; } - + [Kept] - static void HelperToMarkIBar() + static void HelperToMarkIBar () { - GetAnIBar().Method(); + GetAnIBar ().Method (); } [Kept] - abstract class Base { + abstract class Base + { [Kept] public abstract void Method (); } [Kept] [KeptBaseType (typeof (Base))] - class Foo : Base, IBar { + class Foo : Base, IBar + { [Kept] [ExpectBodyModified] public override void Method () @@ -52,9 +56,10 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - interface IBar { + interface IBar + { [Kept] - void Method(); + void Method (); } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractIsStubbed.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractIsStubbed.cs index 83cd63392..f8ba8548b 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractIsStubbed.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractIsStubbed.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class OverrideOfAbstractIsStubbed { + public class OverrideOfAbstractIsStubbed + { public static void Main () { Base b = HelperToMarkFooAndRequireBase (); @@ -25,7 +27,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { [Kept] [KeptBaseType (typeof (Base))] - class Foo : Base { + class Foo : Base + { [Kept] [ExpectBodyModified] public override void Method () diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractIsStubbedWithUnusedInterface.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractIsStubbedWithUnusedInterface.cs index 56e73a881..4c50d9d08 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractIsStubbedWithUnusedInterface.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/OverrideOfAbstractIsStubbedWithUnusedInterface.cs @@ -1,9 +1,11 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class OverrideOfAbstractIsStubbedWithUnusedInterface { + public class OverrideOfAbstractIsStubbedWithUnusedInterface + { public static void Main () { Base b = HelperToMarkFooAndRequireBase (); @@ -25,7 +27,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { [Kept] [KeptBaseType (typeof (Base))] - class Foo : Base, IBar { + class Foo : Base, IBar + { [Kept] [ExpectBodyModified] public override void Method () @@ -40,7 +43,7 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { interface IBar { - void Method(); + void Method (); } } }
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleGetter.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleGetter.cs index 7950d5524..7cf0078e4 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleGetter.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleGetter.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class SimpleGetter { - public static void Main() + public class SimpleGetter + { + public static void Main () { UsedToMarkMethod (null); } @@ -16,7 +18,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - class Foo { + class Foo + { [Kept] public string Property { [Kept] [ExpectBodyModified] get; set; } } diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleMethod.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleMethod.cs index 00f8baec3..fd29e7f07 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleMethod.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleMethod.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class SimpleMethod { - public static void Main() + public class SimpleMethod + { + public static void Main () { UsedToMarkMethod (null); } @@ -16,7 +18,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - class Foo { + class Foo + { [Kept] [ExpectBodyModified] public void Method () diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleSetter.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleSetter.cs index 0a5d63c4f..971477418 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleSetter.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/SimpleSetter.cs @@ -1,10 +1,12 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class SimpleSetter { - public static void Main() + public class SimpleSetter + { + public static void Main () { UsedToMarkMethod (null); } @@ -16,7 +18,8 @@ namespace Mono.Linker.Tests.Cases.UnreachableBody { } [Kept] - class Foo { + class Foo + { [Kept] public string Property { get; [Kept] [ExpectBodyModified] set; } } diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/WorksWithLinkXml.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/WorksWithLinkXml.cs index 54750a377..99e667a52 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/WorksWithLinkXml.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/WorksWithLinkXml.cs @@ -1,15 +1,18 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - public class WorksWithLinkXml { - public static void Main() + public class WorksWithLinkXml + { + public static void Main () { } [Kept] - class Foo { + class Foo + { [Kept] [ExpectBodyModified] public void InstanceMethod () diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBody/WorksWithPreserveDependency.cs b/test/Mono.Linker.Tests.Cases/UnreachableBody/WorksWithPreserveDependency.cs index ea2ffef58..5f4cad1d2 100644 --- a/test/Mono.Linker.Tests.Cases/UnreachableBody/WorksWithPreserveDependency.cs +++ b/test/Mono.Linker.Tests.Cases/UnreachableBody/WorksWithPreserveDependency.cs @@ -2,17 +2,20 @@ using System.Runtime.CompilerServices; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.Cases.UnreachableBody { +namespace Mono.Linker.Tests.Cases.UnreachableBody +{ [SetupLinkerArgument ("--enable-opt", "unreachablebodies")] - [SetupCompileBefore ("FakeSystemAssembly.dll", new [] { "../PreserveDependencies/Dependencies/PreserveDependencyAttribute.cs" })] - public class WorksWithPreserveDependency { - public static void Main() + [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "../PreserveDependencies/Dependencies/PreserveDependencyAttribute.cs" })] + public class WorksWithPreserveDependency + { + public static void Main () { Foo.StaticMethod (); } [Kept] - class Foo { + class Foo + { [Kept] [PreserveDependency ("InstanceMethod()")] public static void StaticMethod () diff --git a/test/Mono.Linker.Tests/Extensions/CecilExtensions.cs b/test/Mono.Linker.Tests/Extensions/CecilExtensions.cs index 60781468d..ad0a3bcda 100644 --- a/test/Mono.Linker.Tests/Extensions/CecilExtensions.cs +++ b/test/Mono.Linker.Tests/Extensions/CecilExtensions.cs @@ -1,11 +1,13 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using Mono.Cecil; -namespace Mono.Linker.Tests.Extensions { - public static class CecilExtensions { +namespace Mono.Linker.Tests.Extensions +{ + public static class CecilExtensions + { public static IEnumerable<TypeDefinition> AllDefinedTypes (this AssemblyDefinition assemblyDefinition) { return assemblyDefinition.Modules.SelectMany (m => m.AllDefinedTypes ()); @@ -58,30 +60,30 @@ namespace Mono.Linker.Tests.Extensions { public static IEnumerable<MethodDefinition> AllMethods (this TypeDefinition type) { - foreach (var m in type.AllMembers()) { + foreach (var m in type.AllMembers ()) { switch (m) { - case MethodDefinition method: - yield return method; - break; - case PropertyDefinition @property: - if (@property.GetMethod != null) - yield return @property.GetMethod; + case MethodDefinition method: + yield return method; + break; + case PropertyDefinition @property: + if (@property.GetMethod != null) + yield return @property.GetMethod; - if (@property.SetMethod != null) - yield return @property.SetMethod; + if (@property.SetMethod != null) + yield return @property.SetMethod; - break; - case EventDefinition @event: - if (@event.AddMethod != null) - yield return @event.AddMethod; + break; + case EventDefinition @event: + if (@event.AddMethod != null) + yield return @event.AddMethod; - if (@event.RemoveMethod != null) - yield return @event.RemoveMethod; + if (@event.RemoveMethod != null) + yield return @event.RemoveMethod; - break; + break; - default: - break; + default: + break; } } } @@ -127,9 +129,9 @@ namespace Mono.Linker.Tests.Extensions { builder.Append ('<'); for (int i = 0; i < method.GenericParameters.Count - 1; i++) - builder.Append ($"{method.GenericParameters [i]},"); + builder.Append ($"{method.GenericParameters[i]},"); - builder.Append ($"{method.GenericParameters [method.GenericParameters.Count - 1]}>"); + builder.Append ($"{method.GenericParameters[method.GenericParameters.Count - 1]}>"); } builder.Append ("("); @@ -138,10 +140,10 @@ namespace Mono.Linker.Tests.Extensions { for (int i = 0; i < method.Parameters.Count - 1; i++) { // TODO: modifiers // TODO: default values - builder.Append ($"{method.Parameters [i].ParameterType},"); + builder.Append ($"{method.Parameters[i].ParameterType},"); } - builder.Append (method.Parameters [method.Parameters.Count - 1].ParameterType); + builder.Append (method.Parameters[method.Parameters.Count - 1].ParameterType); } builder.Append (")"); diff --git a/test/Mono.Linker.Tests/Extensions/NiceIO.cs b/test/Mono.Linker.Tests/Extensions/NiceIO.cs index 32cf6c7e7..8b61f67c0 100644 --- a/test/Mono.Linker.Tests/Extensions/NiceIO.cs +++ b/test/Mono.Linker.Tests/Extensions/NiceIO.cs @@ -34,7 +34,7 @@ namespace Mono.Linker.Tests.Extensions { public class NPath : IEquatable<NPath>, IComparable { - private static readonly StringComparison PathStringComparison = IsLinux() ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; + private static readonly StringComparison PathStringComparison = IsLinux () ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; private readonly string[] _elements; private readonly bool _isRelative; @@ -42,288 +42,266 @@ namespace Mono.Linker.Tests.Extensions #region construction - public NPath(string path) + public NPath (string path) { if (path == null) - throw new ArgumentNullException(); + throw new ArgumentNullException (); - path = ParseDriveLetter(path, out _driveLetter); + path = ParseDriveLetter (path, out _driveLetter); - if (path == "/") - { + if (path == "/") { _isRelative = false; _elements = new string[] { }; - } - else - { - var split = path.Split('/', '\\'); + } else { + var split = path.Split ('/', '\\'); - _isRelative = _driveLetter == null && IsRelativeFromSplitString(split); + _isRelative = _driveLetter == null && IsRelativeFromSplitString (split); - _elements = ParseSplitStringIntoElements(split.Where(s => s.Length > 0).ToArray()); + _elements = ParseSplitStringIntoElements (split.Where (s => s.Length > 0).ToArray ()); } } - private NPath(string[] elements, bool isRelative, string driveLetter) + private NPath (string[] elements, bool isRelative, string driveLetter) { _elements = elements; _isRelative = isRelative; _driveLetter = driveLetter; } - private string[] ParseSplitStringIntoElements(IEnumerable<string> inputs) + private string[] ParseSplitStringIntoElements (IEnumerable<string> inputs) { - var stack = new List<string>(); + var stack = new List<string> (); - foreach (var input in inputs.Where(input => input.Length != 0)) - { - if (input == ".") - { - if ((stack.Count > 0) && (stack.Last() != ".")) + foreach (var input in inputs.Where (input => input.Length != 0)) { + if (input == ".") { + if ((stack.Count > 0) && (stack.Last () != ".")) continue; - } - else if (input == "..") - { - if (HasNonDotDotLastElement(stack)) - { - stack.RemoveAt(stack.Count - 1); + } else if (input == "..") { + if (HasNonDotDotLastElement (stack)) { + stack.RemoveAt (stack.Count - 1); continue; } if (!_isRelative) - throw new ArgumentException("You cannot create a path that tries to .. past the root"); + throw new ArgumentException ("You cannot create a path that tries to .. past the root"); } - stack.Add(input); + stack.Add (input); } - return stack.ToArray(); + return stack.ToArray (); } - private static bool HasNonDotDotLastElement(List<string> stack) + private static bool HasNonDotDotLastElement (List<string> stack) { return stack.Count > 0 && stack[stack.Count - 1] != ".."; } - private string ParseDriveLetter(string path, out string driveLetter) + private string ParseDriveLetter (string path, out string driveLetter) { - if (path.Length >= 2 && path[1] == ':') - { - driveLetter = path[0].ToString(); - return path.Substring(2); + if (path.Length >= 2 && path[1] == ':') { + driveLetter = path[0].ToString (); + return path.Substring (2); } driveLetter = null; return path; } - private static bool IsRelativeFromSplitString(string[] split) + private static bool IsRelativeFromSplitString (string[] split) { if (split.Length < 2) return true; - return split[0].Length != 0 || !split.Any(s => s.Length > 0); + return split[0].Length != 0 || !split.Any (s => s.Length > 0); } - public NPath Combine(params string[] append) + public NPath Combine (params string[] append) { - return Combine(append.Select(a => new NPath(a)).ToArray()); + return Combine (append.Select (a => new NPath (a)).ToArray ()); } - public NPath Combine(params NPath[] append) + public NPath Combine (params NPath[] append) { - if (!append.All(p => p.IsRelative)) - throw new ArgumentException("You cannot .Combine a non-relative path"); + if (!append.All (p => p.IsRelative)) + throw new ArgumentException ("You cannot .Combine a non-relative path"); - return new NPath(ParseSplitStringIntoElements(_elements.Concat(append.SelectMany(p => p._elements))), _isRelative, _driveLetter); + return new NPath (ParseSplitStringIntoElements (_elements.Concat (append.SelectMany (p => p._elements))), _isRelative, _driveLetter); } - public NPath Parent - { - get - { + public NPath Parent { + get { if (_elements.Length == 0) - throw new InvalidOperationException("Parent is called on an empty path"); + throw new InvalidOperationException ("Parent is called on an empty path"); - var newElements = _elements.Take(_elements.Length - 1).ToArray(); + var newElements = _elements.Take (_elements.Length - 1).ToArray (); - return new NPath(newElements, _isRelative, _driveLetter); + return new NPath (newElements, _isRelative, _driveLetter); } } - public NPath RelativeTo(NPath path) + public NPath RelativeTo (NPath path) { - if (!IsChildOf(path)) - { + if (!IsChildOf (path)) { if (!IsRelative && !path.IsRelative && _driveLetter != path._driveLetter) - throw new ArgumentException("Path.RelativeTo() was invoked with two paths that are on different volumes. invoked on: " + ToString() + " asked to be made relative to: " + path); + throw new ArgumentException ("Path.RelativeTo() was invoked with two paths that are on different volumes. invoked on: " + ToString () + " asked to be made relative to: " + path); NPath commonParent = null; - foreach (var parent in RecursiveParents) - { - commonParent = path.RecursiveParents.FirstOrDefault(otherParent => otherParent == parent); + foreach (var parent in RecursiveParents) { + commonParent = path.RecursiveParents.FirstOrDefault (otherParent => otherParent == parent); if (commonParent != null) break; } if (commonParent == null) - throw new ArgumentException("Path.RelativeTo() was unable to find a common parent between " + ToString() + " and " + path); + throw new ArgumentException ("Path.RelativeTo() was unable to find a common parent between " + ToString () + " and " + path); - if (IsRelative && path.IsRelative && commonParent.IsEmpty()) - throw new ArgumentException("Path.RelativeTo() was invoked with two relative paths that do not share a common parent. Invoked on: " + ToString() + " asked to be made relative to: " + path); + if (IsRelative && path.IsRelative && commonParent.IsEmpty ()) + throw new ArgumentException ("Path.RelativeTo() was invoked with two relative paths that do not share a common parent. Invoked on: " + ToString () + " asked to be made relative to: " + path); var depthDiff = path.Depth - commonParent.Depth; - return new NPath(Enumerable.Repeat("..", depthDiff).Concat(_elements.Skip(commonParent.Depth)).ToArray(), true, null); + return new NPath (Enumerable.Repeat ("..", depthDiff).Concat (_elements.Skip (commonParent.Depth)).ToArray (), true, null); } - return new NPath(_elements.Skip(path._elements.Length).ToArray(), true, null); + return new NPath (_elements.Skip (path._elements.Length).ToArray (), true, null); } - public NPath ChangeExtension(string extension) + public NPath ChangeExtension (string extension) { - ThrowIfRoot(); + ThrowIfRoot (); - var newElements = (string[])_elements.Clone(); - newElements[newElements.Length - 1] = Path.ChangeExtension(_elements[_elements.Length - 1], WithDot(extension)); + var newElements = (string[]) _elements.Clone (); + newElements[newElements.Length - 1] = Path.ChangeExtension (_elements[_elements.Length - 1], WithDot (extension)); if (extension == string.Empty) - newElements[newElements.Length - 1] = newElements[newElements.Length - 1].TrimEnd('.'); - return new NPath(newElements, _isRelative, _driveLetter); + newElements[newElements.Length - 1] = newElements[newElements.Length - 1].TrimEnd ('.'); + return new NPath (newElements, _isRelative, _driveLetter); } #endregion construction #region inspection - public bool IsRelative - { + public bool IsRelative { get { return _isRelative; } } - public string FileName - { - get - { - ThrowIfRoot(); + public string FileName { + get { + ThrowIfRoot (); - return _elements.Last(); + return _elements.Last (); } } - public string FileNameWithoutExtension - { - get { return Path.GetFileNameWithoutExtension(FileName); } + public string FileNameWithoutExtension { + get { return Path.GetFileNameWithoutExtension (FileName); } } - public IEnumerable<string> Elements - { + public IEnumerable<string> Elements { get { return _elements; } } - public int Depth - { + public int Depth { get { return _elements.Length; } } - public bool Exists(string append = "") + public bool Exists (string append = "") { - return Exists(new NPath(append)); + return Exists (new NPath (append)); } - public bool Exists(NPath append) + public bool Exists (NPath append) { - return FileExists(append) || DirectoryExists(append); + return FileExists (append) || DirectoryExists (append); } - public bool DirectoryExists(string append = "") + public bool DirectoryExists (string append = "") { - return DirectoryExists(new NPath(append)); + return DirectoryExists (new NPath (append)); } - public bool DirectoryExists(NPath append) + public bool DirectoryExists (NPath append) { - return Directory.Exists(Combine(append).ToString()); + return Directory.Exists (Combine (append).ToString ()); } - public bool FileExists(string append = "") + public bool FileExists (string append = "") { - return FileExists(new NPath(append)); + return FileExists (new NPath (append)); } - public bool FileExists(NPath append) + public bool FileExists (NPath append) { - return File.Exists(Combine(append).ToString()); + return File.Exists (Combine (append).ToString ()); } - public string ExtensionWithDot - { - get - { + public string ExtensionWithDot { + get { if (IsRoot) - throw new ArgumentException("A root directory does not have an extension"); + throw new ArgumentException ("A root directory does not have an extension"); - var last = _elements.Last(); - var index = last.LastIndexOf("."); + var last = _elements.Last (); + var index = last.LastIndexOf ("."); if (index < 0) return String.Empty; - return last.Substring(index); + return last.Substring (index); } } - public string InQuotes() + public string InQuotes () { - return "\"" + ToString() + "\""; + return "\"" + ToString () + "\""; } - public string InQuotes(SlashMode slashMode) + public string InQuotes (SlashMode slashMode) { - return "\"" + ToString(slashMode) + "\""; + return "\"" + ToString (slashMode) + "\""; } - public override string ToString() + public override string ToString () { - return ToString(SlashMode.Native); + return ToString (SlashMode.Native); } - public string ToString(SlashMode slashMode) + public string ToString (SlashMode slashMode) { // Check if it's linux root / - if (IsRoot && string.IsNullOrEmpty(_driveLetter)) - return Slash(slashMode).ToString(); + if (IsRoot && string.IsNullOrEmpty (_driveLetter)) + return Slash (slashMode).ToString (); if (_isRelative && _elements.Length == 0) return "."; - var sb = new StringBuilder(); - if (_driveLetter != null) - { - sb.Append(_driveLetter); - sb.Append(":"); + var sb = new StringBuilder (); + if (_driveLetter != null) { + sb.Append (_driveLetter); + sb.Append (":"); } if (!_isRelative) - sb.Append(Slash(slashMode)); + sb.Append (Slash (slashMode)); var first = true; - foreach (var element in _elements) - { + foreach (var element in _elements) { if (!first) - sb.Append(Slash(slashMode)); + sb.Append (Slash (slashMode)); - sb.Append(element); + sb.Append (element); first = false; } - return sb.ToString(); + return sb.ToString (); } - public static implicit operator string(NPath path) + public static implicit operator string (NPath path) { - return path.ToString(); + return path.ToString (); } - static char Slash(SlashMode slashMode) + static char Slash (SlashMode slashMode) { - return slashMode switch { + return slashMode switch + { SlashMode.Backward => '\\', SlashMode.Forward => '/', _ => Path.DirectorySeparatorChar, }; } - public override bool Equals(Object obj) + public override bool Equals (Object obj) { if (obj == null) return false; @@ -332,31 +310,31 @@ namespace Mono.Linker.Tests.Extensions if (!(obj is NPath p)) return false; - return Equals(p); + return Equals (p); } - public bool Equals(NPath p) + public bool Equals (NPath p) { if (p._isRelative != _isRelative) return false; - if (!string.Equals(p._driveLetter, _driveLetter, PathStringComparison)) + if (!string.Equals (p._driveLetter, _driveLetter, PathStringComparison)) return false; if (p._elements.Length != _elements.Length) return false; for (var i = 0; i != _elements.Length; i++) - if (!string.Equals(p._elements[i], _elements[i], PathStringComparison)) + if (!string.Equals (p._elements[i], _elements[i], PathStringComparison)) return false; return true; } - public static bool operator ==(NPath a, NPath b) + public static bool operator == (NPath a, NPath b) { // If both are null, or both are same instance, return true. - if (ReferenceEquals(a, b)) + if (ReferenceEquals (a, b)) return true; // If one is null, but not both, return false. @@ -364,55 +342,53 @@ namespace Mono.Linker.Tests.Extensions return false; // Return true if the fields match: - return a.Equals(b); + return a.Equals (b); } - public override int GetHashCode() + public override int GetHashCode () { - unchecked - { + unchecked { int hash = 17; // Suitable nullity checks etc, of course :) - hash = hash * 23 + _isRelative.GetHashCode(); + hash = hash * 23 + _isRelative.GetHashCode (); foreach (var element in _elements) - hash = hash * 23 + element.GetHashCode(); + hash = hash * 23 + element.GetHashCode (); if (_driveLetter != null) - hash = hash * 23 + _driveLetter.GetHashCode(); + hash = hash * 23 + _driveLetter.GetHashCode (); return hash; } } - public int CompareTo(object obj) + public int CompareTo (object obj) { if (obj == null) return -1; - return this.ToString().CompareTo(((NPath)obj).ToString()); + return this.ToString ().CompareTo (((NPath) obj).ToString ()); } - public static bool operator !=(NPath a, NPath b) + public static bool operator != (NPath a, NPath b) { return !(a == b); } - public bool HasExtension(params string[] extensions) + public bool HasExtension (params string[] extensions) { - var extensionWithDotLower = ExtensionWithDot.ToLower(); - return extensions.Any(e => WithDot(e).ToLower() == extensionWithDotLower); + var extensionWithDotLower = ExtensionWithDot.ToLower (); + return extensions.Any (e => WithDot (e).ToLower () == extensionWithDotLower); } - private static string WithDot(string extension) + private static string WithDot (string extension) { - return extension.StartsWith(".") ? extension : "." + extension; + return extension.StartsWith (".") ? extension : "." + extension; } - private bool IsEmpty() + private bool IsEmpty () { return _elements.Length == 0; } - public bool IsRoot - { + public bool IsRoot { get { return _elements.Length == 0 && !_isRelative; } } @@ -420,368 +396,346 @@ namespace Mono.Linker.Tests.Extensions #region directory enumeration - public IEnumerable<NPath> Files(string filter, bool recurse = false) + public IEnumerable<NPath> Files (string filter, bool recurse = false) { - return Directory.GetFiles(ToString(), filter, recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly).Select(s => new NPath(s)); + return Directory.GetFiles (ToString (), filter, recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly).Select (s => new NPath (s)); } - public IEnumerable<NPath> Files(bool recurse = false) + public IEnumerable<NPath> Files (bool recurse = false) { - return Files("*", recurse); + return Files ("*", recurse); } - public IEnumerable<NPath> Contents(string filter, bool recurse = false) + public IEnumerable<NPath> Contents (string filter, bool recurse = false) { - return Files(filter, recurse).Concat(Directories(filter, recurse)); + return Files (filter, recurse).Concat (Directories (filter, recurse)); } - public IEnumerable<NPath> Contents(bool recurse = false) + public IEnumerable<NPath> Contents (bool recurse = false) { - return Contents("*", recurse); + return Contents ("*", recurse); } - public IEnumerable<NPath> Directories(string filter, bool recurse = false) + public IEnumerable<NPath> Directories (string filter, bool recurse = false) { - return Directory.GetDirectories(ToString(), filter, recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly).Select(s => new NPath(s)); + return Directory.GetDirectories (ToString (), filter, recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly).Select (s => new NPath (s)); } - public IEnumerable<NPath> Directories(bool recurse = false) + public IEnumerable<NPath> Directories (bool recurse = false) { - return Directories("*", recurse); + return Directories ("*", recurse); } #endregion #region filesystem writing operations - public NPath CreateFile() + public NPath CreateFile () { - ThrowIfRelative(); - ThrowIfRoot(); - EnsureParentDirectoryExists(); - File.WriteAllBytes(ToString(), new byte[0]); + ThrowIfRelative (); + ThrowIfRoot (); + EnsureParentDirectoryExists (); + File.WriteAllBytes (ToString (), new byte[0]); return this; } - public NPath CreateFile(string file) + public NPath CreateFile (string file) { - return CreateFile(new NPath(file)); + return CreateFile (new NPath (file)); } - public NPath CreateFile(NPath file) + public NPath CreateFile (NPath file) { if (!file.IsRelative) - throw new ArgumentException("You cannot call CreateFile() on an existing path with a non relative argument"); - return Combine(file).CreateFile(); + throw new ArgumentException ("You cannot call CreateFile() on an existing path with a non relative argument"); + return Combine (file).CreateFile (); } - public NPath CreateDirectory() + public NPath CreateDirectory () { - ThrowIfRelative(); + ThrowIfRelative (); if (IsRoot) - throw new NotSupportedException("CreateDirectory is not supported on a root level directory because it would be dangerous:" + ToString()); + throw new NotSupportedException ("CreateDirectory is not supported on a root level directory because it would be dangerous:" + ToString ()); - Directory.CreateDirectory(ToString()); + Directory.CreateDirectory (ToString ()); return this; } - public NPath CreateDirectory(string directory) + public NPath CreateDirectory (string directory) { - return CreateDirectory(new NPath(directory)); + return CreateDirectory (new NPath (directory)); } - public NPath CreateDirectory(NPath directory) + public NPath CreateDirectory (NPath directory) { if (!directory.IsRelative) - throw new ArgumentException("Cannot call CreateDirectory with an absolute argument"); + throw new ArgumentException ("Cannot call CreateDirectory with an absolute argument"); - return Combine(directory).CreateDirectory(); + return Combine (directory).CreateDirectory (); } - public NPath Copy(string dest) + public NPath Copy (string dest) { - return Copy(new NPath(dest)); + return Copy (new NPath (dest)); } - public NPath Copy(string dest, Func<NPath, bool> fileFilter) + public NPath Copy (string dest, Func<NPath, bool> fileFilter) { - return Copy(new NPath(dest), fileFilter); + return Copy (new NPath (dest), fileFilter); } - public NPath Copy(NPath dest) + public NPath Copy (NPath dest) { - return Copy(dest, p => true); + return Copy (dest, p => true); } - public NPath Copy(NPath dest, Func<NPath, bool> fileFilter) + public NPath Copy (NPath dest, Func<NPath, bool> fileFilter) { - ThrowIfRelative(); + ThrowIfRelative (); if (dest.IsRelative) - dest = Parent.Combine(dest); + dest = Parent.Combine (dest); - if (dest.DirectoryExists()) - return CopyWithDeterminedDestination(dest.Combine(FileName), fileFilter); + if (dest.DirectoryExists ()) + return CopyWithDeterminedDestination (dest.Combine (FileName), fileFilter); - return CopyWithDeterminedDestination(dest, fileFilter); + return CopyWithDeterminedDestination (dest, fileFilter); } - public NPath MakeAbsolute() + public NPath MakeAbsolute () { if (!IsRelative) return this; - return NPath.CurrentDirectory.Combine(this); + return NPath.CurrentDirectory.Combine (this); } - NPath CopyWithDeterminedDestination(NPath absoluteDestination, Func<NPath, bool> fileFilter) + NPath CopyWithDeterminedDestination (NPath absoluteDestination, Func<NPath, bool> fileFilter) { if (absoluteDestination.IsRelative) - throw new ArgumentException("absoluteDestination must be absolute"); + throw new ArgumentException ("absoluteDestination must be absolute"); - if (FileExists()) - { - if (!fileFilter(absoluteDestination)) + if (FileExists ()) { + if (!fileFilter (absoluteDestination)) return null; - absoluteDestination.EnsureParentDirectoryExists(); + absoluteDestination.EnsureParentDirectoryExists (); - File.Copy(ToString(), absoluteDestination.ToString(), true); + File.Copy (ToString (), absoluteDestination.ToString (), true); return absoluteDestination; } - if (DirectoryExists()) - { - absoluteDestination.EnsureDirectoryExists(); - foreach (var thing in Contents()) - thing.CopyWithDeterminedDestination(absoluteDestination.Combine(thing.RelativeTo(this)), fileFilter); + if (DirectoryExists ()) { + absoluteDestination.EnsureDirectoryExists (); + foreach (var thing in Contents ()) + thing.CopyWithDeterminedDestination (absoluteDestination.Combine (thing.RelativeTo (this)), fileFilter); return absoluteDestination; } - throw new ArgumentException("Copy() called on path that doesnt exist: " + ToString()); + throw new ArgumentException ("Copy() called on path that doesnt exist: " + ToString ()); } - public void Delete(DeleteMode deleteMode = DeleteMode.Normal) + public void Delete (DeleteMode deleteMode = DeleteMode.Normal) { - ThrowIfRelative(); + ThrowIfRelative (); if (IsRoot) - throw new NotSupportedException("Delete is not supported on a root level directory because it would be dangerous:" + ToString()); - - if (FileExists()) - File.Delete(ToString()); - else if (DirectoryExists()) - try - { - Directory.Delete(ToString(), true); - } - catch (IOException) - { + throw new NotSupportedException ("Delete is not supported on a root level directory because it would be dangerous:" + ToString ()); + + if (FileExists ()) + File.Delete (ToString ()); + else if (DirectoryExists ()) + try { + Directory.Delete (ToString (), true); + } catch (IOException) { if (deleteMode == DeleteMode.Normal) throw; } else - throw new InvalidOperationException("Trying to delete a path that does not exist: " + ToString()); + throw new InvalidOperationException ("Trying to delete a path that does not exist: " + ToString ()); } - public void DeleteIfExists(DeleteMode deleteMode = DeleteMode.Normal) + public void DeleteIfExists (DeleteMode deleteMode = DeleteMode.Normal) { - ThrowIfRelative(); + ThrowIfRelative (); - if (FileExists() || DirectoryExists()) - Delete(deleteMode); + if (FileExists () || DirectoryExists ()) + Delete (deleteMode); } - public NPath DeleteContents() + public NPath DeleteContents () { - ThrowIfRelative(); + ThrowIfRelative (); if (IsRoot) - throw new NotSupportedException("DeleteContents is not supported on a root level directory because it would be dangerous:" + ToString()); + throw new NotSupportedException ("DeleteContents is not supported on a root level directory because it would be dangerous:" + ToString ()); - if (FileExists()) - throw new InvalidOperationException("It is not valid to perform this operation on a file"); + if (FileExists ()) + throw new InvalidOperationException ("It is not valid to perform this operation on a file"); - if (DirectoryExists()) - { - try - { - Files().Delete(); - Directories().Delete(); - } - catch (IOException) - { - if (Files(true).Any()) + if (DirectoryExists ()) { + try { + Files ().Delete (); + Directories ().Delete (); + } catch (IOException) { + if (Files (true).Any ()) throw; } return this; } - return EnsureDirectoryExists(); + return EnsureDirectoryExists (); } - public static NPath CreateTempDirectory(string myprefix) + public static NPath CreateTempDirectory (string myprefix) { - var random = new Random(); - while (true) - { - var candidate = new NPath(Path.GetTempPath() + "/" + myprefix + "_" + random.Next()); - if (!candidate.Exists()) - return candidate.CreateDirectory(); + var random = new Random (); + while (true) { + var candidate = new NPath (Path.GetTempPath () + "/" + myprefix + "_" + random.Next ()); + if (!candidate.Exists ()) + return candidate.CreateDirectory (); } } - public NPath Move(string dest) + public NPath Move (string dest) { - return Move(new NPath(dest)); + return Move (new NPath (dest)); } - public NPath Move(NPath dest) + public NPath Move (NPath dest) { - ThrowIfRelative(); + ThrowIfRelative (); if (IsRoot) - throw new NotSupportedException("Move is not supported on a root level directory because it would be dangerous:" + ToString()); + throw new NotSupportedException ("Move is not supported on a root level directory because it would be dangerous:" + ToString ()); if (dest.IsRelative) - return Move(Parent.Combine(dest)); + return Move (Parent.Combine (dest)); - if (dest.DirectoryExists()) - return Move(dest.Combine(FileName)); + if (dest.DirectoryExists ()) + return Move (dest.Combine (FileName)); - if (FileExists()) - { - dest.EnsureParentDirectoryExists(); - File.Move(ToString(), dest.ToString()); + if (FileExists ()) { + dest.EnsureParentDirectoryExists (); + File.Move (ToString (), dest.ToString ()); return dest; } - if (DirectoryExists()) - { - Directory.Move(ToString(), dest.ToString()); + if (DirectoryExists ()) { + Directory.Move (ToString (), dest.ToString ()); return dest; } - throw new ArgumentException("Move() called on a path that doesn't exist: " + ToString()); + throw new ArgumentException ("Move() called on a path that doesn't exist: " + ToString ()); } #endregion #region special paths - public static NPath CurrentDirectory - { - get - { - return new NPath(Directory.GetCurrentDirectory()); + public static NPath CurrentDirectory { + get { + return new NPath (Directory.GetCurrentDirectory ()); } } - public static NPath HomeDirectory - { - get - { + public static NPath HomeDirectory { + get { if (Path.DirectorySeparatorChar == '\\') - return new NPath(Environment.GetEnvironmentVariable("USERPROFILE")); - return new NPath(Environment.GetEnvironmentVariable("HOME")); + return new NPath (Environment.GetEnvironmentVariable ("USERPROFILE")); + return new NPath (Environment.GetEnvironmentVariable ("HOME")); } } - public static NPath SystemTemp - { - get - { - return new NPath(Path.GetTempPath()); + public static NPath SystemTemp { + get { + return new NPath (Path.GetTempPath ()); } } #endregion - private void ThrowIfRelative() + private void ThrowIfRelative () { if (_isRelative) - throw new ArgumentException("You are attempting an operation on a Path that requires an absolute path, but the path is relative"); + throw new ArgumentException ("You are attempting an operation on a Path that requires an absolute path, but the path is relative"); } - private void ThrowIfRoot() + private void ThrowIfRoot () { if (IsRoot) - throw new ArgumentException("You are attempting an operation that is not valid on a root level directory"); + throw new ArgumentException ("You are attempting an operation that is not valid on a root level directory"); } - public NPath EnsureDirectoryExists(string append = "") + public NPath EnsureDirectoryExists (string append = "") { - return EnsureDirectoryExists(new NPath(append)); + return EnsureDirectoryExists (new NPath (append)); } - public NPath EnsureDirectoryExists(NPath append) + public NPath EnsureDirectoryExists (NPath append) { - var combined = Combine(append); - if (combined.DirectoryExists()) + var combined = Combine (append); + if (combined.DirectoryExists ()) return combined; - combined.EnsureParentDirectoryExists(); - combined.CreateDirectory(); + combined.EnsureParentDirectoryExists (); + combined.CreateDirectory (); return combined; } - public NPath EnsureParentDirectoryExists() + public NPath EnsureParentDirectoryExists () { var parent = Parent; - parent.EnsureDirectoryExists(); + parent.EnsureDirectoryExists (); return parent; } - public NPath FileMustExist() + public NPath FileMustExist () { - if (!FileExists()) - throw new FileNotFoundException("File was expected to exist : " + ToString()); + if (!FileExists ()) + throw new FileNotFoundException ("File was expected to exist : " + ToString ()); return this; } - public NPath DirectoryMustExist() + public NPath DirectoryMustExist () { - if (!DirectoryExists()) - throw new DirectoryNotFoundException("Expected directory to exist : " + ToString()); + if (!DirectoryExists ()) + throw new DirectoryNotFoundException ("Expected directory to exist : " + ToString ()); return this; } - public bool IsChildOf(string potentialBasePath) + public bool IsChildOf (string potentialBasePath) { - return IsChildOf(new NPath(potentialBasePath)); + return IsChildOf (new NPath (potentialBasePath)); } - public bool IsChildOf(NPath potentialBasePath) + public bool IsChildOf (NPath potentialBasePath) { if ((IsRelative && !potentialBasePath.IsRelative) || !IsRelative && potentialBasePath.IsRelative) - throw new ArgumentException("You can only call IsChildOf with two relative paths, or with two absolute paths"); + throw new ArgumentException ("You can only call IsChildOf with two relative paths, or with two absolute paths"); // If the other path is the root directory, then anything is a child of it as long as it's not a Windows path - if (potentialBasePath.IsRoot) - { + if (potentialBasePath.IsRoot) { if (_driveLetter != potentialBasePath._driveLetter) return false; return true; } - if (IsEmpty()) + if (IsEmpty ()) return false; - if (Equals(potentialBasePath)) + if (Equals (potentialBasePath)) return true; - return Parent.IsChildOf(potentialBasePath); + return Parent.IsChildOf (potentialBasePath); } - public IEnumerable<NPath> RecursiveParents - { - get - { + public IEnumerable<NPath> RecursiveParents { + get { var candidate = this; - while (true) - { - if (candidate.IsEmpty()) + while (true) { + if (candidate.IsEmpty ()) yield break; candidate = candidate.Parent; @@ -790,115 +744,115 @@ namespace Mono.Linker.Tests.Extensions } } - public NPath ParentContaining(string needle) + public NPath ParentContaining (string needle) { - return ParentContaining(new NPath(needle)); + return ParentContaining (new NPath (needle)); } - public NPath ParentContaining(NPath needle) + public NPath ParentContaining (NPath needle) { - ThrowIfRelative(); + ThrowIfRelative (); - return RecursiveParents.FirstOrDefault(p => p.Exists(needle)); + return RecursiveParents.FirstOrDefault (p => p.Exists (needle)); } - public NPath WriteAllText(string contents) + public NPath WriteAllText (string contents) { - ThrowIfRelative(); - EnsureParentDirectoryExists(); - File.WriteAllText(ToString(), contents); + ThrowIfRelative (); + EnsureParentDirectoryExists (); + File.WriteAllText (ToString (), contents); return this; } - public string ReadAllText() + public string ReadAllText () { - ThrowIfRelative(); - return File.ReadAllText(ToString()); + ThrowIfRelative (); + return File.ReadAllText (ToString ()); } - public NPath WriteAllLines(string[] contents) + public NPath WriteAllLines (string[] contents) { - ThrowIfRelative(); - EnsureParentDirectoryExists(); - File.WriteAllLines(ToString(), contents); + ThrowIfRelative (); + EnsureParentDirectoryExists (); + File.WriteAllLines (ToString (), contents); return this; } - public string[] ReadAllLines() + public string[] ReadAllLines () { - ThrowIfRelative(); - return File.ReadAllLines(ToString()); + ThrowIfRelative (); + return File.ReadAllLines (ToString ()); } - public IEnumerable<NPath> CopyFiles(NPath destination, bool recurse, Func<NPath, bool> fileFilter = null) + public IEnumerable<NPath> CopyFiles (NPath destination, bool recurse, Func<NPath, bool> fileFilter = null) { - destination.EnsureDirectoryExists(); - return Files(recurse).Where(fileFilter ?? AlwaysTrue).Select(file => file.Copy(destination.Combine(file.RelativeTo(this)))).ToArray(); + destination.EnsureDirectoryExists (); + return Files (recurse).Where (fileFilter ?? AlwaysTrue).Select (file => file.Copy (destination.Combine (file.RelativeTo (this)))).ToArray (); } - public IEnumerable<NPath> MoveFiles(NPath destination, bool recurse, Func<NPath, bool> fileFilter = null) + public IEnumerable<NPath> MoveFiles (NPath destination, bool recurse, Func<NPath, bool> fileFilter = null) { if (IsRoot) - throw new NotSupportedException("MoveFiles is not supported on this directory because it would be dangerous:" + ToString()); + throw new NotSupportedException ("MoveFiles is not supported on this directory because it would be dangerous:" + ToString ()); - destination.EnsureDirectoryExists(); - return Files(recurse).Where(fileFilter ?? AlwaysTrue).Select(file => file.Move(destination.Combine(file.RelativeTo(this)))).ToArray(); + destination.EnsureDirectoryExists (); + return Files (recurse).Where (fileFilter ?? AlwaysTrue).Select (file => file.Move (destination.Combine (file.RelativeTo (this)))).ToArray (); } - static bool AlwaysTrue(NPath p) + static bool AlwaysTrue (NPath p) { return true; } - private static bool IsLinux() + private static bool IsLinux () { - return Directory.Exists("/proc"); + return Directory.Exists ("/proc"); } } public static class Extensions { - public static IEnumerable<NPath> Copy(this IEnumerable<NPath> self, string dest) + public static IEnumerable<NPath> Copy (this IEnumerable<NPath> self, string dest) { - return Copy(self, new NPath(dest)); + return Copy (self, new NPath (dest)); } - public static IEnumerable<NPath> Copy(this IEnumerable<NPath> self, NPath dest) + public static IEnumerable<NPath> Copy (this IEnumerable<NPath> self, NPath dest) { if (dest.IsRelative) - throw new ArgumentException("When copying multiple files, the destination cannot be a relative path"); - dest.EnsureDirectoryExists(); - return self.Select(p => p.Copy(dest.Combine(p.FileName))).ToArray(); + throw new ArgumentException ("When copying multiple files, the destination cannot be a relative path"); + dest.EnsureDirectoryExists (); + return self.Select (p => p.Copy (dest.Combine (p.FileName))).ToArray (); } - public static IEnumerable<NPath> Move(this IEnumerable<NPath> self, string dest) + public static IEnumerable<NPath> Move (this IEnumerable<NPath> self, string dest) { - return Move(self, new NPath(dest)); + return Move (self, new NPath (dest)); } - public static IEnumerable<NPath> Move(this IEnumerable<NPath> self, NPath dest) + public static IEnumerable<NPath> Move (this IEnumerable<NPath> self, NPath dest) { if (dest.IsRelative) - throw new ArgumentException("When moving multiple files, the destination cannot be a relative path"); - dest.EnsureDirectoryExists(); - return self.Select(p => p.Move(dest.Combine(p.FileName))).ToArray(); + throw new ArgumentException ("When moving multiple files, the destination cannot be a relative path"); + dest.EnsureDirectoryExists (); + return self.Select (p => p.Move (dest.Combine (p.FileName))).ToArray (); } - public static IEnumerable<NPath> Delete(this IEnumerable<NPath> self) + public static IEnumerable<NPath> Delete (this IEnumerable<NPath> self) { foreach (var p in self) - p.Delete(); + p.Delete (); return self; } - public static IEnumerable<string> InQuotes(this IEnumerable<NPath> self, SlashMode forward = SlashMode.Native) + public static IEnumerable<string> InQuotes (this IEnumerable<NPath> self, SlashMode forward = SlashMode.Native) { - return self.Select(p => p.InQuotes(forward)); + return self.Select (p => p.InQuotes (forward)); } - public static NPath ToNPath(this string path) + public static NPath ToNPath (this string path) { - return new NPath(path); + return new NPath (path); } } diff --git a/test/Mono.Linker.Tests/TestCases/IndividualTests.cs b/test/Mono.Linker.Tests/TestCases/IndividualTests.cs index 44e1a6e9b..0086c66c0 100644 --- a/test/Mono.Linker.Tests/TestCases/IndividualTests.cs +++ b/test/Mono.Linker.Tests/TestCases/IndividualTests.cs @@ -20,7 +20,7 @@ namespace Mono.Linker.Tests.TestCases public class IndividualTests { private NPath TestsDirectory => TestDatabase.TestCasesRootDirectory.Parent.Combine ("Mono.Linker.Tests"); - + [Test] public void CanSkipUnresolved () { @@ -46,11 +46,11 @@ namespace Mono.Linker.Tests.TestCases var jsonSerializer = new DataContractJsonSerializer (typeof (List<PInvokeInfo>)); - using (var fsActual = File.Open(outputPath, FileMode.Open)) + using (var fsActual = File.Open (outputPath, FileMode.Open)) using (var fsExpected = File.Open (TestsDirectory.Combine ("TestCases/Dependencies/PInvokesExpectations.json"), FileMode.Open)) { var actual = jsonSerializer.ReadObject (fsActual) as List<PInvokeInfo>; var expected = jsonSerializer.ReadObject (fsExpected) as List<PInvokeInfo>; - foreach (var pinvokePair in Enumerable.Zip(actual, expected, (fst, snd) => Tuple.Create(fst, snd))) { + foreach (var pinvokePair in Enumerable.Zip (actual, expected, (fst, snd) => Tuple.Create (fst, snd))) { Assert.That (pinvokePair.Item1.CompareTo (pinvokePair.Item2), Is.EqualTo (0)); } } @@ -75,7 +75,7 @@ namespace Mono.Linker.Tests.TestCases var outputPath = result.OutputAssemblyPath.Parent.Combine ("linker-dependencies.xml"); if (!outputPath.Exists ()) - Assert.Fail($"The dependency dump file is missing. Expected it to exist at {outputPath}"); + Assert.Fail ($"The dependency dump file is missing. Expected it to exist at {outputPath}"); // Do a basic check to verify that the contents of the file are uncompressed xml using (var reader = new XmlTextReader (outputPath.ToString ())) { @@ -96,7 +96,7 @@ namespace Mono.Linker.Tests.TestCases const string expectedDependenciesFileName = "linker-dependencies.xml"; var outputPath = result.OutputAssemblyPath.Parent.Combine (expectedDependenciesFileName); if (!outputPath.Exists ()) - Assert.Fail($"The dependency dump file is missing. Expected it to exist at {outputPath}"); + Assert.Fail ($"The dependency dump file is missing. Expected it to exist at {outputPath}"); // Let's go a little bit further and make sure it looks like reducing tracking actually worked. // This is intentionally a loose assertion. This test isn't meant to verify how reduced tracing works, @@ -111,7 +111,7 @@ namespace Mono.Linker.Tests.TestCases } [Test] - public void DeterministicMvidWorks() + public void DeterministicMvidWorks () { var testCase = CreateIndividualCase (typeof (DeterministicMvidWorks)); var result = Run (testCase, out TestRunner runner); @@ -119,10 +119,10 @@ namespace Mono.Linker.Tests.TestCases var originalMvid = GetMvid (result.InputAssemblyPath); var firstOutputMvid = GetMvid (result.OutputAssemblyPath); Assert.That (firstOutputMvid, Is.Not.EqualTo (originalMvid)); - - var result2 = runner.Relink(result); - - var secondOutputMvid = GetMvid(result2.OutputAssemblyPath); + + var result2 = runner.Relink (result); + + var secondOutputMvid = GetMvid (result2.OutputAssemblyPath); Assert.That (secondOutputMvid, Is.Not.EqualTo (originalMvid)); // The id should match the first output since we relinked the same assembly Assert.That (secondOutputMvid, Is.EqualTo (firstOutputMvid)); @@ -137,9 +137,9 @@ namespace Mono.Linker.Tests.TestCases var originalMvid = GetMvid (result.InputAssemblyPath); var firstOutputMvid = GetMvid (result.OutputAssemblyPath); Assert.That (firstOutputMvid, Is.Not.EqualTo (originalMvid)); - + var result2 = runner.Relink (result); - + var secondOutputMvid = GetMvid (result2.OutputAssemblyPath); Assert.That (secondOutputMvid, Is.Not.EqualTo (originalMvid)); Assert.That (secondOutputMvid, Is.Not.EqualTo (firstOutputMvid)); @@ -154,9 +154,9 @@ namespace Mono.Linker.Tests.TestCases var originalMvid = GetMvid (result.InputAssemblyPath); var firstOutputMvid = GetMvid (result.OutputAssemblyPath); Assert.That (firstOutputMvid, Is.EqualTo (originalMvid)); - + var result2 = runner.Relink (result); - + var secondOutputMvid = GetMvid (result2.OutputAssemblyPath); Assert.That (secondOutputMvid, Is.EqualTo (originalMvid)); Assert.That (secondOutputMvid, Is.EqualTo (firstOutputMvid)); @@ -171,9 +171,9 @@ namespace Mono.Linker.Tests.TestCases var originalMvid = GetMvid (result.InputAssemblyPath); var firstOutputMvid = GetMvid (result.OutputAssemblyPath); Assert.That (firstOutputMvid, Is.Not.EqualTo (originalMvid)); - + var result2 = runner.Relink (result); - + var secondOutputMvid = GetMvid (result2.OutputAssemblyPath); Assert.That (secondOutputMvid, Is.Not.EqualTo (originalMvid)); Assert.That (secondOutputMvid, Is.Not.EqualTo (firstOutputMvid)); @@ -195,7 +195,7 @@ namespace Mono.Linker.Tests.TestCases { return Run (testCase, out _); } - + protected virtual LinkedTestCaseResult Run (TestCase testCase, out TestRunner runner) { runner = new TestRunner (new ObjectFactory ()); diff --git a/test/Mono.Linker.Tests/TestCases/TestCase.cs b/test/Mono.Linker.Tests/TestCases/TestCase.cs index 790e41102..5507c137d 100644 --- a/test/Mono.Linker.Tests/TestCases/TestCase.cs +++ b/test/Mono.Linker.Tests/TestCases/TestCase.cs @@ -1,9 +1,11 @@ -using System; +using System; using System.Linq; using Mono.Linker.Tests.Extensions; -namespace Mono.Linker.Tests.TestCases { - public class TestCase { +namespace Mono.Linker.Tests.TestCases +{ + public class TestCase + { public TestCase (NPath sourceFile, NPath rootCasesDirectory, NPath originalTestCaseAssemblyPath) { SourceFile = sourceFile; @@ -34,8 +36,7 @@ namespace Mono.Linker.Tests.TestCases { } public NPath LinkXmlFile { - get - { + get { if (!HasLinkXmlFile) throw new InvalidOperationException ("This test case does not have a link xml file"); diff --git a/test/Mono.Linker.Tests/TestCases/TestDatabase.cs b/test/Mono.Linker.Tests/TestCases/TestDatabase.cs index 798741f76..488ffdf8b 100644 --- a/test/Mono.Linker.Tests/TestCases/TestDatabase.cs +++ b/test/Mono.Linker.Tests/TestCases/TestDatabase.cs @@ -11,50 +11,50 @@ namespace Mono.Linker.Tests.TestCases public static class TestDatabase { private static TestCase[] _cachedAllCases; - - public static IEnumerable<TestCaseData> XmlTests() + + public static IEnumerable<TestCaseData> XmlTests () { - return NUnitCasesBySuiteName("LinkXml"); + return NUnitCasesBySuiteName ("LinkXml"); } - public static IEnumerable<TestCaseData> BasicTests() + public static IEnumerable<TestCaseData> BasicTests () { - return NUnitCasesBySuiteName("Basic"); + return NUnitCasesBySuiteName ("Basic"); } - public static IEnumerable<TestCaseData> AttributeTests() + public static IEnumerable<TestCaseData> AttributeTests () { - return NUnitCasesBySuiteName("Attributes"); + return NUnitCasesBySuiteName ("Attributes"); } - + public static IEnumerable<TestCaseData> AttributeDebuggerTests () { return NUnitCasesBySuiteName ("Attributes.Debugger"); } - public static IEnumerable<TestCaseData> GenericsTests() + public static IEnumerable<TestCaseData> GenericsTests () { - return NUnitCasesBySuiteName("Generics"); + return NUnitCasesBySuiteName ("Generics"); } - public static IEnumerable<TestCaseData> CoreLinkTests() + public static IEnumerable<TestCaseData> CoreLinkTests () { - return NUnitCasesBySuiteName("CoreLink"); + return NUnitCasesBySuiteName ("CoreLink"); } - public static IEnumerable<TestCaseData> StaticsTests() + public static IEnumerable<TestCaseData> StaticsTests () { - return NUnitCasesBySuiteName("Statics"); + return NUnitCasesBySuiteName ("Statics"); } - public static IEnumerable<TestCaseData> InteropTests() + public static IEnumerable<TestCaseData> InteropTests () { - return NUnitCasesBySuiteName("Interop"); + return NUnitCasesBySuiteName ("Interop"); } - public static IEnumerable<TestCaseData> ReferencesTests() + public static IEnumerable<TestCaseData> ReferencesTests () { - return NUnitCasesBySuiteName("References"); + return NUnitCasesBySuiteName ("References"); } public static IEnumerable<TestCaseData> ResourcesTests () @@ -86,12 +86,12 @@ namespace Mono.Linker.Tests.TestCases { return NUnitCasesBySuiteName ("Symbols"); } - + public static IEnumerable<TestCaseData> PreserveDependenciesTests () { return NUnitCasesBySuiteName ("PreserveDependencies"); } - + public static IEnumerable<TestCaseData> LibrariesTests () { return NUnitCasesBySuiteName ("Libraries"); @@ -101,22 +101,22 @@ namespace Mono.Linker.Tests.TestCases { return NUnitCasesBySuiteName ("Advanced"); } - + public static IEnumerable<TestCaseData> InheritanceInterfaceTests () { return NUnitCasesBySuiteName ("Inheritance.Interfaces"); } - + public static IEnumerable<TestCaseData> InheritanceAbstractClassTests () { return NUnitCasesBySuiteName ("Inheritance.AbstractClasses"); } - + public static IEnumerable<TestCaseData> InheritanceVirtualMethodsTests () { return NUnitCasesBySuiteName ("Inheritance.VirtualMethods"); } - + public static IEnumerable<TestCaseData> InheritanceComplexTests () { return NUnitCasesBySuiteName ("Inheritance.Complex"); @@ -131,7 +131,7 @@ namespace Mono.Linker.Tests.TestCases { return NUnitCasesBySuiteName ("CommandLine"); } - + public static IEnumerable<TestCaseData> UnreachableBodyTests () { return NUnitCasesBySuiteName ("UnreachableBody"); @@ -163,9 +163,9 @@ namespace Mono.Linker.Tests.TestCases } - public static IEnumerable<TestCaseData> DataFlowTests() + public static IEnumerable<TestCaseData> DataFlowTests () { - return NUnitCasesBySuiteName("DataFlow"); + return NUnitCasesBySuiteName ("DataFlow"); } public static IEnumerable<TestCaseData> LoggingTests () @@ -202,22 +202,22 @@ namespace Mono.Linker.Tests.TestCases return _cachedAllCases; } - static IEnumerable<TestCaseData> NUnitCasesBySuiteName(string suiteName) + static IEnumerable<TestCaseData> NUnitCasesBySuiteName (string suiteName) { - return AllCases() - .Where(c => c.TestSuiteDirectory.FileName == suiteName) - .Select(c => CreateNUnitTestCase(c, c.DisplayName.Substring(suiteName.Length + 1))) - .OrderBy(c => c.TestName); + return AllCases () + .Where (c => c.TestSuiteDirectory.FileName == suiteName) + .Select (c => CreateNUnitTestCase (c, c.DisplayName.Substring (suiteName.Length + 1))) + .OrderBy (c => c.TestName); } - static TestCaseData CreateNUnitTestCase(TestCase testCase, string displayName) + static TestCaseData CreateNUnitTestCase (TestCase testCase, string displayName) { - var data = new TestCaseData(testCase); - data.SetName(displayName); + var data = new TestCaseData (testCase); + data.SetName (displayName); return data; } - static void GetDirectoryPaths(out string rootSourceDirectory, out string testCaseAssemblyPath, [CallerFilePath] string thisFile = null) + static void GetDirectoryPaths (out string rootSourceDirectory, out string testCaseAssemblyPath, [CallerFilePath] string thisFile = null) { #if DEBUG diff --git a/test/Mono.Linker.Tests/TestCases/TestSuites.cs b/test/Mono.Linker.Tests/TestCases/TestSuites.cs index 765038c24..f50995fa8 100644 --- a/test/Mono.Linker.Tests/TestCases/TestSuites.cs +++ b/test/Mono.Linker.Tests/TestCases/TestSuites.cs @@ -30,7 +30,7 @@ namespace Mono.Linker.Tests.TestCases { Run (testCase); } - + [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.AttributeDebuggerTests))] public void AttributesDebuggerTests (TestCase testCase) { @@ -61,10 +61,10 @@ namespace Mono.Linker.Tests.TestCases Run (testCase); } - [TestCaseSource(typeof(TestDatabase), nameof(TestDatabase.ReferencesTests))] - public void ReferencesTests(TestCase testCase) + [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.ReferencesTests))] + public void ReferencesTests (TestCase testCase) { - Run(testCase); + Run (testCase); } [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.ResourcesTests))] @@ -85,7 +85,7 @@ namespace Mono.Linker.Tests.TestCases Run (testCase); } - [TestCaseSource(typeof (TestDatabase), nameof (TestDatabase.TestFrameworkTests))] + [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.TestFrameworkTests))] public void TestFrameworkTests (TestCase testCase) { Run (testCase); @@ -108,37 +108,37 @@ namespace Mono.Linker.Tests.TestCases { Run (testCase); } - + [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.SymbolsTests))] public void SymbolsTests (TestCase testCase) { Run (testCase); } - + [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.LibrariesTests))] public void LibrariesTests (TestCase testCase) { Run (testCase); } - + [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.InheritanceInterfaceTests))] public void InheritanceInterfaceTests (TestCase testCase) { Run (testCase); } - + [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.InheritanceAbstractClassTests))] public void InheritanceAbstractClassTests (TestCase testCase) { Run (testCase); } - + [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.InheritanceVirtualMethodsTests))] public void InheritanceVirtualMethodsTests (TestCase testCase) { Run (testCase); } - + [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.InheritanceComplexTests))] public void InheritanceComplexTests (TestCase testCase) { @@ -161,7 +161,7 @@ namespace Mono.Linker.Tests.TestCases public void CodegenAnnotationTests (TestCase testCase) { if (Environment.OSVersion.Platform == PlatformID.Win32NT) - Assert.Ignore("These tests are not valid when linking against .NET Framework"); + Assert.Ignore ("These tests are not valid when linking against .NET Framework"); #if NETCOREAPP Assert.Ignore("These tests are not valid when linking against .NET Core"); diff --git a/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs b/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs index 887456b87..dea8f7dd6 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs @@ -8,13 +8,15 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Extensions; using NUnit.Framework; -namespace Mono.Linker.Tests.TestCasesRunner { - public class AssemblyChecker { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class AssemblyChecker + { readonly AssemblyDefinition originalAssembly, linkedAssembly; HashSet<string> linkedMembers; readonly HashSet<string> verifiedGeneratedFields = new HashSet<string> (); - readonly HashSet<string> verifiedEventMethods = new HashSet<string>(); + readonly HashSet<string> verifiedEventMethods = new HashSet<string> (); readonly HashSet<string> verifiedGeneratedTypes = new HashSet<string> (); public AssemblyChecker (AssemblyDefinition original, AssemblyDefinition linked) @@ -75,7 +77,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { { if (linked != null && verifiedGeneratedTypes.Contains (linked.FullName)) return; - + ModuleDefinition linkedModule = linked?.Module; // @@ -100,7 +102,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (original.HasAttribute (nameof (CreatedMemberAttribute))) { foreach (var attr in original.CustomAttributes.Where (l => l.AttributeType.Name == nameof (CreatedMemberAttribute))) { - var newName = original.FullName + "::" + attr.ConstructorArguments [0].Value.ToString (); + var newName = original.FullName + "::" + attr.ConstructorArguments[0].Value.ToString (); Assert.AreEqual (1, linkedMembers.RemoveWhere (l => l.Contains (newName)), $"Newly created member '{newName}' was not found"); } @@ -178,9 +180,9 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (expectedInterfaces.Count == 0) { Assert.IsFalse (linked.HasInterfaces, $"Type `{src}' has unexpected interfaces"); } else { - foreach (var iface in linked.Interfaces) { - if (!expectedInterfaces.Remove(iface.InterfaceType.FullName)) { - Assert.IsTrue (expectedInterfaces.Remove (iface.InterfaceType.Resolve().FullName), $"Type `{src}' interface `{iface.InterfaceType.Resolve().FullName}' should have been removed"); + foreach (var iface in linked.Interfaces) { + if (!expectedInterfaces.Remove (iface.InterfaceType.FullName)) { + Assert.IsTrue (expectedInterfaces.Remove (iface.InterfaceType.Resolve ().FullName), $"Type `{src}' interface `{iface.InterfaceType.Resolve ().FullName}' should have been removed"); } } @@ -191,19 +193,19 @@ namespace Mono.Linker.Tests.TestCasesRunner { static string FormatBaseOrInterfaceAttributeValue (CustomAttribute attr) { if (attr.ConstructorArguments.Count == 1) - return attr.ConstructorArguments [0].Value.ToString (); - + return attr.ConstructorArguments[0].Value.ToString (); + StringBuilder builder = new StringBuilder (); - builder.Append (attr.ConstructorArguments [0].Value); + builder.Append (attr.ConstructorArguments[0].Value); builder.Append ("<"); bool separator = false; - foreach (var caa in (CustomAttributeArgument [])attr.ConstructorArguments [1].Value) { + foreach (var caa in (CustomAttributeArgument[]) attr.ConstructorArguments[1].Value) { if (separator) builder.Append (","); else separator = true; - var arg = (CustomAttributeArgument)caa.Value; + var arg = (CustomAttributeArgument) caa.Value; builder.Append (arg.Value); } @@ -315,7 +317,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (keptBackingFieldAttribute == null) return; - var backingFieldName = src.MetadataToken.TokenType == TokenType.Property + var backingFieldName = src.MetadataToken.TokenType == TokenType.Property ? $"<{src.Name}>k__BackingField" : src.Name; var srcField = src.DeclaringType.Fields.FirstOrDefault (f => f.Name == backingFieldName); @@ -344,7 +346,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { VerifyPseudoAttributes (src, linked); VerifyGenericParameters (src, linked); VerifyCustomAttributes (src, linked); - VerifyCustomAttributes(src.MethodReturnType, linked.MethodReturnType); + VerifyCustomAttributes (src.MethodReturnType, linked.MethodReturnType); VerifyParameters (src, linked); VerifySecurityAttributes (src, linked); VerifyArrayInitializers (src, linked); @@ -360,7 +362,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { VerifyInstructions (src, linked); VerifyLocals (src, linked); } - + protected static void VerifyInstructions (MethodDefinition src, MethodDefinition linked) { VerifyBodyProperties ( @@ -369,10 +371,10 @@ namespace Mono.Linker.Tests.TestCasesRunner { nameof (ExpectedInstructionSequenceAttribute), nameof (ExpectBodyModifiedAttribute), "instructions", - m => m.Body.Instructions.Select (ins => ins.OpCode.ToString ().ToLower()).ToArray (), + m => m.Body.Instructions.Select (ins => ins.OpCode.ToString ().ToLower ()).ToArray (), attr => GetStringArrayAttributeValue (attr).Select (v => v.ToLower ()).ToArray ()); } - + static void VerifyExceptionHandlers (MethodDefinition src, MethodDefinition linked) { VerifyBodyProperties ( @@ -399,8 +401,8 @@ namespace Mono.Linker.Tests.TestCasesRunner { protected static void VerifyBodyProperties (MethodDefinition src, MethodDefinition linked, string sequenceAttributeName, string expectModifiedAttributeName, string propertyDescription, - Func<MethodDefinition, string []> valueCollector, - Func<CustomAttribute, string []> getExpectFromSequenceAttribute) + Func<MethodDefinition, string[]> valueCollector, + Func<CustomAttribute, string[]> getExpectFromSequenceAttribute) { var expectedSequenceAttribute = src.CustomAttributes.FirstOrDefault (attr => attr.AttributeType.Name == sequenceAttributeName); var linkedValues = valueCollector (linked); @@ -412,13 +414,13 @@ namespace Mono.Linker.Tests.TestCasesRunner { Is.Not.EquivalentTo (srcValues), $"Expected method `{src} to have {propertyDescription} modified, however, the {propertyDescription} were the same as the original\n{FormattingUtils.FormatSequenceCompareFailureMessage (linkedValues, srcValues)}"); } else if (expectedSequenceAttribute != null) { - var expected = getExpectFromSequenceAttribute(expectedSequenceAttribute).ToArray(); - Assert.That( + var expected = getExpectFromSequenceAttribute (expectedSequenceAttribute).ToArray (); + Assert.That ( linkedValues, Is.EquivalentTo (expected), $"Expected method `{src} to have it's {propertyDescription} modified, however, the sequence of {propertyDescription} does not match the expected value\n{FormattingUtils.FormatSequenceCompareFailureMessage2 (linkedValues, expected, srcValues)}"); } else { - Assert.That( + Assert.That ( linkedValues, Is.EquivalentTo (srcValues), $"Expected method `{src} to have it's {propertyDescription} unchanged, however, the {propertyDescription} differ from the original\n{FormattingUtils.FormatSequenceCompareFailureMessage (linkedValues, srcValues)}"); @@ -455,7 +457,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { { if (fileNameOrAssemblyName.EndsWith (".dll") || fileNameOrAssemblyName.EndsWith (".exe") || fileNameOrAssemblyName.EndsWith (".winmd")) return System.IO.Path.GetFileNameWithoutExtension (fileNameOrAssemblyName); - + // It must already be just the assembly name return fileNameOrAssemblyName; } @@ -470,31 +472,31 @@ namespace Mono.Linker.Tests.TestCasesRunner { protected virtual void VerifyPseudoAttributes (MethodDefinition src, MethodDefinition linked) { - var expected = (MethodAttributes) GetExpectedPseudoAttributeValue(src, (uint) src.Attributes); + var expected = (MethodAttributes) GetExpectedPseudoAttributeValue (src, (uint) src.Attributes); Assert.AreEqual (expected, linked.Attributes, $"Method `{src}' pseudo attributes did not match expected"); } protected virtual void VerifyPseudoAttributes (TypeDefinition src, TypeDefinition linked) { - var expected = (TypeAttributes) GetExpectedPseudoAttributeValue(src, (uint) src.Attributes); + var expected = (TypeAttributes) GetExpectedPseudoAttributeValue (src, (uint) src.Attributes); Assert.AreEqual (expected, linked.Attributes, $"Type `{src}' pseudo attributes did not match expected"); } protected virtual void VerifyPseudoAttributes (FieldDefinition src, FieldDefinition linked) { - var expected = (FieldAttributes) GetExpectedPseudoAttributeValue(src, (uint) src.Attributes); + var expected = (FieldAttributes) GetExpectedPseudoAttributeValue (src, (uint) src.Attributes); Assert.AreEqual (expected, linked.Attributes, $"Field `{src}' pseudo attributes did not match expected"); } protected virtual void VerifyPseudoAttributes (PropertyDefinition src, PropertyDefinition linked) { - var expected = (PropertyAttributes) GetExpectedPseudoAttributeValue(src, (uint) src.Attributes); + var expected = (PropertyAttributes) GetExpectedPseudoAttributeValue (src, (uint) src.Attributes); Assert.AreEqual (expected, linked.Attributes, $"Property `{src}' pseudo attributes did not match expected"); } protected virtual void VerifyPseudoAttributes (EventDefinition src, EventDefinition linked) { - var expected = (EventAttributes) GetExpectedPseudoAttributeValue(src, (uint) src.Attributes); + var expected = (EventAttributes) GetExpectedPseudoAttributeValue (src, (uint) src.Attributes); Assert.AreEqual (expected, linked.Attributes, $"Event `{src}' pseudo attributes did not match expected"); } @@ -527,25 +529,25 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (expectedIndicies.Length == 0 && !expectKeptAll) return; - + if (!src.HasBody) Assert.Fail ($"`{nameof (KeptInitializerData)}` cannot be used on methods that don't have bodies"); var srcImplementationDetails = src.Module.Types.FirstOrDefault (t => string.IsNullOrEmpty (t.Namespace) && t.Name.StartsWith ("<PrivateImplementationDetails>")); - + if (srcImplementationDetails == null) Assert.Fail ("Could not locate <PrivateImplementationDetails> in the original assembly. Does your test use initializers?"); var linkedImplementationDetails = linked.Module.Types.FirstOrDefault (t => string.IsNullOrEmpty (t.Namespace) && t.Name.StartsWith ("<PrivateImplementationDetails>")); - + if (linkedImplementationDetails == null) Assert.Fail ("Could not locate <PrivateImplementationDetails> in the linked assembly"); - + var possibleInitializerFields = src.Body.Instructions .Where (ins => IsLdtokenOnPrivateImplementationDetails (srcImplementationDetails, ins)) - .Select (ins => ((FieldReference)ins.Operand).Resolve ()) + .Select (ins => ((FieldReference) ins.Operand).Resolve ()) .ToArray (); - + if (possibleInitializerFields.Length == 0) Assert.Fail ($"`{src}` does not make use of any initializers"); @@ -557,7 +559,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { } else { foreach (var index in expectedIndicies) { if (index < 0 || index > possibleInitializerFields.Length) - Assert.Fail($"Invalid expected index `{index}` in {src}. Value must be between 0 and {expectedIndicies.Length}"); + Assert.Fail ($"Invalid expected index `{index}` in {src}. Value must be between 0 and {expectedIndicies.Length}"); var srcField = possibleInitializerFields[index]; var linkedField = linkedImplementationDetails.Fields.FirstOrDefault (f => f.Name == srcField.Name); @@ -580,8 +582,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { static bool IsLdtokenOnPrivateImplementationDetails (TypeDefinition privateImplementationDetails, Instruction instruction) { - if (instruction.OpCode.Code == Code.Ldtoken && instruction.Operand is FieldReference field) - { + if (instruction.OpCode.Code == Code.Ldtoken && instruction.Operand is FieldReference field) { return field.DeclaringType.Resolve () == privateImplementationDetails; } @@ -597,14 +598,14 @@ namespace Mono.Linker.Tests.TestCasesRunner { // Some versions of csc name it `<fieldname>e__FixedBuffer0` // while mcs and other versions of csc name it `<fieldname>__FixedBuffer0` if (original is TypeDefinition srcDefinition && srcDefinition.Name.Contains ("__FixedBuffer")) { - var name = srcDefinition.Name.Substring (1, srcDefinition.Name.IndexOf('>') - 1); + var name = srcDefinition.Name.Substring (1, srcDefinition.Name.IndexOf ('>') - 1); var fixedField = srcDefinition.DeclaringType.Fields.FirstOrDefault (f => f.Name == name); if (fixedField == null) Assert.Fail ($"Could not locate original fixed field for {srcDefinition}"); foreach (var additionalExpectedAttributesFromFixedField in GetCustomAttributeCtorValues<object> (fixedField, nameof (KeptAttributeOnFixedBufferTypeAttribute))) yield return additionalExpectedAttributesFromFixedField.ToString (); - + } } @@ -617,22 +618,22 @@ namespace Mono.Linker.Tests.TestCasesRunner { { foreach (var attr in linked.CustomAttributes) { switch (attr.AttributeType.FullName) { - case "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute": - case "System.Runtime.CompilerServices.CompilerGeneratedAttribute": - continue; + case "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute": + case "System.Runtime.CompilerServices.CompilerGeneratedAttribute": + continue; - // When mcs is used to compile the test cases, backing fields end up with this attribute on them - case "System.Diagnostics.DebuggerBrowsableAttribute": - continue; + // When mcs is used to compile the test cases, backing fields end up with this attribute on them + case "System.Diagnostics.DebuggerBrowsableAttribute": + continue; - // When compiling with roslyn, assemblies get the DebuggableAttribute by default. - case "System.Diagnostics.DebuggableAttribute": - continue; + // When compiling with roslyn, assemblies get the DebuggableAttribute by default. + case "System.Diagnostics.DebuggableAttribute": + continue; - case "System.Runtime.CompilerServices.CompilationRelaxationsAttribute": - if (linked is AssemblyDefinition) - continue; - break; + case "System.Runtime.CompilerServices.CompilationRelaxationsAttribute": + if (linked is AssemblyDefinition) + continue; + break; } yield return attr.AttributeType.FullName; @@ -661,19 +662,19 @@ namespace Mono.Linker.Tests.TestCasesRunner { var linkedCompilerGeneratedBufferType = linked.NestedTypes.FirstOrDefault (t => t.Name == originalCompilerGeneratedBufferType.Name); if (linkedCompilerGeneratedBufferType == null) Assert.Fail ($"Missing expected type {originalCompilerGeneratedBufferType}"); - + // Have to verify the field before the type var originalElementField = originalCompilerGeneratedBufferType.Fields.FirstOrDefault (f => f.Name == "FixedElementField"); if (originalElementField == null) Assert.Fail ($"Could not locate original compiler generated FixedElementField on {originalCompilerGeneratedBufferType}"); - + var linkedField = linkedCompilerGeneratedBufferType?.Fields.FirstOrDefault (l => l.Name == originalElementField.Name); VerifyFieldKept (originalElementField, linkedField); verifiedGeneratedFields.Add (originalElementField.FullName); linkedMembers.Remove (originalElementField.FullName); - - VerifyTypeDefinitionKept(originalCompilerGeneratedBufferType, linkedCompilerGeneratedBufferType); - verifiedGeneratedTypes.Add(originalCompilerGeneratedBufferType.FullName); + + VerifyTypeDefinitionKept (originalCompilerGeneratedBufferType, linkedCompilerGeneratedBufferType); + verifiedGeneratedTypes.Add (originalCompilerGeneratedBufferType.FullName); } } @@ -703,7 +704,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (src.HasGenericParameters) { for (int i = 0; i < src.GenericParameters.Count; ++i) { // TODO: Verify constraints - VerifyCustomAttributes (src.GenericParameters [i], linked.GenericParameters [i]); + VerifyCustomAttributes (src.GenericParameters[i], linked.GenericParameters[i]); } } } @@ -713,7 +714,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { Assert.AreEqual (src.HasParameters, linked.HasParameters); if (src.HasParameters) { for (int i = 0; i < src.Parameters.Count; ++i) { - VerifyCustomAttributes (src.Parameters [i], linked.Parameters [i]); + VerifyCustomAttributes (src.Parameters[i], linked.Parameters[i]); } } } @@ -729,7 +730,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (member.HasAttribute (nameof (KeptAttribute))) return true; - ICustomAttributeProvider cap = (ICustomAttributeProvider)member.DeclaringType; + ICustomAttributeProvider cap = (ICustomAttributeProvider) member.DeclaringType; if (cap == null) return false; @@ -741,30 +742,30 @@ namespace Mono.Linker.Tests.TestCasesRunner { var removals = provider.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (RemovedPseudoAttributeAttribute)).ToArray (); var adds = provider.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (AddedPseudoAttributeAttribute)).ToArray (); - return removals.Aggregate (sourceValue, (accum, item) => accum & ~((uint) item.ConstructorArguments [0].Value)) | - adds.Aggregate ((uint)0, (acum, item) => acum | (uint) item.ConstructorArguments [0].Value); + return removals.Aggregate (sourceValue, (accum, item) => accum & ~((uint) item.ConstructorArguments[0].Value)) | + adds.Aggregate ((uint) 0, (acum, item) => acum | (uint) item.ConstructorArguments[0].Value); } protected static IEnumerable<T> GetCustomAttributeCtorValues<T> (ICustomAttributeProvider provider, string attributeName) where T : class { return provider.CustomAttributes. Where (w => w.AttributeType.Name == attributeName && w.Constructor.Parameters.Count == 1). - Select (l => l.ConstructorArguments [0].Value as T); + Select (l => l.ConstructorArguments[0].Value as T); } - + protected static IEnumerable<string> GetStringOrTypeArrayAttributeValue (CustomAttribute attribute) { - foreach (var arg in ((CustomAttributeArgument[]) attribute.ConstructorArguments [0].Value)) { + foreach (var arg in ((CustomAttributeArgument[]) attribute.ConstructorArguments[0].Value)) { if (arg.Value is TypeReference tRef) yield return tRef.ToString (); else yield return (string) arg.Value; } } - + protected static IEnumerable<string> GetStringArrayAttributeValue (CustomAttribute attribute) { - return ((CustomAttributeArgument[]) attribute.ConstructorArguments [0].Value)?.Select (arg => arg.Value.ToString ()); + return ((CustomAttributeArgument[]) attribute.ConstructorArguments[0].Value)?.Select (arg => arg.Value.ToString ()); } } } diff --git a/test/Mono.Linker.Tests/TestCasesRunner/CompilerOptions.cs b/test/Mono.Linker.Tests/TestCasesRunner/CompilerOptions.cs index 7e584e904..9a3666185 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/CompilerOptions.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/CompilerOptions.cs @@ -1,8 +1,10 @@ using System; using Mono.Linker.Tests.Extensions; -namespace Mono.Linker.Tests.TestCasesRunner { - public class CompilerOptions { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class CompilerOptions + { public NPath OutputPath; public NPath[] SourceFiles; public string[] Defines; diff --git a/test/Mono.Linker.Tests/TestCasesRunner/ExpectationsProvider.cs b/test/Mono.Linker.Tests/TestCasesRunner/ExpectationsProvider.cs index 8b3baf0e3..0e87979f4 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/ExpectationsProvider.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/ExpectationsProvider.cs @@ -1,14 +1,16 @@ using Mono.Cecil; using Mono.Linker.Tests.Cases.Expectations.Assertions; -namespace Mono.Linker.Tests.TestCasesRunner { - public static class ExpectationsProvider { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public static class ExpectationsProvider + { public static bool IsAssemblyAssertion (CustomAttribute attr) { return attr.AttributeType.Name == nameof (KeptAssemblyAttribute) || attr.AttributeType.Name == nameof (RemovedAssemblyAttribute); } - + public static bool IsSymbolAssertion (CustomAttribute attr) { return attr.AttributeType.Name == nameof (KeptSymbolsAttribute) || attr.AttributeType.Name == nameof (RemovedSymbolsAttribute); diff --git a/test/Mono.Linker.Tests/TestCasesRunner/FormattingUtils.cs b/test/Mono.Linker.Tests/TestCasesRunner/FormattingUtils.cs index 97c14abb2..c9372a543 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/FormattingUtils.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/FormattingUtils.cs @@ -2,8 +2,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace Mono.Linker.Tests.TestCasesRunner { - public static class FormattingUtils { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public static class FormattingUtils + { public static string FormatSequenceCompareFailureMessage (IEnumerable<string> actual, IEnumerable<string> expected) { var builder = new StringBuilder (); @@ -16,7 +18,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { builder.AppendLine ($"Actual/Linked (Total : {actual.Count ()})"); builder.AppendLine ("---------------"); // Format in a quoted array form for easier copying into a expected sequence attribute - builder.AppendLine (actual.Select(c => $"\"{c}\",").AggregateWithNewLine ()); + builder.AppendLine (actual.Select (c => $"\"{c}\",").AggregateWithNewLine ()); builder.AppendLine ("---------------"); return builder.ToString (); } @@ -28,21 +30,21 @@ namespace Mono.Linker.Tests.TestCasesRunner { builder.AppendLine ($"Expected (Total : {expected.Count ()})"); builder.AppendLine ("---------------"); // Format in a quoted array form for easier copying into a expected sequence attribute - builder.AppendLine (expected.Select(c => $"\"{c}\",").AggregateWithNewLine ()); + builder.AppendLine (expected.Select (c => $"\"{c}\",").AggregateWithNewLine ()); builder.AppendLine ("---------------"); builder.AppendLine ($"Actual/Linked (Total : {actual.Count ()})"); builder.AppendLine ("---------------"); // Format in a quoted array form for easier copying into a expected sequence attribute - builder.AppendLine (actual.Select(c => $"\"{c}\",").AggregateWithNewLine ()); + builder.AppendLine (actual.Select (c => $"\"{c}\",").AggregateWithNewLine ()); builder.AppendLine ("---------------"); - builder.AppendLine ($"Original (Total : {original.Count()})"); + builder.AppendLine ($"Original (Total : {original.Count ()})"); builder.AppendLine ("---------------"); // Format in a quoted array form for easier copying into a expected sequence attribute - builder.AppendLine (original.Select(c => $"\"{c}\",").AggregateWithNewLine ()); + builder.AppendLine (original.Select (c => $"\"{c}\",").AggregateWithNewLine ()); builder.AppendLine ("---------------"); return builder.ToString (); } - + private static string AggregateWithNewLine (this IEnumerable<string> elements) { return elements.AggregateWith (System.Environment.NewLine); diff --git a/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs b/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs index a35c10787..6d0080862 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs @@ -8,8 +8,10 @@ using System.Text; using Mono.Linker.Tests.Extensions; using NUnit.Framework; -namespace Mono.Linker.Tests.TestCasesRunner { - public class ILCompiler { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class ILCompiler + { private readonly string _ilasmExecutable; public ILCompiler () @@ -33,9 +35,8 @@ namespace Mono.Linker.Tests.TestCasesRunner { process.BeginOutputReadLine (); process.WaitForExit (); - if (process.ExitCode != 0) - { - Assert.Fail($"Failed to compile IL assembly : {options.OutputPath}\n{capturedOutput.Aggregate ((buff, s) => buff + Environment.NewLine + s)}"); + if (process.ExitCode != 0) { + Assert.Fail ($"Failed to compile IL assembly : {options.OutputPath}\n{capturedOutput.Aggregate ((buff, s) => buff + Environment.NewLine + s)}"); } return options.OutputPath; @@ -52,15 +53,15 @@ namespace Mono.Linker.Tests.TestCasesRunner { private string BuildArguments (CompilerOptions options) { - var args = new StringBuilder(); + var args = new StringBuilder (); #if ILLINK args.Append(options.OutputPath.ExtensionWithDot == ".dll" ? "-dll" : "-exe"); args.Append($" -out:{options.OutputPath.InQuotes ()}"); #else - args.Append(options.OutputPath.ExtensionWithDot == ".dll" ? "/dll" : "/exe"); - args.Append($" /out:{options.OutputPath.InQuotes ()}"); + args.Append (options.OutputPath.ExtensionWithDot == ".dll" ? "/dll" : "/exe"); + args.Append ($" /out:{options.OutputPath.InQuotes ()}"); #endif - args.Append($" {options.SourceFiles.Aggregate (string.Empty, (buff, file) => $"{buff} {file.InQuotes ()}")}"); + args.Append ($" {options.SourceFiles.Aggregate (string.Empty, (buff, file) => $"{buff} {file.InQuotes ()}")}"); return args.ToString (); } diff --git a/test/Mono.Linker.Tests/TestCasesRunner/LinkXmlHelpers.cs b/test/Mono.Linker.Tests/TestCasesRunner/LinkXmlHelpers.cs index c7e70cf71..27e7276e8 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/LinkXmlHelpers.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/LinkXmlHelpers.cs @@ -2,8 +2,10 @@ using Mono.Cecil; using Mono.Linker.Tests.Extensions; -namespace Mono.Linker.Tests.TestCasesRunner { - public static class LinkXmlHelpers { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public static class LinkXmlHelpers + { public static void WriteXmlFileToPreserveEntryPoint (NPath targetProgram, NPath xmlFile) { using (var assembly = AssemblyDefinition.ReadAssembly (targetProgram.ToString ())) { diff --git a/test/Mono.Linker.Tests/TestCasesRunner/LinkedTestCaseResult.cs b/test/Mono.Linker.Tests/TestCasesRunner/LinkedTestCaseResult.cs index 75436912f..1a1a1c1f0 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/LinkedTestCaseResult.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/LinkedTestCaseResult.cs @@ -1,8 +1,10 @@ using Mono.Linker.Tests.Extensions; using Mono.Linker.Tests.TestCases; -namespace Mono.Linker.Tests.TestCasesRunner { - public class LinkedTestCaseResult { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class LinkedTestCaseResult + { public readonly TestCase TestCase; public readonly NPath InputAssemblyPath; public readonly NPath OutputAssemblyPath; diff --git a/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs b/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs index 7cc6fbf3e..8a3d536bc 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs @@ -1,8 +1,10 @@ using System.Collections.Generic; using Mono.Linker.Tests.Extensions; -namespace Mono.Linker.Tests.TestCasesRunner { - public class LinkerArgumentBuilder { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class LinkerArgumentBuilder + { private readonly List<string> _arguments = new List<string> (); private readonly TestCaseMetadaProvider _metadaProvider; @@ -51,7 +53,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { Append ("-a"); Append (fileName); } - + public virtual void LinkFromPublicAndFamily (string fileName) { Append ("-r"); @@ -75,13 +77,13 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (bool.Parse (value)) Append ("-t"); } - + public virtual void AddLinkSymbols (string value) { Append ("-b"); Append (value); } - + public virtual void AddKeepDebugMembers (string value) { Append ("-v"); @@ -123,7 +125,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { Append (file); } - public string [] ToArgs () + public string[] ToArgs () { return _arguments.ToArray (); } @@ -133,7 +135,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { _arguments.Add (arg); } - public virtual void AddAdditionalArgument (string flag, string [] values) + public virtual void AddAdditionalArgument (string flag, string[] values) { Append (flag); if (values != null) { @@ -141,7 +143,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { Append (val); } } - + public virtual void ProcessTestInputAssembly (NPath inputAssemblyPath) { if (_metadaProvider.LinkPublicAndFamily ()) @@ -174,10 +176,10 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (!string.IsNullOrEmpty (options.KeepTypeForwarderOnlyAssemblies)) AddKeepTypeForwarderOnlyAssemblies (options.KeepTypeForwarderOnlyAssemblies); - + if (!string.IsNullOrEmpty (options.LinkSymbols)) AddLinkSymbols (options.LinkSymbols); - + if (!string.IsNullOrEmpty (options.KeepDebugMembers)) AddKeepDebugMembers (options.KeepDebugMembers); diff --git a/test/Mono.Linker.Tests/TestCasesRunner/LinkerCustomizations.cs b/test/Mono.Linker.Tests/TestCasesRunner/LinkerCustomizations.cs index bb599df7f..f1f69b963 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/LinkerCustomizations.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/LinkerCustomizations.cs @@ -14,7 +14,7 @@ namespace Mono.Linker.Tests.TestCasesRunner public event Action<LinkContext> CustomizeContext; - public void CustomizeLinkContext(LinkContext context) + public void CustomizeLinkContext (LinkContext context) { CustomizeContext?.Invoke (context); } diff --git a/test/Mono.Linker.Tests/TestCasesRunner/LinkerDriver.cs b/test/Mono.Linker.Tests/TestCasesRunner/LinkerDriver.cs index 16ba385f3..95f32d023 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/LinkerDriver.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/LinkerDriver.cs @@ -1,12 +1,14 @@ using System.Collections.Generic; -namespace Mono.Linker.Tests.TestCasesRunner { - public class LinkerDriver { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class LinkerDriver + { protected class TestDriver : Driver { readonly LinkerCustomizations _customization; - public TestDriver(Queue<string> args, LinkerCustomizations customizations) : base(args) + public TestDriver (Queue<string> args, LinkerCustomizations customizations) : base (args) { _customization = customizations; } @@ -19,7 +21,7 @@ } } - public virtual void Link (string [] args, LinkerCustomizations customizations, ILogger logger) + public virtual void Link (string[] args, LinkerCustomizations customizations, ILogger logger) { Driver.ProcessResponseFile (args, out var queue); using (var driver = new TestDriver (queue, customizations)) { diff --git a/test/Mono.Linker.Tests/TestCasesRunner/LinkerTestLogger.cs b/test/Mono.Linker.Tests/TestCasesRunner/LinkerTestLogger.cs index 2a0af7d53..0ae3ce65d 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/LinkerTestLogger.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/LinkerTestLogger.cs @@ -12,7 +12,7 @@ namespace Mono.Linker.Tests.TestCasesRunner public List<MessageRecord> Messages { get; private set; } = new List<MessageRecord> (); - public void LogMessage (MessageImportance importance, string message, params object [] values) + public void LogMessage (MessageImportance importance, string message, params object[] values) { Messages.Add (new MessageRecord { Importance = importance, diff --git a/test/Mono.Linker.Tests/TestCasesRunner/ManagedCompilationResult.cs b/test/Mono.Linker.Tests/TestCasesRunner/ManagedCompilationResult.cs index ccce993f9..be416afaa 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/ManagedCompilationResult.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/ManagedCompilationResult.cs @@ -1,7 +1,9 @@ using Mono.Linker.Tests.Extensions; -namespace Mono.Linker.Tests.TestCasesRunner { - public class ManagedCompilationResult { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class ManagedCompilationResult + { public ManagedCompilationResult (NPath inputAssemblyPath, NPath expectationsAssemblyPath) { InputAssemblyPath = inputAssemblyPath; diff --git a/test/Mono.Linker.Tests/TestCasesRunner/ObjectFactory.cs b/test/Mono.Linker.Tests/TestCasesRunner/ObjectFactory.cs index 71d1c3859..de964e183 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/ObjectFactory.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/ObjectFactory.cs @@ -1,8 +1,10 @@ -using Mono.Cecil; +using Mono.Cecil; using Mono.Linker.Tests.TestCases; -namespace Mono.Linker.Tests.TestCasesRunner { - public class ObjectFactory { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class ObjectFactory + { public virtual TestCaseSandbox CreateSandbox (TestCase testCase) { return new TestCaseSandbox (testCase); @@ -17,7 +19,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { { return new LinkerDriver (); } - + public virtual TestCaseMetadaProvider CreateMetadataProvider (TestCase testCase, AssemblyDefinition fullTestCaseAssemblyDefinition) { return new TestCaseMetadaProvider (testCase, fullTestCaseAssemblyDefinition); diff --git a/test/Mono.Linker.Tests/TestCasesRunner/PeVerifier.cs b/test/Mono.Linker.Tests/TestCasesRunner/PeVerifier.cs index fe980c78d..5482ea0eb 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/PeVerifier.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/PeVerifier.cs @@ -8,8 +8,10 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Extensions; using NUnit.Framework; -namespace Mono.Linker.Tests.TestCasesRunner { - public class PeVerifier { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class PeVerifier + { private readonly string _peExecutable; public PeVerifier () @@ -56,16 +58,15 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (!attr.HasConstructorArguments) { skipCheckEntirely = true; } else if (ctorArg.Type.Name == nameof (SkipPeVerifyForToolchian)) { - var skipToolchain = (SkipPeVerifyForToolchian)ctorArg.Value; + var skipToolchain = (SkipPeVerifyForToolchian) ctorArg.Value; if (skipToolchain == SkipPeVerifyForToolchian.Pedump) { if (Environment.OSVersion.Platform != PlatformID.Win32NT) skipCheckEntirely = true; - } - else + } else throw new ArgumentException ($"Unhandled platform and toolchain values of {Environment.OSVersion.Platform} and {skipToolchain}"); } else if (ctorArg.Type.Name == nameof (String)) { - assembliesToSkip.Add ((string)ctorArg.Value); + assembliesToSkip.Add ((string) ctorArg.Value); } else { throw new ArgumentException ($"Unhandled constructor argument type of {ctorArg.Type} on {nameof (SkipPeVerifyAttribute)}"); } @@ -98,7 +99,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; if (Environment.OSVersion.Platform != PlatformID.Win32NT) { - process.StartInfo.Environment ["MONO_PATH"] = assemblyPath.Parent.ToString (); + process.StartInfo.Environment["MONO_PATH"] = assemblyPath.Parent.ToString (); } } @@ -123,7 +124,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { foreach (var sdkKeyName in key.GetSubKeyNames ().OrderBy (name => new Version (name.TrimStart ('v').TrimEnd ('A'))).Reverse ()) { var sdkKey = Registry.LocalMachine.OpenSubKey ($"{keyPath}\\{sdkKeyName}"); - var sdkDir = (string)sdkKey.GetValue ("InstallationFolder"); + var sdkDir = (string) sdkKey.GetValue ("InstallationFolder"); if (string.IsNullOrEmpty (sdkDir)) continue; diff --git a/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs b/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs index 1c8165007..b4d7e953d 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -9,7 +9,8 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Extensions; using NUnit.Framework; -namespace Mono.Linker.Tests.TestCasesRunner { +namespace Mono.Linker.Tests.TestCasesRunner +{ public class ResultChecker { readonly BaseAssemblyResolver _originalsResolver; @@ -19,13 +20,11 @@ namespace Mono.Linker.Tests.TestCasesRunner { readonly PeVerifier _peVerifier; public ResultChecker () - : this(new TestCaseAssemblyResolver (), new TestCaseAssemblyResolver (), new PeVerifier (), - new ReaderParameters - { + : this (new TestCaseAssemblyResolver (), new TestCaseAssemblyResolver (), new PeVerifier (), + new ReaderParameters { SymbolReaderProvider = new DefaultSymbolReaderProvider (false) }, - new ReaderParameters - { + new ReaderParameters { SymbolReaderProvider = new DefaultSymbolReaderProvider (false) }) { @@ -47,8 +46,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { InitializeResolvers (linkResult); - try - { + try { var original = ResolveOriginalsAssembly (linkResult.ExpectationsAssemblyPath.FileNameWithoutExtension); var linked = ResolveLinkedAssembly (linkResult.OutputAssemblyPath.FileNameWithoutExtension); @@ -65,9 +63,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { VerifyLinkingOfOtherAssemblies (original); AdditionalChecking (linkResult, original, linked); - } - finally - { + } finally { _originalsResolver.Dispose (); _linkedResolver.Dispose (); } @@ -87,7 +83,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { protected AssemblyDefinition ResolveLinkedAssembly (string assemblyName) { var cleanAssemblyName = assemblyName; - if (assemblyName.EndsWith(".exe") || assemblyName.EndsWith(".dll")) + if (assemblyName.EndsWith (".exe") || assemblyName.EndsWith (".dll")) cleanAssemblyName = System.IO.Path.GetFileNameWithoutExtension (assemblyName); return _linkedResolver.Resolve (new AssemblyNameReference (cleanAssemblyName, null), _linkedReaderParameters); } @@ -102,7 +98,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { void PerformOutputAssemblyChecks (AssemblyDefinition original, NPath outputDirectory) { - var assembliesToCheck = original.MainModule.Types.SelectMany (t => t.CustomAttributes).Where (attr => ExpectationsProvider.IsAssemblyAssertion(attr)); + var assembliesToCheck = original.MainModule.Types.SelectMany (t => t.CustomAttributes).Where (attr => ExpectationsProvider.IsAssemblyAssertion (attr)); foreach (var assemblyAttr in assembliesToCheck) { var name = (string) assemblyAttr.ConstructorArguments.First ().Value; @@ -113,27 +109,27 @@ namespace Mono.Linker.Tests.TestCasesRunner { else if (assemblyAttr.AttributeType.Name == nameof (KeptAssemblyAttribute)) Assert.IsTrue (expectedPath.FileExists (), $"Expected the assembly {name} to exist in {outputDirectory}, but it did not"); else - throw new NotImplementedException($"Unknown assembly assertion of type {assemblyAttr.AttributeType}"); + throw new NotImplementedException ($"Unknown assembly assertion of type {assemblyAttr.AttributeType}"); } } void PerformOutputSymbolChecks (AssemblyDefinition original, NPath outputDirectory) { var symbolFilesToCheck = original.MainModule.Types.SelectMany (t => t.CustomAttributes).Where (ExpectationsProvider.IsSymbolAssertion); - + foreach (var symbolAttr in symbolFilesToCheck) { if (symbolAttr.AttributeType.Name == nameof (RemovedSymbolsAttribute)) VerifyRemovedSymbols (symbolAttr, outputDirectory); else if (symbolAttr.AttributeType.Name == nameof (KeptSymbolsAttribute)) VerifyKeptSymbols (symbolAttr); else - throw new NotImplementedException($"Unknown symbol file assertion of type {symbolAttr.AttributeType}"); + throw new NotImplementedException ($"Unknown symbol file assertion of type {symbolAttr.AttributeType}"); } } void VerifyKeptSymbols (CustomAttribute symbolsAttribute) { - var assemblyName = (string) symbolsAttribute.ConstructorArguments [0].Value; + var assemblyName = (string) symbolsAttribute.ConstructorArguments[0].Value; var originalAssembly = ResolveOriginalsAssembly (assemblyName); var linkedAssembly = ResolveLinkedAssembly (assemblyName); @@ -146,9 +142,8 @@ namespace Mono.Linker.Tests.TestCasesRunner { void VerifyRemovedSymbols (CustomAttribute symbolsAttribute, NPath outputDirectory) { - var assemblyName = (string) symbolsAttribute.ConstructorArguments [0].Value; - try - { + var assemblyName = (string) symbolsAttribute.ConstructorArguments[0].Value; + try { var linkedAssembly = ResolveLinkedAssembly (assemblyName); if (linkedAssembly.MainModule.SymbolReader != null) @@ -160,7 +155,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { var possibleSymbolFilePath = outputDirectory.Combine ($"{assemblyName}").ChangeExtension ("pdb"); if (possibleSymbolFilePath.Exists ()) Assert.Fail ($"Expected no symbols to be found for assembly `{assemblyName}`, however, a symbol file was found at {possibleSymbolFilePath}"); - + possibleSymbolFilePath = outputDirectory.Combine ($"{assemblyName}.mdb"); if (possibleSymbolFilePath.Exists ()) Assert.Fail ($"Expected no symbols to be found for assembly `{assemblyName}`, however, a symbol file was found at {possibleSymbolFilePath}"); @@ -169,7 +164,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { protected virtual void AdditionalChecking (LinkedTestCaseResult linkResult, AssemblyDefinition original, AssemblyDefinition linked) { - VerifyLoggedMessages(original, linkResult.Logger); + VerifyLoggedMessages (original, linkResult.Logger); VerifyRecordedDependencies (original, linkResult.Customizations.DependencyRecorder); VerifyRecordedReflectionPatterns (original, linkResult.Customizations.ReflectionPatternRecorder); } @@ -189,8 +184,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { try { foreach (var assemblyName in checks.Keys) { using (var linkedAssembly = ResolveLinkedAssembly (assemblyName)) { - foreach (var checkAttrInAssembly in checks [assemblyName]) - { + foreach (var checkAttrInAssembly in checks[assemblyName]) { var attributeTypeName = checkAttrInAssembly.AttributeType.Name; if (attributeTypeName == nameof (KeptAllTypesAndMembersInAssemblyAttribute)) { VerifyKeptAllTypesAndMembersInAssembly (linkedAssembly); @@ -207,7 +201,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { continue; } - var expectedTypeName = checkAttrInAssembly.ConstructorArguments [1].Value.ToString (); + var expectedTypeName = checkAttrInAssembly.ConstructorArguments[1].Value.ToString (); var linkedType = linkedAssembly.MainModule.GetType (expectedTypeName); if (linkedType == null && linkedAssembly.MainModule.HasExportedTypes) { @@ -287,19 +281,19 @@ namespace Mono.Linker.Tests.TestCasesRunner { void VerifyKeptAttributeInAssembly (CustomAttribute inAssemblyAttribute, AssemblyDefinition linkedAssembly) { - VerifyAttributeInAssembly(inAssemblyAttribute, linkedAssembly, VerifyCustomAttributeKept); + VerifyAttributeInAssembly (inAssemblyAttribute, linkedAssembly, VerifyCustomAttributeKept); } void VerifyRemovedAttributeInAssembly (CustomAttribute inAssemblyAttribute, AssemblyDefinition linkedAssembly) { VerifyAttributeInAssembly (inAssemblyAttribute, linkedAssembly, VerifyCustomAttributeRemoved); } - + void VerifyAttributeInAssembly (CustomAttribute inAssemblyAttribute, AssemblyDefinition linkedAssembly, Action<ICustomAttributeProvider, string> assertExpectedAttribute) { - var assemblyName = (string) inAssemblyAttribute.ConstructorArguments [0].Value; + var assemblyName = (string) inAssemblyAttribute.ConstructorArguments[0].Value; string expectedAttributeTypeName; - var attributeTypeOrTypeName = inAssemblyAttribute.ConstructorArguments [1].Value; + var attributeTypeOrTypeName = inAssemblyAttribute.ConstructorArguments[1].Value; if (attributeTypeOrTypeName is TypeReference typeReference) { expectedAttributeTypeName = typeReference.FullName; } else { @@ -313,7 +307,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { } // We are asserting on type or member - var typeOrTypeName = inAssemblyAttribute.ConstructorArguments [2].Value; + var typeOrTypeName = inAssemblyAttribute.ConstructorArguments[2].Value; var originalType = GetOriginalTypeFromInAssemblyAttribute (inAssemblyAttribute.ConstructorArguments[0].Value.ToString (), typeOrTypeName); if (originalType == null) Assert.Fail ($"Invalid test assertion. The original `{assemblyName}` does not contain a type `{typeOrTypeName}`"); @@ -328,7 +322,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { } // we are asserting on a member - string memberName = (string) inAssemblyAttribute.ConstructorArguments [3].Value; + string memberName = (string) inAssemblyAttribute.ConstructorArguments[3].Value; // We will find the matching type from the original assembly first that way we can confirm // that the name defined in the attribute corresponds to a member that actually existed @@ -337,7 +331,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { var linkedField = linkedType.Fields.FirstOrDefault (m => m.Name == memberName); if (linkedField == null) Assert.Fail ($"Field `{memberName}` on Type `{originalType}` should have been kept"); - + assertExpectedAttribute (linkedField, expectedAttributeTypeName); return; } @@ -347,7 +341,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { var linkedProperty = linkedType.Properties.FirstOrDefault (m => m.Name == memberName); if (linkedProperty == null) Assert.Fail ($"Property `{memberName}` on Type `{originalType}` should have been kept"); - + assertExpectedAttribute (linkedProperty, expectedAttributeTypeName); return; } @@ -371,7 +365,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (match == null) Assert.Fail ($"Expected `{provider}` to have an attribute of type `{expectedAttributeTypeName}`"); } - + void VerifyCustomAttributeRemoved (ICustomAttributeProvider provider, string expectedAttributeTypeName) { var match = provider.CustomAttributes.FirstOrDefault (attr => attr.AttributeType.FullName == expectedAttributeTypeName); @@ -383,8 +377,8 @@ namespace Mono.Linker.Tests.TestCasesRunner { { var originalType = GetOriginalTypeFromInAssemblyAttribute (inAssemblyAttribute); - var interfaceAssemblyName = inAssemblyAttribute.ConstructorArguments [2].Value.ToString (); - var interfaceType = inAssemblyAttribute.ConstructorArguments [3].Value; + var interfaceAssemblyName = inAssemblyAttribute.ConstructorArguments[2].Value.ToString (); + var interfaceType = inAssemblyAttribute.ConstructorArguments[3].Value; var originalInterface = GetOriginalTypeFromInAssemblyAttribute (interfaceAssemblyName, interfaceType); if (!originalType.HasInterfaces) @@ -403,8 +397,8 @@ namespace Mono.Linker.Tests.TestCasesRunner { { var originalType = GetOriginalTypeFromInAssemblyAttribute (inAssemblyAttribute); - var interfaceAssemblyName = inAssemblyAttribute.ConstructorArguments [2].Value.ToString (); - var interfaceType = inAssemblyAttribute.ConstructorArguments [3].Value; + var interfaceAssemblyName = inAssemblyAttribute.ConstructorArguments[2].Value.ToString (); + var interfaceType = inAssemblyAttribute.ConstructorArguments[3].Value; var originalInterface = GetOriginalTypeFromInAssemblyAttribute (interfaceAssemblyName, interfaceType); if (!originalType.HasInterfaces) @@ -422,9 +416,9 @@ namespace Mono.Linker.Tests.TestCasesRunner { void VerifyKeptBaseOnTypeInAssembly (CustomAttribute inAssemblyAttribute, TypeDefinition linkedType) { var originalType = GetOriginalTypeFromInAssemblyAttribute (inAssemblyAttribute); - - var baseAssemblyName = inAssemblyAttribute.ConstructorArguments [2].Value.ToString (); - var baseType = inAssemblyAttribute.ConstructorArguments [3].Value; + + var baseAssemblyName = inAssemblyAttribute.ConstructorArguments[2].Value.ToString (); + var baseType = inAssemblyAttribute.ConstructorArguments[3].Value; var originalBase = GetOriginalTypeFromInAssemblyAttribute (baseAssemblyName, baseType); if (originalType.BaseType.Resolve () != originalBase) @@ -436,8 +430,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { protected static InterfaceImplementation GetMatchingInterfaceImplementationOnType (TypeDefinition type, string expectedInterfaceTypeName) { - return type.Interfaces.FirstOrDefault (impl => - { + return type.Interfaces.FirstOrDefault (impl => { var resolvedImpl = impl.InterfaceType.Resolve (); if (resolvedImpl == null) @@ -450,7 +443,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { void VerifyRemovedMemberInAssembly (CustomAttribute inAssemblyAttribute, TypeDefinition linkedType) { var originalType = GetOriginalTypeFromInAssemblyAttribute (inAssemblyAttribute); - foreach (var memberNameAttr in (CustomAttributeArgument[]) inAssemblyAttribute.ConstructorArguments [2].Value) { + foreach (var memberNameAttr in (CustomAttributeArgument[]) inAssemblyAttribute.ConstructorArguments[2].Value) { string memberName = (string) memberNameAttr.Value; // We will find the matching type from the original assembly first that way we can confirm @@ -489,7 +482,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { void VerifyKeptMemberInAssembly (CustomAttribute inAssemblyAttribute, TypeDefinition linkedType) { var originalType = GetOriginalTypeFromInAssemblyAttribute (inAssemblyAttribute); - foreach (var memberNameAttr in (CustomAttributeArgument[]) inAssemblyAttribute.ConstructorArguments [2].Value) { + foreach (var memberNameAttr in (CustomAttributeArgument[]) inAssemblyAttribute.ConstructorArguments[2].Value) { string memberName = (string) memberNameAttr.Value; // We will find the matching type from the original assembly first that way we can confirm @@ -538,9 +531,9 @@ namespace Mono.Linker.Tests.TestCasesRunner { protected virtual bool TryVerifyKeptMemberInAssemblyAsMethod (string memberName, TypeDefinition originalType, TypeDefinition linkedType) { - var originalMethodMember = originalType.Methods.FirstOrDefault (m => m.GetSignature() == memberName); + var originalMethodMember = originalType.Methods.FirstOrDefault (m => m.GetSignature () == memberName); if (originalMethodMember != null) { - var linkedMethod = linkedType.Methods.FirstOrDefault (m => m.GetSignature() == memberName); + var linkedMethod = linkedType.Methods.FirstOrDefault (m => m.GetSignature () == memberName); if (linkedMethod == null) Assert.Fail ($"Method `{memberName}` on Type `{originalType}` should have been kept"); @@ -552,23 +545,23 @@ namespace Mono.Linker.Tests.TestCasesRunner { void VerifyKeptReferencesInAssembly (CustomAttribute inAssemblyAttribute) { - var assembly = ResolveLinkedAssembly (inAssemblyAttribute.ConstructorArguments [0].Value.ToString ()); - var expectedReferenceNames = ((CustomAttributeArgument []) inAssemblyAttribute.ConstructorArguments [1].Value).Select (attr => (string) attr.Value); + var assembly = ResolveLinkedAssembly (inAssemblyAttribute.ConstructorArguments[0].Value.ToString ()); + var expectedReferenceNames = ((CustomAttributeArgument[]) inAssemblyAttribute.ConstructorArguments[1].Value).Select (attr => (string) attr.Value); Assert.That (assembly.MainModule.AssemblyReferences.Select (asm => asm.Name), Is.EquivalentTo (expectedReferenceNames)); } void VerifyKeptResourceInAssembly (CustomAttribute inAssemblyAttribute) { - var assembly = ResolveLinkedAssembly (inAssemblyAttribute.ConstructorArguments [0].Value.ToString ()); - var resourceName = inAssemblyAttribute.ConstructorArguments [1].Value.ToString (); + var assembly = ResolveLinkedAssembly (inAssemblyAttribute.ConstructorArguments[0].Value.ToString ()); + var resourceName = inAssemblyAttribute.ConstructorArguments[1].Value.ToString (); Assert.That (assembly.MainModule.Resources.Select (r => r.Name), Has.Member (resourceName)); } void VerifyRemovedResourceInAssembly (CustomAttribute inAssemblyAttribute) { - var assembly = ResolveLinkedAssembly (inAssemblyAttribute.ConstructorArguments [0].Value.ToString ()); - var resourceName = inAssemblyAttribute.ConstructorArguments [1].Value.ToString (); + var assembly = ResolveLinkedAssembly (inAssemblyAttribute.ConstructorArguments[0].Value.ToString ()); + var resourceName = inAssemblyAttribute.ConstructorArguments[1].Value.ToString (); Assert.That (assembly.MainModule.Resources.Select (r => r.Name), Has.No.Member (resourceName)); } @@ -576,25 +569,25 @@ namespace Mono.Linker.Tests.TestCasesRunner { void VerifyKeptAllTypesAndMembersInAssembly (AssemblyDefinition linked) { var original = ResolveOriginalsAssembly (linked.MainModule.Assembly.Name.Name); - + if (original == null) Assert.Fail ($"Failed to resolve original assembly {linked.MainModule.Assembly.Name.Name}"); - + var originalTypes = original.AllDefinedTypes ().ToDictionary (t => t.FullName); var linkedTypes = linked.AllDefinedTypes ().ToDictionary (t => t.FullName); var missingInLinked = originalTypes.Keys.Except (linkedTypes.Keys); - + Assert.That (missingInLinked, Is.Empty, $"Expected all types to exist in the linked assembly, but one or more were missing"); foreach (var originalKvp in originalTypes) { - var linkedType = linkedTypes [originalKvp.Key]; + var linkedType = linkedTypes[originalKvp.Key]; var originalMembers = originalKvp.Value.AllMembers ().Select (m => m.FullName); var linkedMembers = linkedType.AllMembers ().Select (m => m.FullName); var missingMembersInLinked = originalMembers.Except (linkedMembers); - + Assert.That (missingMembersInLinked, Is.Empty, $"Expected all members of `{originalKvp.Key}`to exist in the linked assembly, but one or more were missing"); } } @@ -606,17 +599,17 @@ namespace Mono.Linker.Tests.TestCasesRunner { foreach (var typeWithRemoveInAssembly in original.AllDefinedTypes ()) { foreach (var attr in typeWithRemoveInAssembly.CustomAttributes) { if (attr.AttributeType.Resolve ().Name == nameof (LogContainsAttribute)) { - var expectedMessage = (string)attr.ConstructorArguments [0].Value; + var expectedMessage = (string) attr.ConstructorArguments[0].Value; Assert.That (new Func<bool> (() => { - if ((bool)attr.ConstructorArguments [1].Value) + if ((bool) attr.ConstructorArguments[1].Value) return logger.Messages.Any (mc => Regex.IsMatch (mc.Message, expectedMessage)); return logger.Messages.Any (mc => mc.Message.Contains (expectedMessage)); }), $"Expected to find logged message matching `{expectedMessage}`, but no such message was found.{Environment.NewLine}Logged messages:{Environment.NewLine}{allMessages}"); } if (attr.AttributeType.Resolve ().Name == nameof (LogDoesNotContainAttribute)) { - var unexpectedMessagePattern = (string)attr.ConstructorArguments [0].Value; + var unexpectedMessagePattern = (string) attr.ConstructorArguments[0].Value; foreach (var loggedMessage in logger.Messages) { Assert.That ( !Regex.IsMatch (loggedMessage.Message, unexpectedMessagePattern), @@ -632,25 +625,25 @@ namespace Mono.Linker.Tests.TestCasesRunner { foreach (var typeWithRemoveInAssembly in original.AllDefinedTypes ()) { foreach (var attr in typeWithRemoveInAssembly.CustomAttributes) { if (attr.AttributeType.Resolve ().Name == nameof (DependencyRecordedAttribute)) { - var expectedSource = (string)attr.ConstructorArguments [0].Value; - var expectedTarget = (string)attr.ConstructorArguments [1].Value; - var expectedMarked = (string)attr.ConstructorArguments [2].Value; + var expectedSource = (string) attr.ConstructorArguments[0].Value; + var expectedTarget = (string) attr.ConstructorArguments[1].Value; + var expectedMarked = (string) attr.ConstructorArguments[2].Value; if (!dependencyRecorder.Dependencies.Any (dependency => { - if (dependency.Source != expectedSource) - return false; + if (dependency.Source != expectedSource) + return false; - if (dependency.Target != expectedTarget) - return false; + if (dependency.Target != expectedTarget) + return false; - return expectedMarked == null || dependency.Marked.ToString () == expectedMarked; - })) { + return expectedMarked == null || dependency.Marked.ToString () == expectedMarked; + })) { - string targetCandidates = string.Join(Environment.NewLine, dependencyRecorder.Dependencies - .Where (d => d.Target.ToLowerInvariant().Contains (expectedTarget.ToLowerInvariant())) + string targetCandidates = string.Join (Environment.NewLine, dependencyRecorder.Dependencies + .Where (d => d.Target.ToLowerInvariant ().Contains (expectedTarget.ToLowerInvariant ())) .Select (d => "\t" + DependencyToString (d))); string sourceCandidates = string.Join (Environment.NewLine, dependencyRecorder.Dependencies - .Where (d => d.Source.ToLowerInvariant().Contains (expectedSource.ToLowerInvariant())) + .Where (d => d.Source.ToLowerInvariant ().Contains (expectedSource.ToLowerInvariant ())) .Select (d => "\t" + DependencyToString (d))); Assert.Fail ( @@ -663,7 +656,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { } } - static string DependencyToString(TestDependencyRecorder.Dependency dependency) + static string DependencyToString (TestDependencyRecorder.Dependency dependency) { return $"{dependency.Source} -> {dependency.Target} Marked: {dependency.Marked}"; } @@ -716,7 +709,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { foundAttributesToVerify = true; string expectedSourceMethod = GetFullMemberNameFromDefinition (expectedSourceMethodDefinition); string expectedReflectionMethod = GetFullMemberNameFromReflectionAccessPatternAttribute (attr, constructorArgumentsOffset: 0); - string expectedMessage = (string)attr.ConstructorArguments [3].Value; + string expectedMessage = (string) attr.ConstructorArguments[3].Value; if (!reflectionPatternRecorder.UnrecognizedPatterns.Any (pattern => { if (GetFullMemberNameFromDefinition (pattern.SourceMethod) != expectedSourceMethod) @@ -795,11 +788,11 @@ namespace Mono.Linker.Tests.TestCasesRunner { } } - static string GetFullMemberNameFromReflectionAccessPatternAttribute (CustomAttribute attr, int constructorArgumentsOffset) + static string GetFullMemberNameFromReflectionAccessPatternAttribute (CustomAttribute attr, int constructorArgumentsOffset) { - var type = attr.ConstructorArguments [constructorArgumentsOffset].Value; - var memberName = (string)attr.ConstructorArguments [constructorArgumentsOffset + 1].Value; - var parameterTypes = (CustomAttributeArgument[])attr.ConstructorArguments [constructorArgumentsOffset + 2].Value; + var type = attr.ConstructorArguments[constructorArgumentsOffset].Value; + var memberName = (string) attr.ConstructorArguments[constructorArgumentsOffset + 1].Value; + var parameterTypes = (CustomAttributeArgument[]) attr.ConstructorArguments[constructorArgumentsOffset + 2].Value; string fullName = type.ToString (); if (memberName == null) { @@ -853,7 +846,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { protected TypeDefinition GetOriginalTypeFromInAssemblyAttribute (CustomAttribute inAssemblyAttribute) { - return GetOriginalTypeFromInAssemblyAttribute (inAssemblyAttribute.ConstructorArguments [0].Value.ToString (), inAssemblyAttribute.ConstructorArguments [1].Value); + return GetOriginalTypeFromInAssemblyAttribute (inAssemblyAttribute.ConstructorArguments[0].Value.ToString (), inAssemblyAttribute.ConstructorArguments[1].Value); } protected TypeDefinition GetOriginalTypeFromInAssemblyAttribute (string assemblyName, object typeOrTypeName) @@ -876,9 +869,9 @@ namespace Mono.Linker.Tests.TestCasesRunner { foreach (var typeWithRemoveInAssembly in original.AllDefinedTypes ()) { foreach (var attr in typeWithRemoveInAssembly.CustomAttributes.Where (IsTypeInOtherAssemblyAssertion)) { - var assemblyName = (string) attr.ConstructorArguments [0].Value; + var assemblyName = (string) attr.ConstructorArguments[0].Value; if (!checks.TryGetValue (assemblyName, out List<CustomAttribute> checksForAssembly)) - checks [assemblyName] = checksForAssembly = new List<CustomAttribute> (); + checks[assemblyName] = checksForAssembly = new List<CustomAttribute> (); checksForAssembly.Add (attr); } diff --git a/test/Mono.Linker.Tests/TestCasesRunner/SetupCompileInfo.cs b/test/Mono.Linker.Tests/TestCasesRunner/SetupCompileInfo.cs index a8f0525cd..d58da3930 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/SetupCompileInfo.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/SetupCompileInfo.cs @@ -1,8 +1,10 @@ using System; using Mono.Linker.Tests.Extensions; -namespace Mono.Linker.Tests.TestCasesRunner { - public class SetupCompileInfo { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class SetupCompileInfo + { public string OutputName; public NPath[] SourceFiles; public string[] Defines; diff --git a/test/Mono.Linker.Tests/TestCasesRunner/SourceAndDestinationPair.cs b/test/Mono.Linker.Tests/TestCasesRunner/SourceAndDestinationPair.cs index 762887a13..28e2b7503 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/SourceAndDestinationPair.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/SourceAndDestinationPair.cs @@ -1,8 +1,10 @@ using System; using Mono.Linker.Tests.Extensions; -namespace Mono.Linker.Tests.TestCasesRunner { - public class SourceAndDestinationPair { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class SourceAndDestinationPair + { public NPath Source; public string DestinationFileName; } diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseAssemblyResolver.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseAssemblyResolver.cs index 0c3c82583..d6f75a881 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseAssemblyResolver.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseAssemblyResolver.cs @@ -2,8 +2,10 @@ using System.Collections.Generic; using Mono.Cecil; -namespace Mono.Linker.Tests.TestCasesRunner { - public class TestCaseAssemblyResolver : DefaultAssemblyResolver { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class TestCaseAssemblyResolver : DefaultAssemblyResolver + { readonly HashSet<IDisposable> itemsToDispose; public TestCaseAssemblyResolver () diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCollector.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCollector.cs index c48dd331e..34ddc5fa7 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCollector.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCollector.cs @@ -6,8 +6,10 @@ using Mono.Linker.Tests.TestCases; using Mono.Linker.Tests.Extensions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -namespace Mono.Linker.Tests.TestCasesRunner { - public class TestCaseCollector { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class TestCaseCollector + { private readonly NPath _rootDirectory; private readonly NPath _testCaseAssemblyPath; @@ -29,7 +31,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { public TestCase Collect (NPath sourceFile) { - return Collect (new [] { sourceFile }).First (); + return Collect (new[] { sourceFile }).First (); } public IEnumerable<TestCase> Collect (IEnumerable<NPath> sourceFiles) @@ -59,16 +61,16 @@ namespace Mono.Linker.Tests.TestCasesRunner { foreach (var file in subDir.Files ("*.cs", true)) { - var relativeParents = file.RelativeTo(_rootDirectory); + var relativeParents = file.RelativeTo (_rootDirectory); // Magic : Anything in a directory named Dependencies is assumed to be a dependency to a test case // and never a test itself // This makes life a little easier when writing these supporting files as it removes some constraints you would previously have // had to follow such as ensuring a class exists that matches the file name and putting [NotATestCase] on that class - if (relativeParents.RecursiveParents.Any(p => p.Elements.Any() && p.FileName == "Dependencies")) + if (relativeParents.RecursiveParents.Any (p => p.Elements.Any () && p.FileName == "Dependencies")) continue; // Magic: Anything in a directory named Individual is expected to be ran by it's own [Test] rather than as part of [TestCaseSource] - if (relativeParents.RecursiveParents.Any(p => p.Elements.Any() && p.FileName == "Individual")) + if (relativeParents.RecursiveParents.Any (p => p.Elements.Any () && p.FileName == "Individual")) continue; yield return file; diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs index 782fcbcd1..b483bac58 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Diagnostics; @@ -14,15 +14,17 @@ using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.CSharp; #endif -namespace Mono.Linker.Tests.TestCasesRunner { - public class TestCaseCompiler { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class TestCaseCompiler + { static string _cachedWindowsCscPath = null; protected readonly TestCaseMetadaProvider _metadataProvider; protected readonly TestCaseSandbox _sandbox; protected readonly ILCompiler _ilCompiler; public TestCaseCompiler (TestCaseSandbox sandbox, TestCaseMetadaProvider metadataProvider) - : this(sandbox, metadataProvider, new ILCompiler ()) + : this (sandbox, metadataProvider, new ILCompiler ()) { } @@ -36,7 +38,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { public NPath CompileTestIn (NPath outputDirectory, string outputName, IEnumerable<string> sourceFiles, string[] commonReferences, string[] mainAssemblyReferences, IEnumerable<string> defines, NPath[] resources, string[] additionalArguments) { var originalCommonReferences = commonReferences.Select (r => r.ToNPath ()).ToArray (); - var originalDefines = defines?.ToArray () ?? new string [0]; + var originalDefines = defines?.ToArray () ?? new string[0]; Prepare (outputDirectory); @@ -54,7 +56,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { resources, additionalArguments); var testAssembly = CompileAssembly (options); - + // The compile after step is used by tests to mess around with the input to the linker. Generally speaking, it doesn't seem like we would ever want to mess with the // expectations assemblies because this would undermine our ability to inspect them for expected results during ResultChecking. The UnityLinker UnresolvedHandling tests depend on this @@ -71,8 +73,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { protected virtual CompilerOptions CreateOptionsForTestCase (NPath outputPath, NPath[] sourceFiles, NPath[] references, string[] defines, NPath[] resources, string[] additionalArguments) { - return new CompilerOptions - { + return new CompilerOptions { OutputPath = outputPath, SourceFiles = sourceFiles, References = references, @@ -85,11 +86,10 @@ namespace Mono.Linker.Tests.TestCasesRunner { protected virtual CompilerOptions CreateOptionsForSupportingAssembly (SetupCompileInfo setupCompileInfo, NPath outputDirectory, NPath[] sourceFiles, NPath[] references, string[] defines, NPath[] resources) { - var allDefines = defines.Concat (setupCompileInfo.Defines ?? new string [0]).ToArray (); - var allReferences = references.Concat (setupCompileInfo.References?.Select (p => MakeSupportingAssemblyReferencePathAbsolute (outputDirectory, p)) ?? new NPath [0]).ToArray (); + var allDefines = defines.Concat (setupCompileInfo.Defines ?? new string[0]).ToArray (); + var allReferences = references.Concat (setupCompileInfo.References?.Select (p => MakeSupportingAssemblyReferencePathAbsolute (outputDirectory, p)) ?? new NPath[0]).ToArray (); string[] additionalArguments = string.IsNullOrEmpty (setupCompileInfo.AdditionalArguments) ? null : new[] { setupCompileInfo.AdditionalArguments }; - return new CompilerOptions - { + return new CompilerOptions { OutputPath = outputDirectory.Combine (setupCompileInfo.OutputName), SourceFiles = sourceFiles, References = allReferences, @@ -102,8 +102,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { private IEnumerable<NPath> CompileBeforeTestCaseAssemblies (NPath outputDirectory, NPath[] references, string[] defines) { - foreach (var setupCompileInfo in _metadataProvider.GetSetupCompileAssembliesBefore ()) - { + foreach (var setupCompileInfo in _metadataProvider.GetSetupCompileAssembliesBefore ()) { var options = CreateOptionsForSupportingAssembly ( setupCompileInfo, outputDirectory, @@ -119,8 +118,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { private void CompileAfterTestCaseAssemblies (NPath outputDirectory, NPath[] references, string[] defines) { - foreach (var setupCompileInfo in _metadataProvider.GetSetupCompileAssembliesAfter ()) - { + foreach (var setupCompileInfo in _metadataProvider.GetSetupCompileAssembliesAfter ()) { var options = CreateOptionsForSupportingAssembly ( setupCompileInfo, outputDirectory, @@ -141,7 +139,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { { return CollectSourceFilesFrom (_sandbox.AfterReferenceSourceDirectoryFor (info.OutputName)); } - + private NPath[] CollectSetupBeforeResourcesFiles (SetupCompileInfo info) { return _sandbox.BeforeReferenceResourceDirectoryFor (info.OutputName).Files ().ToArray (); @@ -149,7 +147,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { private NPath[] CollectSetupAfterResourcesFiles (SetupCompileInfo info) { - return _sandbox.AfterReferenceResourceDirectoryFor (info.OutputName).Files ().ToArray (); + return _sandbox.AfterReferenceResourceDirectoryFor (info.OutputName).Files ().ToArray (); } private static NPath[] CollectSourceFilesFrom (NPath directory) @@ -175,7 +173,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (possiblePath.FileExists ()) return possiblePath; - return referenceFileName.ToNPath(); + return referenceFileName.ToNPath (); } protected NPath CompileAssembly (CompilerOptions options) @@ -295,7 +293,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { #endif } - protected virtual NPath CompileCSharpAssemblyWithMcs(CompilerOptions options) + protected virtual NPath CompileCSharpAssemblyWithMcs (CompilerOptions options) { if (Environment.OSVersion.Platform == PlatformID.Win32NT) CompileCSharpAssemblyWithExternalCompiler (LocateMcsExecutable (), options, string.Empty); @@ -353,10 +351,10 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (process.ExitCode != 0) Assert.Fail ($"vswhere.exe failed with :\n{capturedOutput.Aggregate ((buff, s) => buff + Environment.NewLine + s)}"); - if (capturedOutput.Count == 0 || string.IsNullOrEmpty (capturedOutput [0])) + if (capturedOutput.Count == 0 || string.IsNullOrEmpty (capturedOutput[0])) Assert.Fail ("vswhere.exe was unable to locate an install directory"); - var installPath = capturedOutput [0].Trim ().ToNPath (); + var installPath = capturedOutput[0].Trim ().ToNPath (); if (!installPath.Exists ()) Assert.Fail ($"No install found at {installPath}"); @@ -386,7 +384,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { protected string OptionsToCompilerCommandLineArguments (CompilerOptions options, string compilerSpecificArguments) { var builder = new StringBuilder (); - if (!string.IsNullOrEmpty(compilerSpecificArguments)) + if (!string.IsNullOrEmpty (compilerSpecificArguments)) builder.Append (compilerSpecificArguments); builder.Append ($"/out:{options.OutputPath}"); var target = options.OutputPath.ExtensionWithDot == ".exe" ? "exe" : "library"; diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs index e6e918b5b..94635ba9e 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs @@ -1,7 +1,8 @@ using System; using System.Collections.Generic; -namespace Mono.Linker.Tests.TestCasesRunner { +namespace Mono.Linker.Tests.TestCasesRunner +{ public class TestCaseLinkerOptions { public string CoreAssembliesAction; diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadaProvider.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadaProvider.cs index 2a00d2ed3..6bd6c9ed1 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadaProvider.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadaProvider.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -8,8 +8,10 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; using Mono.Linker.Tests.Extensions; using Mono.Linker.Tests.TestCases; -namespace Mono.Linker.Tests.TestCasesRunner { - public class TestCaseMetadaProvider { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class TestCaseMetadaProvider + { protected readonly TestCase _testCase; protected readonly AssemblyDefinition _fullTestCaseAssemblyDefinition; protected readonly TypeDefinition _testCaseTypeDefinition; @@ -39,44 +41,42 @@ namespace Mono.Linker.Tests.TestCasesRunner { StripResources = GetOptionAttributeValue (nameof (StripResourcesAttribute), true), }; - foreach (var assemblyAction in _testCaseTypeDefinition.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (SetupLinkerActionAttribute))) - { + foreach (var assemblyAction in _testCaseTypeDefinition.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (SetupLinkerActionAttribute))) { var ca = assemblyAction.ConstructorArguments; - tclo.AssembliesAction.Add (new KeyValuePair<string, string> ((string)ca [0].Value, (string)ca [1].Value)); + tclo.AssembliesAction.Add (new KeyValuePair<string, string> ((string) ca[0].Value, (string) ca[1].Value)); } foreach (var subsFile in _testCaseTypeDefinition.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (SetupLinkerSubstitutionFileAttribute))) { var ca = subsFile.ConstructorArguments; - var file = (string)ca [0].Value; + var file = (string) ca[0].Value; tclo.Substitutions.Add (Path.Combine (inputPath, file)); } foreach (var subsFile in _testCaseTypeDefinition.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (SetupLinkerAttributeDefinitionsFile))) { var ca = subsFile.ConstructorArguments; - var file = (string)ca [0].Value; + var file = (string) ca[0].Value; tclo.AttributeDefinitions.Add (Path.Combine (inputPath, file)); } - foreach (var additionalArgumentAttr in _testCaseTypeDefinition.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (SetupLinkerArgumentAttribute))) - { + foreach (var additionalArgumentAttr in _testCaseTypeDefinition.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (SetupLinkerArgumentAttribute))) { var ca = additionalArgumentAttr.ConstructorArguments; - var values = ((CustomAttributeArgument [])ca [1].Value)?.Select (arg => arg.Value.ToString ()).ToArray (); + var values = ((CustomAttributeArgument[]) ca[1].Value)?.Select (arg => arg.Value.ToString ()).ToArray (); // Since custom attribute arguments need to be constant expressions, we need to add // the path to the temp directory (where the custom assembly is located) here. - if ((string)ca [0].Value == "--custom-step") { - int pos = values [0].IndexOf (","); + if ((string) ca[0].Value == "--custom-step") { + int pos = values[0].IndexOf (","); if (pos != -1) { - string custom_assembly_path = values [0].Substring (pos + 1); + string custom_assembly_path = values[0].Substring (pos + 1); if (!Path.IsPathRooted (custom_assembly_path)) - values [0] = values [0].Substring (0, pos + 1) + Path.Combine (inputPath, custom_assembly_path); + values[0] = values[0].Substring (0, pos + 1) + Path.Combine (inputPath, custom_assembly_path); } } - tclo.AdditionalArguments.Add (new KeyValuePair<string, string []> ((string)ca [0].Value, values)); + tclo.AdditionalArguments.Add (new KeyValuePair<string, string[]> ((string) ca[0].Value, values)); } - if (_testCaseTypeDefinition.CustomAttributes.Any (attr => + if (_testCaseTypeDefinition.CustomAttributes.Any (attr => attr.AttributeType.Name == nameof (LogContainsAttribute) || attr.AttributeType.Name == nameof (LogDoesNotContainAttribute))) { - tclo.AdditionalArguments.Add (new KeyValuePair<string, string []> ("--verbose", new string [] { })); + tclo.AdditionalArguments.Add (new KeyValuePair<string, string[]> ("--verbose", new string[] { })); } return tclo; @@ -92,7 +92,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { }; } - if (ValidatesReflectionAccessPatterns(_testCaseTypeDefinition)) { + if (ValidatesReflectionAccessPatterns (_testCaseTypeDefinition)) { customizations.ReflectionPatternRecorder = new TestReflectionPatternRecorder (); customizations.CustomizeContext += context => { context.ReflectionPatternRecorder = customizations.ReflectionPatternRecorder; @@ -173,7 +173,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { { return _testCaseTypeDefinition.CustomAttributes .Where (attr => attr.AttributeType.Name == nameof (ReferenceDependencyAttribute)) - .Select (attr => (string) attr.ConstructorArguments [0].Value); + .Select (attr => (string) attr.ConstructorArguments[0].Value); } public virtual IEnumerable<string> GetReferenceValues () @@ -225,7 +225,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { { var ignoreAttribute = _testCaseTypeDefinition.CustomAttributes.FirstOrDefault (attr => attr.AttributeType.Name == nameof (IgnoreTestCaseAttribute)); if (ignoreAttribute != null) { - reason = (string)ignoreAttribute.ConstructorArguments.First ().Value; + reason = (string) ignoreAttribute.ConstructorArguments.First ().Value; return true; } @@ -265,11 +265,11 @@ namespace Mono.Linker.Tests.TestCasesRunner { yield return "NETCOREAPP"; #endif - foreach (var attr in _testCaseTypeDefinition.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (DefineAttribute))) + foreach (var attr in _testCaseTypeDefinition.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (DefineAttribute))) yield return (string) attr.ConstructorArguments.First ().Value; } - public virtual bool LinkPublicAndFamily() + public virtual bool LinkPublicAndFamily () { return _testCaseTypeDefinition.CustomAttributes .FirstOrDefault (attr => attr.AttributeType.Name == nameof (SetupLinkerLinkPublicAndFamilyAttribute)) != null; @@ -306,10 +306,9 @@ namespace Mono.Linker.Tests.TestCasesRunner { SourceAndDestinationPair GetSourceAndRelativeDestinationValue (CustomAttribute attribute) { - var fullSource = SourceFileForAttributeArgumentValue (attribute.ConstructorArguments.First ().Value); - var destinationFileName = (string) attribute.ConstructorArguments [1].Value; - return new SourceAndDestinationPair - { + var fullSource = SourceFileForAttributeArgumentValue (attribute.ConstructorArguments.First ().Value); + var destinationFileName = (string) attribute.ConstructorArguments[1].Value; + return new SourceAndDestinationPair { Source = fullSource, DestinationFileName = string.IsNullOrEmpty (destinationFileName) ? fullSource.FileName : destinationFileName }; @@ -318,16 +317,15 @@ namespace Mono.Linker.Tests.TestCasesRunner { private SetupCompileInfo CreateSetupCompileAssemblyInfo (CustomAttribute attribute) { var ctorArguments = attribute.ConstructorArguments; - return new SetupCompileInfo - { - OutputName = (string) ctorArguments [0].Value, - SourceFiles = SourceFilesForAttributeArgument (ctorArguments [1]), - References = ((CustomAttributeArgument []) ctorArguments [2].Value)?.Select (arg => arg.Value.ToString ()).ToArray (), - Defines = ((CustomAttributeArgument []) ctorArguments [3].Value)?.Select (arg => arg.Value.ToString ()).ToArray (), - Resources = ((CustomAttributeArgument []) ctorArguments [4].Value)?.Select (arg => MakeSourceTreeFilePathAbsolute (arg.Value.ToString ())).ToArray (), - AdditionalArguments = (string) ctorArguments [5].Value, - CompilerToUse = (string) ctorArguments [6].Value, - AddAsReference = ctorArguments.Count >= 8 ? (bool) ctorArguments [7].Value : true + return new SetupCompileInfo { + OutputName = (string) ctorArguments[0].Value, + SourceFiles = SourceFilesForAttributeArgument (ctorArguments[1]), + References = ((CustomAttributeArgument[]) ctorArguments[2].Value)?.Select (arg => arg.Value.ToString ()).ToArray (), + Defines = ((CustomAttributeArgument[]) ctorArguments[3].Value)?.Select (arg => arg.Value.ToString ()).ToArray (), + Resources = ((CustomAttributeArgument[]) ctorArguments[4].Value)?.Select (arg => MakeSourceTreeFilePathAbsolute (arg.Value.ToString ())).ToArray (), + AdditionalArguments = (string) ctorArguments[5].Value, + CompilerToUse = (string) ctorArguments[6].Value, + AddAsReference = ctorArguments.Count >= 8 ? (bool) ctorArguments[7].Value : true }; } @@ -338,7 +336,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { protected NPath[] SourceFilesForAttributeArgument (CustomAttributeArgument attributeArgument) { - return ((CustomAttributeArgument []) attributeArgument.Value) + return ((CustomAttributeArgument[]) attributeArgument.Value) .Select (attributeArg => SourceFileForAttributeArgumentValue (attributeArg.Value)) .Distinct () .ToArray (); @@ -351,7 +349,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { var parentType = ParentMostType (valueAsTypeRef); var pathRelativeToAssembly = $"{parentType.FullName.Substring (parentType.Module.Name.Length - 3).Replace ('.', '/')}.cs".ToNPath (); var pathElements = pathRelativeToAssembly.Elements.ToArray (); - var topMostDirectoryName = pathElements [0]; + var topMostDirectoryName = pathElements[0]; var topMostDirectory = _testCase.SourceFile.RecursiveParents.Reverse ().FirstOrDefault (d => !d.IsRoot && d.FileName == topMostDirectoryName); if (topMostDirectory == null) { @@ -370,7 +368,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { } var fullPath = topMostDirectory.Parent.Combine (pathRelativeToAssembly); - + if (!fullPath.Exists ()) throw new ArgumentException ($"Unable to locate the source file for type {valueAsTypeRef}. Expected {fullPath}. Ensure the type name matches the file name. And the namespace match the directory structure on disk"); diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs index fda57e644..27a0712c8 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs @@ -1,12 +1,14 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Extensions; using Mono.Linker.Tests.TestCases; -namespace Mono.Linker.Tests.TestCasesRunner { - public class TestCaseSandbox { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class TestCaseSandbox + { protected readonly TestCase _testCase; protected readonly NPath _directory; @@ -80,21 +82,21 @@ namespace Mono.Linker.Tests.TestCasesRunner { if (destination.Parent == InputDirectory) dep.Source.Copy (ExpectationsDirectory.Combine (destination.RelativeTo (InputDirectory))); } - + // Copy non class library dependencies to the sandbox foreach (var fileName in metadataProvider.GetReferenceValues ()) { if (!fileName.StartsWith ("System.", StringComparison.Ordinal) && !fileName.StartsWith ("Mono.", StringComparison.Ordinal) && !fileName.StartsWith ("Microsoft.", StringComparison.Ordinal)) CopyToInputAndExpectations (_testCase.SourceFile.Parent.Combine (fileName.ToNPath ())); } - + foreach (var referenceDependency in metadataProvider.GetReferenceDependencies ()) - CopyToInputAndExpectations (_testCase.SourceFile.Parent.Combine (referenceDependency.ToNPath())); + CopyToInputAndExpectations (_testCase.SourceFile.Parent.Combine (referenceDependency.ToNPath ())); foreach (var res in metadataProvider.GetResources ()) { res.Source.FileMustExist ().Copy (ResourcesDirectory.Combine (res.DestinationFileName)); } - foreach (var res in metadataProvider.GetResponseFiles()) { + foreach (var res in metadataProvider.GetResponseFiles ()) { res.Source.FileMustExist ().Copy (InputDirectory.Combine (res.DestinationFileName)); } @@ -106,20 +108,18 @@ namespace Mono.Linker.Tests.TestCasesRunner { res.Source.FileMustExist ().Copy (InputDirectory.Combine (res.DestinationFileName)); } - foreach (var compileRefInfo in metadataProvider.GetSetupCompileAssembliesBefore ()) - { + foreach (var compileRefInfo in metadataProvider.GetSetupCompileAssembliesBefore ()) { var destination = BeforeReferenceSourceDirectoryFor (compileRefInfo.OutputName).EnsureDirectoryExists (); compileRefInfo.SourceFiles.Copy (destination); - + destination = BeforeReferenceResourceDirectoryFor (compileRefInfo.OutputName).EnsureDirectoryExists (); compileRefInfo.Resources?.Copy (destination); } - foreach (var compileRefInfo in metadataProvider.GetSetupCompileAssembliesAfter ()) - { + foreach (var compileRefInfo in metadataProvider.GetSetupCompileAssembliesAfter ()) { var destination = AfterReferenceSourceDirectoryFor (compileRefInfo.OutputName).EnsureDirectoryExists (); compileRefInfo.SourceFiles.Copy (destination); - + destination = AfterReferenceResourceDirectoryFor (compileRefInfo.OutputName).EnsureDirectoryExists (); compileRefInfo.Resources?.Copy (destination); } @@ -145,7 +145,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { { return _directory.Combine ($"ref_source_after_{Path.GetFileNameWithoutExtension (outputName)}"); } - + public NPath BeforeReferenceResourceDirectoryFor (string outputName) { return _directory.Combine ($"ref_resource_before_{Path.GetFileNameWithoutExtension (outputName)}"); diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs index f60398db0..5389d26e8 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs @@ -6,8 +6,10 @@ using Mono.Linker.Tests.Extensions; using Mono.Linker.Tests.TestCases; using NUnit.Framework; -namespace Mono.Linker.Tests.TestCasesRunner { - public class TestRunner { +namespace Mono.Linker.Tests.TestCasesRunner +{ + public class TestRunner + { private readonly ObjectFactory _factory; public TestRunner (ObjectFactory factory) @@ -47,20 +49,20 @@ namespace Mono.Linker.Tests.TestCasesRunner { { var inputCompiler = _factory.CreateCompiler (sandbox, metadataProvider); var expectationsCompiler = _factory.CreateCompiler (sandbox, metadataProvider); - var sourceFiles = sandbox.SourceFiles.Select(s => s.ToString()).ToArray(); + var sourceFiles = sandbox.SourceFiles.Select (s => s.ToString ()).ToArray (); var assemblyName = metadataProvider.GetAssemblyName (); - var commonReferences = metadataProvider.GetCommonReferencedAssemblies(sandbox.InputDirectory).ToArray (); - var mainAssemblyReferences = metadataProvider.GetReferencedAssemblies(sandbox.InputDirectory).ToArray (); + var commonReferences = metadataProvider.GetCommonReferencedAssemblies (sandbox.InputDirectory).ToArray (); + var mainAssemblyReferences = metadataProvider.GetReferencedAssemblies (sandbox.InputDirectory).ToArray (); var resources = sandbox.ResourceFiles.ToArray (); var additionalArguments = metadataProvider.GetSetupCompilerArguments ().ToArray (); - + var expectationsCommonReferences = metadataProvider.GetCommonReferencedAssemblies (sandbox.ExpectationsDirectory).ToArray (); var expectationsMainAssemblyReferences = metadataProvider.GetReferencedAssemblies (sandbox.ExpectationsDirectory).ToArray (); - var inputTask = Task.Run(() => inputCompiler.CompileTestIn (sandbox.InputDirectory, assemblyName, sourceFiles, commonReferences, mainAssemblyReferences, null, resources, additionalArguments)); - var expectationsTask = Task.Run(() => expectationsCompiler.CompileTestIn (sandbox.ExpectationsDirectory, assemblyName, sourceFiles, expectationsCommonReferences, expectationsMainAssemblyReferences, new[] {"INCLUDE_EXPECTATIONS"}, resources, additionalArguments)); + var inputTask = Task.Run (() => inputCompiler.CompileTestIn (sandbox.InputDirectory, assemblyName, sourceFiles, commonReferences, mainAssemblyReferences, null, resources, additionalArguments)); + var expectationsTask = Task.Run (() => expectationsCompiler.CompileTestIn (sandbox.ExpectationsDirectory, assemblyName, sourceFiles, expectationsCommonReferences, expectationsMainAssemblyReferences, new[] { "INCLUDE_EXPECTATIONS" }, resources, additionalArguments)); NPath inputAssemblyPath = null; NPath expectationsAssemblyPath = null; @@ -70,15 +72,14 @@ namespace Mono.Linker.Tests.TestCasesRunner { } catch (Exception) { // If completing the input assembly task threw, we need to wait for the expectations task to complete before continuing // otherwise we could set the next test up for a race condition with the expectations compilation over access to the sandbox directory - if (inputAssemblyPath == null && expectationsAssemblyPath == null) - { + if (inputAssemblyPath == null && expectationsAssemblyPath == null) { try { expectationsTask.Wait (); } catch (Exception) { // Don't care, we want to throw the first exception } } - + throw; } return new ManagedCompilationResult (inputAssemblyPath, expectationsAssemblyPath); @@ -97,7 +98,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { AddLinkOptions (sandbox, compilationResult, builder, metadataProvider); - LinkerTestLogger logger = new LinkerTestLogger(); + LinkerTestLogger logger = new LinkerTestLogger (); linker.Link (builder.ToArgs (), linkerCustomizations, logger); return new LinkedTestCaseResult (testCase, compilationResult.InputAssemblyPath, sandbox.OutputDirectory.Combine (compilationResult.InputAssemblyPath.FileName), compilationResult.ExpectationsAssemblyPath, sandbox, metadataProvider, compilationResult, logger, linkerCustomizations); @@ -123,7 +124,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { builder.ProcessTestInputAssembly (compilationResult.InputAssemblyPath); } - protected virtual LinkerCustomizations CustomizeLinker(LinkerDriver linker, TestCaseMetadaProvider metadataProvider) + protected virtual LinkerCustomizations CustomizeLinker (LinkerDriver linker, TestCaseMetadaProvider metadataProvider) { LinkerCustomizations customizations = new LinkerCustomizations (); @@ -144,7 +145,7 @@ namespace Mono.Linker.Tests.TestCasesRunner { || e.InnerException is InconclusiveException) throw e.InnerException; } - + throw; } } diff --git a/test/Mono.Linker.Tests/Tests/CodeOptimizationsSettingsTests.cs b/test/Mono.Linker.Tests/Tests/CodeOptimizationsSettingsTests.cs index a05fb5393..4f33ae1de 100644 --- a/test/Mono.Linker.Tests/Tests/CodeOptimizationsSettingsTests.cs +++ b/test/Mono.Linker.Tests/Tests/CodeOptimizationsSettingsTests.cs @@ -4,7 +4,7 @@ namespace Mono.Linker.Tests { [TestFixture] public class CodeOptimizationsSettingsTests - { + { [Test] public void GlobalSettingsOnly () { diff --git a/test/Mono.Linker.Tests/Tests/MessageContainerTests.cs b/test/Mono.Linker.Tests/Tests/MessageContainerTests.cs index 04172d2d8..e9c016dfa 100644 --- a/test/Mono.Linker.Tests/Tests/MessageContainerTests.cs +++ b/test/Mono.Linker.Tests/Tests/MessageContainerTests.cs @@ -11,7 +11,7 @@ namespace Mono.Linker.Tests var msg = MessageContainer.CreateErrorMessage ("text", 1000); Assert.AreEqual ("illinker: error IL1000: text", msg.ToMSBuildString ()); - msg = MessageContainer.CreateWarningMessage ("message", 2001, origin: new MessageOrigin("logtest", 1, 1)); + msg = MessageContainer.CreateWarningMessage ("message", 2001, origin: new MessageOrigin ("logtest", 1, 1)); Assert.AreEqual ("logtest(1,1): warning IL2001: message", msg.ToMSBuildString ()); msg = MessageContainer.CreateInfoMessage ("log test"); diff --git a/test/Mono.Linker.Tests/Tests/ParseResponseFileLinesTests.cs b/test/Mono.Linker.Tests/Tests/ParseResponseFileLinesTests.cs index c8c407520..063a3a100 100644 --- a/test/Mono.Linker.Tests/Tests/ParseResponseFileLinesTests.cs +++ b/test/Mono.Linker.Tests/Tests/ParseResponseFileLinesTests.cs @@ -1,65 +1,67 @@ using NUnit.Framework; using System.Collections.Generic; -namespace Mono.Linker.Tests { +namespace Mono.Linker.Tests +{ [TestFixture] - public class ParseResponseFileLinesTests { + public class ParseResponseFileLinesTests + { [Test] public void TestOneArg () { - TestParseResponseFileLines (@"abc", new string [] { @"abc" }); + TestParseResponseFileLines (@"abc", new string[] { @"abc" }); } [Test] public void TestTwoArgsOnOneLine () { - TestParseResponseFileLines (@"abc def", new string [] { @"abc", @"def" }); + TestParseResponseFileLines (@"abc def", new string[] { @"abc", @"def" }); } [Test] public void TestTwoArgsOnTwoLine () { TestParseResponseFileLines (@"abc -def", new string [] { @"abc", @"def" }); +def", new string[] { @"abc", @"def" }); } [Test] public void TestOneSlashWithoutQuote () { - TestParseResponseFileLines (@"\", new string [] { @"\" }); + TestParseResponseFileLines (@"\", new string[] { @"\" }); } [Test] public void TestTwoSlashesWithoutQuote () { - TestParseResponseFileLines (@"\\", new string [] { @"\\" }); + TestParseResponseFileLines (@"\\", new string[] { @"\\" }); } [Test] public void TestOneSlashWithQuote () { - TestParseResponseFileLines (@"""x \"" y""", new string [] { @"x "" y" }); + TestParseResponseFileLines (@"""x \"" y""", new string[] { @"x "" y" }); } [Test] public void TestTwoSlashesWithQuote () { - TestParseResponseFileLines (@"""Trailing Slash\\""", new string [] { @"Trailing Slash\" }); + TestParseResponseFileLines (@"""Trailing Slash\\""", new string[] { @"Trailing Slash\" }); } [Test] public void TestWindowsPath () { - TestParseResponseFileLines (@"C:\temp\test.txt", new string [] { @"C:\temp\test.txt" }); + TestParseResponseFileLines (@"C:\temp\test.txt", new string[] { @"C:\temp\test.txt" }); } [Test] public void TestLinuxPath () { - TestParseResponseFileLines (@"/tmp/test.txt", new string [] { @"/tmp/test.txt" }); + TestParseResponseFileLines (@"/tmp/test.txt", new string[] { @"/tmp/test.txt" }); } - private void TestParseResponseFileLines (string v1, string [] v2) + private void TestParseResponseFileLines (string v1, string[] v2) { var result = new Queue<string> (); Driver.ParseResponseFileLines (v1.Split ('\n'), result); diff --git a/test/Mono.Linker.Tests/Tests/TypeNameParserTests.cs b/test/Mono.Linker.Tests/Tests/TypeNameParserTests.cs index 177e83276..758d5ef17 100644 --- a/test/Mono.Linker.Tests/Tests/TypeNameParserTests.cs +++ b/test/Mono.Linker.Tests/Tests/TypeNameParserTests.cs @@ -1,14 +1,16 @@ using NUnit.Framework; -namespace Mono.Linker.Tests { +namespace Mono.Linker.Tests +{ [TestFixture] - public class TypeNameParserTests { + public class TypeNameParserTests + { [Test] public void TryParseTypeAssemblyQualifiedName_Null () { Assert.That (TypeNameParser.TryParseTypeAssemblyQualifiedName (null, out _, out _), Is.False); } - + [Test] public void TryParseTypeAssemblyQualifiedName_FullyQualified () { @@ -17,7 +19,7 @@ namespace Mono.Linker.Tests { Assert.That (typeName, Is.EqualTo (typeof (TypeNameParserTests).FullName)); Assert.That (assemblyName, Is.EqualTo (typeof (TypeNameParserTests).Assembly.GetName ().Name)); } - + [Test] public void TryParseTypeAssemblyQualifiedName_NameAndAssemblyOnly () { @@ -26,7 +28,7 @@ namespace Mono.Linker.Tests { Assert.That (typeName, Is.EqualTo (typeof (TypeNameParserTests).FullName)); Assert.That (assemblyName, Is.EqualTo (typeof (TypeNameParserTests).Assembly.GetName ().Name)); } - + [Test] public void TryParseTypeAssemblyQualifiedName_NameOnly () { @@ -35,16 +37,16 @@ namespace Mono.Linker.Tests { Assert.That (typeName, Is.EqualTo (typeof (TypeNameParserTests).FullName)); Assert.That (assemblyName, Is.Null); } - + [Test] public void TryParseTypeAssemblyQualifiedName_GenericType_FullyQualified () { var value = typeof (SampleGenericType<,>).AssemblyQualifiedName; Assert.That (TypeNameParser.TryParseTypeAssemblyQualifiedName (value, out string typeName, out string assemblyName), Is.True); - Assert.That (typeName, Is.EqualTo($"{typeof (TypeNameParserTests).FullName}/SampleGenericType`2")); - Assert.That (assemblyName, Is.EqualTo(typeof (TypeNameParserTests).Assembly.GetName ().Name)); + Assert.That (typeName, Is.EqualTo ($"{typeof (TypeNameParserTests).FullName}/SampleGenericType`2")); + Assert.That (assemblyName, Is.EqualTo (typeof (TypeNameParserTests).Assembly.GetName ().Name)); } - + [Test] public void TryParseTypeAssemblyQualifiedName_GenericType_NameAndAssemblyOnly () { @@ -53,7 +55,7 @@ namespace Mono.Linker.Tests { Assert.That (typeName, Is.EqualTo ($"{typeof (TypeNameParserTests).FullName}/SampleGenericType`2")); Assert.That (assemblyName, Is.EqualTo (typeof (TypeNameParserTests).Assembly.GetName ().Name)); } - + [Test] public void TryParseTypeAssemblyQualifiedName_GenericType_NameOnly () { @@ -62,25 +64,25 @@ namespace Mono.Linker.Tests { Assert.That (typeName, Is.EqualTo ($"{typeof (TypeNameParserTests).FullName}/SampleGenericType`2")); Assert.That (assemblyName, Is.Null); } - + [Test] public void TryParseTypeAssemblyQualifiedName_NestedType_FullyQualified () { var value = typeof (SampleNestedType).AssemblyQualifiedName; Assert.That (TypeNameParser.TryParseTypeAssemblyQualifiedName (value, out string typeName, out string assemblyName), Is.True); - Assert.That (typeName, Is.EqualTo($"{typeof (TypeNameParserTests).FullName}/{nameof (SampleNestedType)}")); - Assert.That (assemblyName, Is.EqualTo(typeof (TypeNameParserTests).Assembly.GetName ().Name)); + Assert.That (typeName, Is.EqualTo ($"{typeof (TypeNameParserTests).FullName}/{nameof (SampleNestedType)}")); + Assert.That (assemblyName, Is.EqualTo (typeof (TypeNameParserTests).Assembly.GetName ().Name)); } - + [Test] public void TryParseTypeAssemblyQualifiedName_NestedType_NameAndAssemblyOnly () { - var value = $"{typeof (SampleNestedType).FullName}, {typeof (TypeNameParserTests).Assembly.GetName().Name}"; + var value = $"{typeof (SampleNestedType).FullName}, {typeof (TypeNameParserTests).Assembly.GetName ().Name}"; Assert.That (TypeNameParser.TryParseTypeAssemblyQualifiedName (value, out string typeName, out string assemblyName), Is.True); Assert.That (typeName, Is.EqualTo ($"{typeof (TypeNameParserTests).FullName}/{nameof (SampleNestedType)}")); Assert.That (assemblyName, Is.EqualTo (typeof (TypeNameParserTests).Assembly.GetName ().Name)); } - + [Test] public void TryParseTypeAssemblyQualifiedName_NestedType_NameOnly () { @@ -98,7 +100,7 @@ namespace Mono.Linker.Tests { Assert.That (assemblyName, Is.Null); } - + [TestCase ("A[]][")] [TestCase ("A][")] [TestCase ("A[")] @@ -112,10 +114,12 @@ namespace Mono.Linker.Tests { Assert.That (assemblyName, Is.Null); } - class SampleNestedType { + class SampleNestedType + { } - class SampleGenericType<T1, T2> { + class SampleGenericType<T1, T2> + { } } }
\ No newline at end of file |