C# UWP The application called an interface that was marshalled for a different thread
<p>I have a C# UWP app that contains a function I want to call every 5 seconds.
The function runs fine when called from a button, and the Timer write to the debug console fine every 5 seconds....When I call the function from the Timer, all heck breaks loose. I get this:</p>

<p>System.Exception was unhandled by user code
HResult=-2147417842
Message=The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))</p>