Skip to content

Commit 6fd4019

Browse files
Stop using LocalizationResources within framework (#86430)
Fixes #81459. I moved the messages to `EventAttribute.Message` which I believe should be equivalent, but I would appreciate if someone could double-check. I also removed all the now-unused resource strings. I believe they all need to be prefixed by one of well-known prefixes. I would appreciate if someone could double-check.
1 parent 6a02ab2 commit 6fd4019

File tree

20 files changed

+21
-76
lines changed

20 files changed

+21
-76
lines changed

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/CustomAttributeBasedDependencyAlgorithm.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -137,25 +137,6 @@ private static void AddDependenciesDueToCustomAttributes(ref DependencyList depe
137137
dependencies.AddRange(caDependencies);
138138
dependencies.Add(factory.CustomAttributeMetadata(new ReflectableCustomAttribute(module, caHandle)), "Attribute metadata");
139139
}
140-
141-
// Works around https://github.com/dotnet/runtime/issues/81459
142-
if (constructor.OwningType is MetadataType { Name: "EventSourceAttribute" } eventSourceAttributeType)
143-
{
144-
foreach (var namedArg in decodedValue.NamedArguments)
145-
{
146-
if (namedArg.Name == "LocalizationResources" && namedArg.Value is string resName
147-
&& InlineableStringsResourceNode.IsInlineableStringsResource(module, resName + ".resources"))
148-
{
149-
dependencies ??= new DependencyList();
150-
var accessorMethod = module.GetType(
151-
InlineableStringsResourceNode.ResourceAccessorTypeNamespace,
152-
InlineableStringsResourceNode.ResourceAccessorTypeName)
153-
.GetMethod(InlineableStringsResourceNode.ResourceAccessorGetStringMethodName, null);
154-
dependencies.Add(factory.ReflectedMethod(accessorMethod), "EventSource used resource");
155-
}
156-
}
157-
}
158-
// End of workaround for https://github.com/dotnet/runtime/issues/81459
159140
}
160141
catch (TypeSystemException)
161142
{

src/libraries/Common/src/System/Net/Security/NetEventSource.Security.Windows.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private void AcceptSecurityContext(string credential, string context, Interop.Ss
6060

6161
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
6262
Justification = "parameter errorCode is an enum and is trimmer safe")]
63-
[Event(OperationReturnedSomethingId, Keywords = Keywords.Default, Level = EventLevel.Informational)]
63+
[Event(OperationReturnedSomethingId, Keywords = Keywords.Default, Level = EventLevel.Informational, Message = "{0} returned {1}.")]
6464
public void OperationReturnedSomething(string operation, Interop.SECURITY_STATUS errorCode) =>
6565
WriteEvent(OperationReturnedSomethingId, operation, errorCode);
6666

src/libraries/System.Collections.Concurrent/src/System/Collections/Concurrent/CDSCollectionETWBCLProvider.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ namespace System.Collections.Concurrent
2121
[EventSource(
2222
Name = "System.Collections.Concurrent.ConcurrentCollectionsEventSource",
2323
Guid = "35167F8E-49B2-4b96-AB86-435B59336B5E"
24-
//TODO:Bug455853:Add support for reading localized string in the EventSource il2il transform
25-
//,LocalizationResources = "mscorlib"
2624
)]
2725
internal sealed class CDSCollectionETWBCLProvider : EventSource
2826
{

src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/PLINQETWProvider.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ namespace System.Linq.Parallel
2222
[EventSource(
2323
Name = "System.Linq.Parallel.PlinqEventSource",
2424
Guid = "159eeeec-4a14-4418-a8fe-faabcd987887")]
25-
/* LocalizationResources = "System.Linq")]*/
2625
internal sealed class PlinqEtwProvider : EventSource
2726
{
2827
/// <summary>

src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/NetEventSource.WinHttpHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55

66
namespace System.Net
77
{
8-
[EventSource(Name = "Private.InternalDiagnostics.System.Net.Http.WinHttpHandler", LocalizationResources = "FxResources.System.Net.Http.WinHttpHandler.SR")]
8+
[EventSource(Name = "Private.InternalDiagnostics.System.Net.Http.WinHttpHandler")]
99
internal sealed partial class NetEventSource { }
1010
}

src/libraries/System.Net.Http/src/Resources/Strings.resx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,6 @@
423423
<data name="net_MethodNotImplementedException" xml:space="preserve">
424424
<value>This method is not implemented by this class.</value>
425425
</data>
426-
<data name="event_OperationReturnedSomething" xml:space="preserve">
427-
<value>{0} returned {1}.</value>
428-
</data>
429426
<data name="net_log_operation_failed_with_error" xml:space="preserve">
430427
<value>{0} failed with error {1}.</value>
431428
</data>

src/libraries/System.Net.Http/src/System/Net/Http/NetEventSource.Http.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace System.Net
99
{
10-
[EventSource(Name = "Private.InternalDiagnostics.System.Net.Http", LocalizationResources = "FxResources.System.Net.Http.SR")]
10+
[EventSource(Name = "Private.InternalDiagnostics.System.Net.Http")]
1111
internal sealed partial class NetEventSource
1212
{
1313
private const int UriBaseAddressId = NextAvailableEventId;

src/libraries/System.Net.HttpListener/src/Resources/Strings.resx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,6 @@
350350
<data name="net_MethodNotImplementedException" xml:space="preserve">
351351
<value>This method is not implemented by this class.</value>
352352
</data>
353-
<data name="event_OperationReturnedSomething" xml:space="preserve">
354-
<value>{0} returned {1}.</value>
355-
</data>
356353
<data name="net_invalid_enum" xml:space="preserve">
357354
<value>The specified value is not valid in the '{0}' enumeration.</value>
358355
</data>

src/libraries/System.Net.HttpListener/src/System/Net/NetEventSource.HttpListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55

66
namespace System.Net
77
{
8-
[EventSource(Name = "Private.InternalDiagnostics.System.Net.HttpListener", LocalizationResources = "FxResources.System.Net.HttpListener.SR")]
8+
[EventSource(Name = "Private.InternalDiagnostics.System.Net.HttpListener")]
99
internal sealed partial class NetEventSource { }
1010
}

src/libraries/System.Net.Mail/src/Resources/Strings.resx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@
7070
<data name="net_MethodNotImplementedException" xml:space="preserve">
7171
<value>This method is not implemented by this class.</value>
7272
</data>
73-
<data name="event_OperationReturnedSomething" xml:space="preserve">
74-
<value>{0} returned {1}.</value>
75-
</data>
7673
<data name="net_context_buffer_too_small" xml:space="preserve">
7774
<value>Insufficient buffer space. Required: {0} Actual: {1}.</value>
7875
</data>

0 commit comments

Comments
 (0)