Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. VS has broken the Google

VS has broken the Google

Scheduled Pinned Locked Moved The Lounge
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marco Bertschi
    wrote on last edited by
    #1

    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

    R K P Richard DeemingR 4 Replies Last reply
    0
    • M Marco Bertschi

      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

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      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

      M 1 Reply Last reply
      0
      • M Marco Bertschi

        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

        K Offline
        K Offline
        KarstenK
        wrote on last edited by
        #3

        Looks like the exception handling is sub-optimal. X|

        Press F1 for help or google it. Greetings from Germany

        1 Reply Last reply
        0
        • M Marco Bertschi

          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

          P Offline
          P Offline
          Philippe Mori
          wrote on last edited by
          #4

          They 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

          1 Reply Last reply
          0
          • M Marco Bertschi

            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

            Richard DeemingR Offline
            Richard DeemingR Offline
            Richard Deeming
            wrote on last edited by
            #5

            OK, 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-disposed DbContext. You can either turn off lazy loading, in which case the navigation property will return null; or you can explicitly load the related entities before you dispose of the DbContext; or you can use the Include 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

            "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

            1 Reply Last reply
            0
            • R Ravi Bhavnani

              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

              M Offline
              M Offline
              Marco Bertschi
              wrote on last edited by
              #6

              Ravi Bhavnani wrote:

              But you probably knew that. :)

              I did :rolleyes:

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups