-
Notifications
You must be signed in to change notification settings - Fork 483
Closed
Description
Castle.DynamicProxy.Generators.Emitters.DefineParameters line 162 fails if one of the parameters passed in is a nullable type with a default value of null.
To reproduce change the default value in ClassWithMethodWithParameterWithDefaultValue.Method to null.
public class ClassWithMethodWithParameterWithDefaultValue
{
public virtual void Method(int? value = null)
{ }
}
Run test MethodParameterWithDefaultValue_DefaultValueIsSetOnProxiedMethodAsWell.
[Test]
public void MethodParameterWithDefaultValue_DefaultValueIsSetOnProxiedMethodAsWell()
{
var proxiedType = generator.CreateClassProxy<ClassWithMethodWithParameterWithDefaultValue>().GetType();
var parameter = proxiedType.GetMethod("Method").GetParameters().Single(paramInfo => paramInfo.Name == "value");
Assert.True(parameter.HasDefaultValue);
Assert.AreEqual(3, parameter.DefaultValue);
}
Metadata
Metadata
Assignees
Labels
No labels