<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\CustomAttributeBuilder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\DynamicILGenerator.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\DynamicMethod.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\EmptyCAHolder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\EnumBuilder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\EventBuilder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\FieldBuilder.cs" />
get { return new RuntimeParameterInfo(this, null, m_owner.m_returnType, -1); }
}
- public override ICustomAttributeProvider ReturnTypeCustomAttributes
- {
- get { return GetEmptyCAHolder(); }
- }
-
- //
- // private implementation
- //
+ public override ICustomAttributeProvider ReturnTypeCustomAttributes => new EmptyCAHolder();
internal RuntimeParameterInfo[] LoadParameters()
{
}
return m_parameters;
}
-
- // private implementation of CA for the return type
- private ICustomAttributeProvider GetEmptyCAHolder()
- {
- return new EmptyCAHolder();
- }
-
- ///////////////////////////////////////////////////
- // EmptyCAHolder
- private class EmptyCAHolder : ICustomAttributeProvider
- {
- internal EmptyCAHolder() { }
-
- object[] ICustomAttributeProvider.GetCustomAttributes(Type attributeType, bool inherit)
- {
- return Array.Empty<object>();
- }
-
- object[] ICustomAttributeProvider.GetCustomAttributes(bool inherit)
- {
- return Array.Empty<object>();
- }
-
- bool ICustomAttributeProvider.IsDefined(Type attributeType, bool inherit)
- {
- return false;
- }
- }
}
}
}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Reflection.Emit
+{
+ internal class EmptyCAHolder : ICustomAttributeProvider
+ {
+ internal EmptyCAHolder() { }
+
+ object[] ICustomAttributeProvider.GetCustomAttributes(Type attributeType, bool inherit) => Array.Empty<object>();
+
+ object[] ICustomAttributeProvider.GetCustomAttributes(bool inherit) => Array.Empty<object>();
+
+ bool ICustomAttributeProvider.IsDefined(Type attributeType, bool inherit) => false;
+ }
+}
}
}
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
- public override ICustomAttributeProvider? ReturnTypeCustomAttributes
- {
- get
- {
- return null;
- }
- }
-#pragma warning restore CS8609
+ public override ICustomAttributeProvider ReturnTypeCustomAttributes => new EmptyCAHolder();
public override Type? ReflectedType
{
}
}
-#pragma warning disable CS8609 // TODO-NULLABLE: Covariant return types (https://github.com/dotnet/roslyn/issues/23268)
- public override ICustomAttributeProvider? ReturnTypeCustomAttributes
- {
- get { return null; }
- }
-#pragma warning restore CS8608
+ public override ICustomAttributeProvider ReturnTypeCustomAttributes => new EmptyCAHolder();
public override object Invoke(object? obj, BindingFlags invokeAttr, Binder? binder, object?[]? parameters, CultureInfo? culture)
{
satAssemName += ", Version=" + _mediator.SatelliteContractVersion.ToString();
}
- byte[] token = _mediator.MainAssembly.GetName().GetPublicKeyToken()!;
-
- int iLen = token.Length;
- StringBuilder publicKeyTok = new StringBuilder(iLen * 2);
- for (int i = 0; i < iLen; i++)
+ byte[]? token = _mediator.MainAssembly.GetName().GetPublicKeyToken();
+ if (token != null)
{
- publicKeyTok.Append(token[i].ToString("x", CultureInfo.InvariantCulture));
+ int iLen = token.Length;
+ StringBuilder publicKeyTok = new StringBuilder(iLen * 2);
+ for (int i = 0; i < iLen; i++)
+ {
+ publicKeyTok.Append(token[i].ToString("x", CultureInfo.InvariantCulture));
+ }
+ satAssemName += ", PublicKeyToken=" + publicKeyTok;
}
- satAssemName += ", PublicKeyToken=" + publicKeyTok;
Debug.Assert(_mediator.NeutralResourcesCulture != null);
string missingCultureName = _mediator.NeutralResourcesCulture.Name;