Hi, I have a bug with DataObject System.ServiceModel.FaultException: System.ObjectDisposedException: Cannot access a disposed object. \n

Call stack:

Object name: 'Session is already disposed.'. at Xtensive.Orm.Session.EnsureNotDisposed() at Xtensive.Orm.Providers.SqlSessionHandler.Prepare() at Xtensive.Orm.Providers.SqlSessionHandler.ExecuteQueryTasks(IEnumerable1 queryTasks, Boolean allowPartialExecution) at Xtensive.Orm.Session.ProcessInternalDelayedQueries(Boolean allowPartialExecution) at Xtensive.Orm.Internals.Prefetch.Fetcher.ExecuteTasks(IEnumerable1 containers, Boolean skipPersist) at Xtensive.Orm.Internals.Prefetch.PrefetchManager.ExecuteTasks(Boolean skipPersist) at Xtensive.Orm.Providers.SqlSessionHandler.FetchEntityState(Key key) at Xtensive.Orm.QueryEndpoint.SingleOrDefault(Key key) at Serensia.Pilot.Business.Security.UserPrincipal.GetCurrentUserPrincipal()

The method that is concerned by the callstack:

public static UserPrincipal GetCurrentUserPrincipal() { IUserIdentity userIdentity = Agent.Current.GetKernelModule<isecuritymodule> ().GetCurrentIdentity(); if (userIdentity != null && !String.IsNullOrEmpty(userIdentity.PersistentUserKey)) { Key doKey = Key.Parse(Domain.Current, userIdentity.PersistentUserKey); UserPrincipal userPrincipal = Session.Current.Query.SingleOrDefault<userprincipal> (doKey); return userPrincipal; } return null; }

asked Sep 25 '20 at 04:35

Makertoo's gravatar image


edited Sep 25 '20 at 04:39

One Answer:

Hello Makertoo,

Obviously the session was disposed but there is a reference to it. Since you use session activation please check for correct disposing of activations, use usings where possible and manual dispose for the rest of cases.

answered Sep 25 '20 at 08:14

Alexey%20Kulakov's gravatar image

Alexey Kulakov

edited Sep 25 '20 at 08:18

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA