diff --git a/src/Spring/Spring.Aop/Aspects/Exceptions/ExceptionHandlerAdvice.cs b/src/Spring/Spring.Aop/Aspects/Exceptions/ExceptionHandlerAdvice.cs index f089ebb3..5d0cf6d6 100644 --- a/src/Spring/Spring.Aop/Aspects/Exceptions/ExceptionHandlerAdvice.cs +++ b/src/Spring/Spring.Aop/Aspects/Exceptions/ExceptionHandlerAdvice.cs @@ -185,7 +185,7 @@ namespace Spring.Aspects.Exceptions else { Type returnType = invocation.Method.ReturnType; - return returnType.IsValueType ? Activator.CreateInstance(returnType) : null; + return returnType.IsValueType && !returnType.Equals(typeof(void))? Activator.CreateInstance(returnType) : null; } } } diff --git a/test/Spring/Spring.Aop.Tests/Aspects/Exception/ExceptionHandlerAspectIntegrationTests.cs b/test/Spring/Spring.Aop.Tests/Aspects/Exception/ExceptionHandlerAspectIntegrationTests.cs index ba6fbed6..d6e89750 100644 --- a/test/Spring/Spring.Aop.Tests/Aspects/Exception/ExceptionHandlerAspectIntegrationTests.cs +++ b/test/Spring/Spring.Aop.Tests/Aspects/Exception/ExceptionHandlerAspectIntegrationTests.cs @@ -309,9 +309,9 @@ namespace Spring.Aspects.Exceptions try { to.Exceptional(new ArithmeticException("Bad Math")); - } catch (Exception) + } catch (Exception e) { - Assert.Fail("Should not have thrown exception"); + Assert.Fail("Should not have thrown exception" + e); } }