Threading bug

Revision 12827 - 2021-01-19

Issue with disappearing viewmodel columns debug Fixed.

This was really InAsyncThreadOrTheMainThreadInNonAsyncAppSoYouCanNeverGiveUp that sometimes was left to false for some parallell threads doing the file write - and this lead to Enumerations that ran into longer locks gave up - returning fewer results than they had - and this lead to file write wrote incomplete data.

The reason for enumerations ability too give up is UI. UI continues in a Async app and trust that Async thread eventually brings the missing data.

This was probably also the issue behind the failing file saves from last year when it signaled failed and asked you to try again - this error was then wrongfully "fixed" leading to this much worse error of incomplete file writes (that is now fixed)

To ensure your application is NOT in any way suffering from giving up iterations of lists due to temporary locks always set the InAsyncThreadOrTheMainThreadInNonAsyncAppSoYouCanNeverGiveUp like this:

AsyncServiceSupportThreadInfo.InAsyncThreadOrTheMainThreadInNonAsyncAppSoYouCanNeverGiveUp = true; // thread is no longer uninteruptable
public static class AsyncServiceSupportThreadInfo
{
  /// <summary>
  /// Will return true when called from a thread that is an active async-thread in an EcoSpace
  /// </summary>
  [ThreadStatic]
  public static bool InAsyncThreadOrTheMainThreadInNonAsyncAppSoYouCanNeverGiveUp = true; // in NonAsync apps - mainthread has same status as the async thread (un interuptable)
}
This page was edited 98 days ago on 02/10/2024. What links here