As FelixCastor suggested, I checked the thread in which the function I’m calling is running and did not run on the same thread. The change I made in the code was very small.
I declared the dispatcher in the code section that I know will be executed by the main thread.
public static Dispatcher dispatcher = Dispatcher.CurrentDispatcher;
I did this because, according to the dοcumentation the dispatcher will “run” on the thread that is declared. So if I wanted to run the function on the main thread, I had to declared it there. Then i wrote this simple line of code that forces the ActionOffering function to run on the dispatcher (main) thread.
dispatcher.BeginInvoke(new InvokeDelegate(ActionOffering));
solved Events corrupts the result of the function