Hi, In our application we have a class called ModelContext. In this class we create a new Domain, Configuration and Session (with DisconnectedState attached). All this is done in a method call OpenSession(). In the constructor of that class the OpenSession() is called. So far everything works fine. When we close the application we get an exception with text 'Scope can't be disposed' and a hint that it could be another thread closing the scope. I've changed the Application so that we explicitly Dispose the Session, Configuration and Domain just before we end the Application. Now we don't get the exception anymore. Our suspect is that the Session formerly was closed by the GC which runs in a different thread. Can you confirm this theory? Regards Paul Sinnema Diartis AG This thread was imported from our support forum. The original discussion may contain more detailed answer. |
There is no finalizer in Domain and Session - as far as I remember, we didn't create them for any of other objects as well, since implicit finalization isn't necessary in our case. All allocated resources are already managed, i.e. if they need such finalizers, they must already have them. So this might happen because of GC only if you have your own finalizers somewhere. Other probable causes:
|