Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 6c35fd0

Browse files
Alexjkotas
authored andcommitted
Allow ByRef return types in Dynamic Method (#15106)
* Allow ByRef return types in Dynamic Method * Additional cleanup
1 parent a0e1b1e commit 6c35fd0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/mscorlib/Resources/Strings.resx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@
413413
<value>Search pattern '{0}' cannot contain ".." to move up directories and can be contained only internally in file/directory names, as in "a..b".</value>
414414
</data>
415415
<data name="Arg_InvalidTypeInRetType" xml:space="preserve">
416-
<value>The return Type contains some invalid type (i.e. null, ByRef)</value>
416+
<value>The return Type must be a type provided by the runtime.</value>
417417
</data>
418418
<data name="Arg_InvalidTypeInSignature" xml:space="preserve">
419419
<value>The signature Type array contains some invalid type (i.e. null, void)</value>
@@ -3685,7 +3685,7 @@
36853685
<data name="NotSupported_SignatureType" xml:space="preserve">
36863686
<value>This method is not supported on signature types.</value>
36873687
</data>
3688-
<data name="Memory_ThrowIfDisposed" xml:space="preserve">
3688+
<data name="Memory_ThrowIfDisposed" xml:space="preserve">
36893689
<value>Memory&lt;T&gt; has been disposed.</value>
36903690
</data>
36913691
<data name="Memory_OutstandingReferences" xml:space="preserve">
@@ -3700,4 +3700,4 @@
37003700
<data name="Arg_TypeNotSupported" xml:space="preserve">
37013701
<value>Specified type is not supported</value>
37023702
</data>
3703-
</root>
3703+
</root>

src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ private unsafe void Init(String name,
286286
if (signature[i] == null)
287287
throw new ArgumentException(SR.Arg_InvalidTypeInSignature);
288288
m_parameterTypes[i] = signature[i].UnderlyingSystemType as RuntimeType;
289-
if (m_parameterTypes[i] == null || !(m_parameterTypes[i] is RuntimeType) || m_parameterTypes[i] == (RuntimeType)typeof(void))
289+
if (m_parameterTypes[i] == null || m_parameterTypes[i] == (RuntimeType)typeof(void))
290290
throw new ArgumentException(SR.Arg_InvalidTypeInSignature);
291291
}
292292
}
@@ -297,7 +297,7 @@ private unsafe void Init(String name,
297297

298298
// check and store the return value
299299
m_returnType = (returnType == null) ? (RuntimeType)typeof(void) : returnType.UnderlyingSystemType as RuntimeType;
300-
if ((m_returnType == null) || !(m_returnType is RuntimeType) || m_returnType.IsByRef)
300+
if (m_returnType == null)
301301
throw new NotSupportedException(SR.Arg_InvalidTypeInRetType);
302302

303303
if (transparentMethod)

0 commit comments

Comments
 (0)