You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using (var data = new DataConnection())
{
var client = new HttpClient();
var response = await client.GetStringAsync(url).ConfigureAwait(false);
data.Add(something);
}
There is a risk that C1 will fail when disposing data since we can end up on a different threadpool-thread after out await.
When this happens the stacktrace looks like this
ThreadDataManager.Current points to a different thread data object!!!
at Composite.Core.Threading.ThreadDataManager.ThreadDataManagerScope.Dispose(Boolean disposing)
at Composite.Core.Threading.ThreadDataManager.ThreadDataManagerScope.Dispose()
at Composite.Core.Implementation.DataConnectionImplementation.Dispose(Boolean disposing)
at Composite.Core.Implementation.DataConnectionImplementation.Dispose()
at Composite.Core.Implementation.ImplementationContainer`1.DisposeImplementation()
at Composite.Data.DataConnection.Dispose(Boolean disposing)
at Composite.Data.DataConnection.Dispose()
at Sermersooq.Data.CommitteeMeetingsService.<GetFutureMeetingsAsync>d__2.MoveNext() in E:\Work\Dot GL\Sermersooq\Website\code\Sermersooq\Data\CommitteeMeetingsService.cs:line 65
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Sermersooq.ActivityCalendar.CommitteeMeetingsActivityCalendarProvider.<GetActivitiesAsync>d__3.MoveNext() in E:\Work\Dot GL\Sermersooq\Website\code\Sermersooq\ActivityCalendar\CommitteeMeetingsActivityCalendarProvider.cs:line 35
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Sermersooq.ActivityCalendar.ActivityCalendarService.<GetActivitiesAsync>d__2.MoveNext() in E:\Work\Dot GL\Sermersooq\Website\code\Sermersooq\ActivityCalendar\ActivityCalendarService.cs:line 22
The text was updated successfully, but these errors were encountered:
One of the ways would be for C1 to start keeping the context in AsyncLocal, there're some issues/breaking changes with inheriting context where it should be inherited. That is something we will look into at some point
A more high-level question while we are on this subject... what are the advantages of using DataConnection over DataFacade, if any? Is there any other reason than to wrap PublicationScope and CultureInfo rather than setting DataScope manually?
Is any there difference to doing this
using (new DataScope(PublicationScope.Published))
{
DataFacade.GetData<IPage>();
}
rather than this
using (var data = new DataConnection(PublicationScope.Published))
{
data.Get<IPage>()
}
Consider the following code block
There is a risk that C1 will fail when disposing
data
since we can end up on a different threadpool-thread after out await.When this happens the stacktrace looks like this
The text was updated successfully, but these errors were encountered: