Skip to content

Commit

Permalink
Fix some linker annotations in S.CM.TypeConverter
Browse files Browse the repository at this point in the history
  • Loading branch information
Prashanth Govindarajan committed Apr 1, 2021
1 parent 5e79b4f commit 47fa9a8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 116 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<linker>
<assembly fullname="System.ComponentModel.TypeConverter, PublicKeyToken=b03f5f7f11d50a3a">
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">member</property>
<property name="Target">M:System.ComponentModel.Design.DesigntimeLicenseContextSerializer.SerializeWithBinaryFormatter(System.IO.Stream,System.String,System.ComponentModel.Design.DesigntimeLicenseContext)</property>
<property name="Justification">This warning is left in the product so developers get an ILLink warning when trimming an app with System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization=true.</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">member</property>
<property name="Target">M:System.ComponentModel.Design.DesigntimeLicenseContextSerializer.DeserializeUsingBinaryFormatter(System.ComponentModel.Design.DesigntimeLicenseContextSerializer.StreamWrapper,System.String,System.ComponentModel.Design.RuntimeLicenseContext)</property>
<property name="Justification">This warning is left in the product so developers get an ILLink warning when trimming an app with System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization=true.</property>
</attribute>
</assembly>
</linker
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ public static void Serialize(Stream o, string cryptoKey, DesigntimeLicenseContex
}
}

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "Only simple types (string and HashTable) are serialized with BinaryFormatter. These types can be serialized in a trimmed application.")]
private static void SerializeWithBinaryFormatter(Stream o, string cryptoKey, DesigntimeLicenseContext context)
{
IFormatter formatter = new BinaryFormatter();
Expand Down Expand Up @@ -127,9 +125,6 @@ private static bool StreamIsBinaryFormatted(StreamWrapper stream)
return true;
}

[DynamicDependency(DynamicallyAccessedMemberTypes.NonPublicConstructors, typeof(Hashtable))]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "HashTable's Serialization ctor will be preserved by the DynamicDependency.")]
private static void DeserializeUsingBinaryFormatter(StreamWrapper wrappedStream, string cryptoKey, RuntimeLicenseContext context)
{
if (EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@

<ItemGroup>
<TestConsoleAppSourceFiles Include="ComObjectTypeTest.cs" />
<TestConsoleAppSourceFiles Include="DesigntimeLicenseContextSerialization_Serialize.cs" TrimmerRootAssemblies="mscorlib">
<ExtraTrimmerArgs>--feature System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization true</ExtraTrimmerArgs>
<AdditionalSourceFiles>DesigntimeLicenseContextSerialization_Stream.cs</AdditionalSourceFiles>
<!-- Justification: BinaryFormatter is not available on wasm-->
<SkipOnTestRuntimes>browser-wasm</SkipOnTestRuntimes>
</TestConsoleAppSourceFiles>
<TestConsoleAppSourceFiles Include="DesigntimeLicenseContextSerialization_Deserialize.cs" TrimmerRootAssemblies="mscorlib">
<ExtraTrimmerArgs>--feature System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization true</ExtraTrimmerArgs>
<AdditionalSourceFiles>DesigntimeLicenseContextSerialization_Stream.cs</AdditionalSourceFiles>
<!-- Justification: BinaryFormatter is not available on wasm-->
<SkipOnTestRuntimes>browser-wasm</SkipOnTestRuntimes>
</TestConsoleAppSourceFiles>
<TestConsoleAppSourceFiles Include="InterfaceTypeTest.cs" />
<TestConsoleAppSourceFiles Include="TypeConverterIsReadOnly.cs" />
<TestConsoleAppSourceFiles Include="TypeConverterTest.cs" />
Expand Down

0 comments on commit 47fa9a8

Please sign in to comment.