문제

I have a controller that takes multiple arguments and I am using Unity to create an instance of that controller. The problem is that under certain circumstances Unity is not able to build all of the objects that are needed for my constructor so it throws an Exception.

[MissingMethodException: No parameterless constructor defined for this object.]

How do I handle this error and show a custom error page to the user?

도움이 되었습니까?

해결책

Don't handle that error, either create parameterless constructors for said objects that are instantiated, or don't create them in the constructor. Handling those exceptions would just be masking the issue.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top