Stack overflow when recursing reference properties in a WPF Window

Jul 3 2024 5:26 AM

Can someone tell me why the following is legal when accessing an object of type WPF Window?

var win = new Window();
var x = win.Background.Transform.Inverse.Inverse.Inverse.Inverse.Inverse;  // ...goes on forever

I am trying to generate a recursive list of references for an object of type Window and when I get to Background.Transform.Inverse, I keep getting a pointer to another Inverse property.  This goes on forever and eventually I get a stack overflow error.  The value of Inverse is always {Identity}.

Thanks for any insight you can provide.


Answers (1)