This problem only occurs in debug mode, it works perfectly fine in Release mode.
When I try to use loadlayout, I get an error that the imageview inside my layout must first be initialised, but since this is a designer added view, it should not need initialisation, right?
Could it be a number...