VS has broken the Google
-
Alas, I got work with the beautiful Entity Framework. As I'm trying to copy the exception details
System.ObjectDisposedException was unhandled
HResult=-2146232798
Message=Die ObjectContext-Instanz wurde verworfen und kann nicht mehr für Vorgänge verwendet werden, für die eine Verbindung erforderlich ist.
ObjectName=""
Source=EntityFramework
StackTrace:
bei System.Data.Entity.Core.Objects.ObjectContext.get_Connection()
bei System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
bei System.Data.Entity.Core.Objects.DataClasses.EntityCollection`1.Load(List`1 collection, MergeOption mergeOption)
bei System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.DeferredLoad()
bei System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.LoadProperty[TItem](TItem propertyValue, String relationshipName, String targetRoleName, Boolean mustBeNull, Object wrapperObject)
bei System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.<>c__DisplayClass7`2.<GetInterceptorDelegate>b__1(TProxy proxy, TItem item)
bei System.Data.Entity.DynamicProxies.Abstimmungungswochen_4B2170BEEFBCB0E3760C0A28F933A214FEE1AF613CEA6B3CD7752FA43966F7F3.get_Stimmzettel()
bei SuisseVote.Business.DomainModel.Urnengang..ctor(Abstimmungungswochenende a) in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.DomainModel\Urnengang.cs:Zeile 57.
bei SuisseVote.Business.Shared.Repository.UrnengangRepository.<>c.<GetListAll>b__6_0(Abstimmungungswochenende c) in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.Shared\Repository\UrnengangRepository.cs:Zeile 35.
bei System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
bei SuisseVote.Business.Shared.Repository.UrnengangRepository.GetListAll() in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.Shared\Repository\UrnengangRepository.cs:Zeile 35.
bei SuisseVote.Business.Center.Repository.UrnengangRepository.GetListAll() in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.BusinessLayer\Repository\UrnengangRepository.cs:Zeile 86.
bei SuisseVote.Ui.Center.OpenUrnengangControl.UserControl_Loaded(Object send -
Alas, I got work with the beautiful Entity Framework. As I'm trying to copy the exception details
System.ObjectDisposedException was unhandled
HResult=-2146232798
Message=Die ObjectContext-Instanz wurde verworfen und kann nicht mehr für Vorgänge verwendet werden, für die eine Verbindung erforderlich ist.
ObjectName=""
Source=EntityFramework
StackTrace:
bei System.Data.Entity.Core.Objects.ObjectContext.get_Connection()
bei System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
bei System.Data.Entity.Core.Objects.DataClasses.EntityCollection`1.Load(List`1 collection, MergeOption mergeOption)
bei System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.DeferredLoad()
bei System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.LoadProperty[TItem](TItem propertyValue, String relationshipName, String targetRoleName, Boolean mustBeNull, Object wrapperObject)
bei System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.<>c__DisplayClass7`2.<GetInterceptorDelegate>b__1(TProxy proxy, TItem item)
bei System.Data.Entity.DynamicProxies.Abstimmungungswochen_4B2170BEEFBCB0E3760C0A28F933A214FEE1AF613CEA6B3CD7752FA43966F7F3.get_Stimmzettel()
bei SuisseVote.Business.DomainModel.Urnengang..ctor(Abstimmungungswochenende a) in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.DomainModel\Urnengang.cs:Zeile 57.
bei SuisseVote.Business.Shared.Repository.UrnengangRepository.<>c.<GetListAll>b__6_0(Abstimmungungswochenende c) in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.Shared\Repository\UrnengangRepository.cs:Zeile 35.
bei System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
bei SuisseVote.Business.Shared.Repository.UrnengangRepository.GetListAll() in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.Shared\Repository\UrnengangRepository.cs:Zeile 35.
bei SuisseVote.Business.Center.Repository.UrnengangRepository.GetListAll() in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.BusinessLayer\Repository\UrnengangRepository.cs:Zeile 86.
bei SuisseVote.Ui.Center.OpenUrnengangControl.UserControl_Loaded(Object sendIt has nothing to do with MS. Google search is rejecting your query because the search text is too large. But you probably knew that. :) /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
Alas, I got work with the beautiful Entity Framework. As I'm trying to copy the exception details
System.ObjectDisposedException was unhandled
HResult=-2146232798
Message=Die ObjectContext-Instanz wurde verworfen und kann nicht mehr für Vorgänge verwendet werden, für die eine Verbindung erforderlich ist.
ObjectName=""
Source=EntityFramework
StackTrace:
bei System.Data.Entity.Core.Objects.ObjectContext.get_Connection()
bei System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
bei System.Data.Entity.Core.Objects.DataClasses.EntityCollection`1.Load(List`1 collection, MergeOption mergeOption)
bei System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.DeferredLoad()
bei System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.LoadProperty[TItem](TItem propertyValue, String relationshipName, String targetRoleName, Boolean mustBeNull, Object wrapperObject)
bei System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.<>c__DisplayClass7`2.<GetInterceptorDelegate>b__1(TProxy proxy, TItem item)
bei System.Data.Entity.DynamicProxies.Abstimmungungswochen_4B2170BEEFBCB0E3760C0A28F933A214FEE1AF613CEA6B3CD7752FA43966F7F3.get_Stimmzettel()
bei SuisseVote.Business.DomainModel.Urnengang..ctor(Abstimmungungswochenende a) in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.DomainModel\Urnengang.cs:Zeile 57.
bei SuisseVote.Business.Shared.Repository.UrnengangRepository.<>c.<GetListAll>b__6_0(Abstimmungungswochenende c) in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.Shared\Repository\UrnengangRepository.cs:Zeile 35.
bei System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
bei SuisseVote.Business.Shared.Repository.UrnengangRepository.GetListAll() in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.Shared\Repository\UrnengangRepository.cs:Zeile 35.
bei SuisseVote.Business.Center.Repository.UrnengangRepository.GetListAll() in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.BusinessLayer\Repository\UrnengangRepository.cs:Zeile 86.
bei SuisseVote.Ui.Center.OpenUrnengangControl.UserControl_Loaded(Object send -
Alas, I got work with the beautiful Entity Framework. As I'm trying to copy the exception details
System.ObjectDisposedException was unhandled
HResult=-2146232798
Message=Die ObjectContext-Instanz wurde verworfen und kann nicht mehr für Vorgänge verwendet werden, für die eine Verbindung erforderlich ist.
ObjectName=""
Source=EntityFramework
StackTrace:
bei System.Data.Entity.Core.Objects.ObjectContext.get_Connection()
bei System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
bei System.Data.Entity.Core.Objects.DataClasses.EntityCollection`1.Load(List`1 collection, MergeOption mergeOption)
bei System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.DeferredLoad()
bei System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.LoadProperty[TItem](TItem propertyValue, String relationshipName, String targetRoleName, Boolean mustBeNull, Object wrapperObject)
bei System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.<>c__DisplayClass7`2.<GetInterceptorDelegate>b__1(TProxy proxy, TItem item)
bei System.Data.Entity.DynamicProxies.Abstimmungungswochen_4B2170BEEFBCB0E3760C0A28F933A214FEE1AF613CEA6B3CD7752FA43966F7F3.get_Stimmzettel()
bei SuisseVote.Business.DomainModel.Urnengang..ctor(Abstimmungungswochenende a) in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.DomainModel\Urnengang.cs:Zeile 57.
bei SuisseVote.Business.Shared.Repository.UrnengangRepository.<>c.<GetListAll>b__6_0(Abstimmungungswochenende c) in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.Shared\Repository\UrnengangRepository.cs:Zeile 35.
bei System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
bei SuisseVote.Business.Shared.Repository.UrnengangRepository.GetListAll() in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.Shared\Repository\UrnengangRepository.cs:Zeile 35.
bei SuisseVote.Business.Center.Repository.UrnengangRepository.GetListAll() in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.BusinessLayer\Repository\UrnengangRepository.cs:Zeile 86.
bei SuisseVote.Ui.Center.OpenUrnengangControl.UserControl_Loaded(Object sendThey are far more chance that the problem is in your own code... An object seems to be disposed twice! Maybe your connection? Maybe your code does not properly handle some events that occurs in a way you did not expect?
Philippe Mori
-
Alas, I got work with the beautiful Entity Framework. As I'm trying to copy the exception details
System.ObjectDisposedException was unhandled
HResult=-2146232798
Message=Die ObjectContext-Instanz wurde verworfen und kann nicht mehr für Vorgänge verwendet werden, für die eine Verbindung erforderlich ist.
ObjectName=""
Source=EntityFramework
StackTrace:
bei System.Data.Entity.Core.Objects.ObjectContext.get_Connection()
bei System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
bei System.Data.Entity.Core.Objects.DataClasses.EntityCollection`1.Load(List`1 collection, MergeOption mergeOption)
bei System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.DeferredLoad()
bei System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.LoadProperty[TItem](TItem propertyValue, String relationshipName, String targetRoleName, Boolean mustBeNull, Object wrapperObject)
bei System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.<>c__DisplayClass7`2.<GetInterceptorDelegate>b__1(TProxy proxy, TItem item)
bei System.Data.Entity.DynamicProxies.Abstimmungungswochen_4B2170BEEFBCB0E3760C0A28F933A214FEE1AF613CEA6B3CD7752FA43966F7F3.get_Stimmzettel()
bei SuisseVote.Business.DomainModel.Urnengang..ctor(Abstimmungungswochenende a) in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.DomainModel\Urnengang.cs:Zeile 57.
bei SuisseVote.Business.Shared.Repository.UrnengangRepository.<>c.<GetListAll>b__6_0(Abstimmungungswochenende c) in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.Shared\Repository\UrnengangRepository.cs:Zeile 35.
bei System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
bei SuisseVote.Business.Shared.Repository.UrnengangRepository.GetListAll() in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.Shared\Repository\UrnengangRepository.cs:Zeile 35.
bei SuisseVote.Business.Center.Repository.UrnengangRepository.GetListAll() in C:\Workspaces\SuisseVote\SwissVote\SuisseVote-2_1_Update_3_Happy Feet\SuisseVote.Business.BusinessLayer\Repository\UrnengangRepository.cs:Zeile 86.
bei SuisseVote.Ui.Center.OpenUrnengangControl.UserControl_Loaded(Object sendOK, time for a random guess of what your code looks like:
public Foo GetFoo(int id)
{
using (var context = new YourDbContext())
{
return context.Foos.FirstOrDefault(foo => foo.Id == id);
}
}
...
Foo foo = GetFoo(42);
Bar bar = foo.Bar;You've retrieved an entity instance without loading any of its related entities. You've then disposed of the
DbContext
before trying to load a related entity. The lazy-loading proxy that EF created for your entity is then trying to load the related entity from the database, using the previously-disposedDbContext
. You can either turn off lazy loading, in which case the navigation property will returnnull
; or you can explicitly load the related entities before you dispose of theDbContext
; or you can use theInclude
extension method to eagerly load the related entities at the same time as the main entity. Entity Framework Loading Related Entities[^] And now, you've managed to sneak a programming question into the Lounge! :laugh:
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
It has nothing to do with MS. Google search is rejecting your query because the search text is too large. But you probably knew that. :) /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
Ravi Bhavnani wrote:
But you probably knew that. :)
I did :rolleyes: