From f76e85a477603b43e7c2cf173a3a2a8f5a20c591 Mon Sep 17 00:00:00 2001 From: vitek-karas <10670590+vitek-karas@users.noreply.github.com> Date: Mon, 9 Jan 2023 02:39:10 -0800 Subject: [PATCH 1/2] Fix new warning which shows up with latest roslyn First encountered in https://github.com/dotnet/runtime/pull/80235, so copying the change to dotnet/linker --- src/linker/Linker/LinkerAttributesInformation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linker/Linker/LinkerAttributesInformation.cs b/src/linker/Linker/LinkerAttributesInformation.cs index 9fef9b59cdeb..3daeb136f11d 100644 --- a/src/linker/Linker/LinkerAttributesInformation.cs +++ b/src/linker/Linker/LinkerAttributesInformation.cs @@ -106,7 +106,7 @@ public IEnumerable GetAttributes () where T : Attribute return attributeList.Cast (); } - static Attribute? ProcessRequiresUnreferencedCodeAttribute (LinkContext context, ICustomAttributeProvider provider, CustomAttribute customAttribute) + static RequiresUnreferencedCodeAttribute? ProcessRequiresUnreferencedCodeAttribute (LinkContext context, ICustomAttributeProvider provider, CustomAttribute customAttribute) { if (!(provider is MethodDefinition || provider is TypeDefinition)) return null; From 7b037bd3a5841868593199997094752b725c59dd Mon Sep 17 00:00:00 2001 From: vitek-karas <10670590+vitek-karas@users.noreply.github.com> Date: Mon, 9 Jan 2023 03:51:31 -0800 Subject: [PATCH 2/2] More warning fixes ported --- src/ILLink.Tasks/CreateRuntimeRootDescriptorFile.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ILLink.Tasks/CreateRuntimeRootDescriptorFile.cs b/src/ILLink.Tasks/CreateRuntimeRootDescriptorFile.cs index 5685f3cfd713..43ad68864dfa 100644 --- a/src/ILLink.Tasks/CreateRuntimeRootDescriptorFile.cs +++ b/src/ILLink.Tasks/CreateRuntimeRootDescriptorFile.cs @@ -68,7 +68,7 @@ readonly struct FeatureSwitchMembers public string FeatureValue { get; } public string FeatureDefault { get; } // Unique value to track the key - private readonly String _key; + private readonly string _key; public FeatureSwitchMembers (string feature, string featureValue, string featureDefault) { @@ -302,7 +302,7 @@ void OutputXml (string iLLinkTrimXmlFilePath, string outputFileName) { XmlDocument doc = new XmlDocument (); doc.Load (iLLinkTrimXmlFilePath); - XmlNode linkerNode = doc["linker"]; + XmlElement linkerNode = doc["linker"]; if (featureSwitchMembers.Count > 0) { foreach ((var fs, var members) in featureSwitchMembers.Select (kv => (kv.Key, kv.Value))) { @@ -344,7 +344,7 @@ void OutputXml (string iLLinkTrimXmlFilePath, string outputFileName) static void AddXmlTypeNode (XmlDocument doc, XmlNode assemblyNode, string typeName, ClassMembers members) { - XmlNode typeNode = doc.CreateElement ("type"); + XmlElement typeNode = doc.CreateElement ("type"); XmlAttribute typeFullName = doc.CreateAttribute ("fullname"); typeFullName.Value = typeName; typeNode.Attributes.Append (typeFullName);