Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<linker>
<assembly fullname="System.Configuration.ConfigurationManager, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">type</property>
<property name="Target">T:System.Configuration.BaseConfigurationRecord</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">type</property>
<property name="Target">T:System.Configuration.ConfigurationElementCollection</property>
</attribute>
</assembly>
</linker>
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
<NoWarn>$(NoWarn);CA2249</NoWarn>
<!-- opt-out of trimming until it works https://github.com/dotnet/runtime/issues/49062 -->
<IsTrimmable>false</IsTrimmable>
<EnableAOTAnalyzer>false</EnableAOTAnalyzer>
<IncludeInternalObsoleteAttribute>true</IncludeInternalObsoleteAttribute>
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
Expand Down Expand Up @@ -295,4 +293,11 @@
<Reference Include="System.Configuration" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMembersAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMemberTypes.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\RequiresDynamicCodeAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\RequiresUnreferencedCodeAttribute.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;

namespace System.Configuration
Expand All @@ -16,6 +17,7 @@ public class AppSettingsReader
private static readonly Type s_stringType = typeof(string);
private const string NullString = "None";

[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
public AppSettingsReader()
{
_map = System.Configuration.ConfigurationManager.AppSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Xml;

namespace System.Configuration
{
[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
public sealed class AppSettingsSection : ConfigurationSection
{
private static volatile ConfigurationPropertyCollection s_properties;
Expand All @@ -25,9 +27,13 @@ public AppSettingsSection()
internal NameValueCollection InternalSettings
=> _keyValueCollection ??= new KeyValueInternalCollection(this);

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCodeMessage",
Justification = "Reflection access to the ConfigurationPropertyAttribute instance is covered by RequiresUnreferencedCode on the class: https://github.com/dotnet/runtime/issues/108454")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public KeyValueConfigurationCollection Settings => (KeyValueConfigurationCollection)base[s_propAppSettings];

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCodeMessage",
Justification = "Reflection access to the ConfigurationPropertyAttribute instance is covered by RequiresUnreferencedCode on the class: https://github.com/dotnet/runtime/issues/108454")]
[ConfigurationProperty("file", DefaultValue = "")]
public string File
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;

namespace System.Configuration
{
/// <summary>
/// Base settings class for client applications.
/// </summary>
[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
public abstract class ApplicationSettingsBase : SettingsBase, INotifyPropertyChanged
{
private bool _explicitSerializeOnClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Specialized;
using System.Configuration.Internal;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.Versioning;
using System.Text;
Expand All @@ -17,6 +18,7 @@ namespace System.Configuration
{
// This object represents the configuration for a request path, and is cached per-path.
[DebuggerDisplay("ConfigPath = {ConfigPath}")]
[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
internal abstract class BaseConfigurationRecord : IInternalConfigRecord
{
#if NET8_0_OR_GREATER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using System.Reflection;

namespace System.Configuration
Expand All @@ -10,6 +11,8 @@ public sealed class CallbackValidatorAttribute : ConfigurationValidatorAttribute
{
private ValidatorCallback _callbackMethod;
private string _callbackMethodName = string.Empty;

[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
private Type _type;

public override ConfigurationValidatorBase ValidatorInstance
Expand Down Expand Up @@ -42,6 +45,7 @@ public override ConfigurationValidatorBase ValidatorInstance
}
}

[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
public Type Type
{
get { return _type; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Configuration.Internal;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Net;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -32,6 +33,7 @@ internal sealed class ClientConfigurationHost : DelegatingConfigHost, IInternalC
private ExeConfigurationFileMap _fileMap; // optional file map
private bool _initComplete;

[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
internal ClientConfigurationHost()
{
Host = new InternalConfigHost();
Expand Down Expand Up @@ -423,6 +425,7 @@ private static ConfigurationUserLevel GetUserLevel(string configPath)
return level;
}

[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
internal static Configuration OpenExeConfiguration(ConfigurationFileMap fileMap, bool isMachine,
ConfigurationUserLevel userLevel, string exePath)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Configuration.Internal;
using System.Diagnostics.CodeAnalysis;
using System.Threading;

namespace System.Configuration
Expand All @@ -21,6 +22,7 @@ internal sealed class ClientConfigurationSystem : IInternalConfigSystem
private bool _isUserConfigInited;
private IInternalConfigRecord _machineConfigRecord;

[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
internal ClientConfigurationSystem()
{
IConfigSystem configSystem = new ConfigSystem();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;

namespace System.Configuration
{
/// <summary>
/// ConfigurationSection class for sections that store client settings.
/// </summary>
[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
public sealed class ClientSettingsSection : ConfigurationSection
{
private static readonly ConfigurationProperty s_propSettings = new ConfigurationProperty(null, typeof(SettingElementCollection), null, ConfigurationPropertyOptions.IsDefaultCollection);
Expand All @@ -23,6 +26,8 @@ protected internal override ConfigurationPropertyCollection Properties
}
}

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCodeMessage",
Justification = "Reflection access to the ConfigurationPropertyAttribute instance is covered by RequiresUnreferencedCode on the class: https://github.com/dotnet/runtime/issues/108454")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public SettingElementCollection Settings
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections;
using System.Configuration.Internal;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Xml;

Expand All @@ -24,6 +25,7 @@ internal sealed class ClientSettingsStore
private const string ApplicationSettingsGroupPrefix = ApplicationSettingsGroupName + "/";
private const string UserSettingsGroupPrefix = UserSettingsGroupName + "/";

[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
private static Configuration GetUserConfig(bool isRoaming)
{
ConfigurationUserLevel userLevel = isRoaming ? ConfigurationUserLevel.PerUserRoaming :
Expand All @@ -32,6 +34,7 @@ private static Configuration GetUserConfig(bool isRoaming)
return ClientSettingsConfigurationHost.OpenExeConfiguration(userLevel);
}

[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
private static ClientSettingsSection GetConfigSection(Configuration config, string sectionName, bool declare)
{
string fullSectionName = UserSettingsGroupPrefix + sectionName;
Expand All @@ -54,6 +57,7 @@ private static ClientSettingsSection GetConfigSection(Configuration config, stri

// Declares the section handler of a given section in its section group, if a declaration isn't already
// present.
[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
private static void DeclareSection(Configuration config, string sectionName)
{
ConfigurationSectionGroup settingsGroup = config.GetSectionGroup(UserSettingsGroupName);
Expand Down Expand Up @@ -82,6 +86,7 @@ private static void DeclareSection(Configuration config, string sectionName)
}
}

[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
internal static IDictionary ReadSettings(string sectionName, bool isUserScoped)
{
Hashtable settings = new Hashtable();
Expand All @@ -106,6 +111,7 @@ internal static IDictionary ReadSettings(string sectionName, bool isUserScoped)
return settings;
}

[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
internal static IDictionary ReadSettingsFromFile(string configFileName, string sectionName, bool isUserScoped)
{
Hashtable settings = new Hashtable();
Expand Down Expand Up @@ -146,11 +152,13 @@ internal static IDictionary ReadSettingsFromFile(string configFileName, string s
return settings;
}

[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
internal static ConnectionStringSettingsCollection ReadConnectionStrings()
{
return PrivilegedConfigurationManager.ConnectionStrings;
}

[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
internal static void RevertToParent(string sectionName, bool isRoaming)
{
if (!ConfigurationManagerInternalFactory.Instance.SupportsUserConfig)
Expand All @@ -169,6 +177,7 @@ internal static void RevertToParent(string sectionName, bool isRoaming)
}
}

[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
internal static void WriteSettings(string sectionName, bool isRoaming, IDictionary newSettings)
{
if (!ConfigurationManagerInternalFactory.Instance.SupportsUserConfig)
Expand Down Expand Up @@ -218,6 +227,7 @@ internal static void WriteSettings(string sectionName, bool isRoaming, IDictiona
/// A private configuration host that we use to write settings to config. We need this so we
/// can enforce a quota on the size of stuff written out.
/// </summary>
[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
private sealed class ClientSettingsConfigurationHost : DelegatingConfigHost
{
private const string ClientConfigurationHostTypeName = "System.Configuration.ClientConfigurationHost, " + TypeUtil.ConfigurationManagerAssemblyName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections;
using System.Diagnostics.CodeAnalysis;

namespace System.Configuration
{
Expand Down Expand Up @@ -29,6 +30,7 @@ internal LocationUpdates FindLocationUpdates(OverrideModeSetting overrideMode, b
}

// Add a section definition update to the correct location update.
[RequiresUnreferencedCode(ConfigurationManager.TrimWarning)]
internal DefinitionUpdate AddUpdate(OverrideModeSetting overrideMode, bool inheritInChildApps, bool moved,
string updatedXml, SectionRecord sectionRecord)
{
Expand Down
Loading
Loading