I have the following setup. I create a number of objects in XAML as resources, and specify parameters to them, which I then process in code. If something is wrong with the parameters, I want (for debugging purposes) to tell, which object is set up wrongly. For this I'd like to send, along with the exception, the resource key, which identifies this object. Can this be done?
Something like this (VB code):
Throw New ArgumentException("Wrong parameter 1 in object " & SOMETHING_GOES_HERE.ResourceKey)
Mikhail