canton7 / Stylet

A very lightweight but powerful ViewModel-First MVVM framework for WPF for .NET Framework and .NET Core, inspired by Caliburn.Micro.
MIT License
988 stars 143 forks source link

Add logging for AmbiguousMatchException #162

Closed taks closed 3 years ago

taks commented 3 years ago

In Action, if there are multiple methods, AmbiguousMatchException will occur, but I don't know which method is duplicated. Therefore, I add logging of AmbiguousMatchException.

canton7 commented 3 years ago

Thanks!

However, there's a problem over in AssertTargetSet: if there's an ambiguous match, they'll still get an exception saying that we were unable to find the method, which won't be true. I'd be tempted to continue to throw an exception in this case (we can probably still get away with using an ActionNotSetException), but perhaps make the message clearer, and add a log message as well (this.logger.Error(e)). What do you think?

taks commented 3 years ago

Thank you for your review. I modified the program to change message AmbiguousMatchException message and throw the exception.

canton7 commented 3 years ago

Thanks!