Solved!! Dot Net Core 3.1 Error: Inspecting the state of an object in the debuggee of type System.Reflection.MethodBase is not supported in this context



Problem: Dot Net Core (.Net Core ) 3.1 Error: Inspecting the state of an object in the debuggee of type System.Reflection.MethodBase is not supported in this context.

 

Solution: Make sure that you are consistent with the type of collection you are using at the Server side and the View Side. For Example, if you are passing the collection of data using a ViewBag holding an IEnumerableAsynch object of collection, then the variable that will recieve the data from the ViewBag should be of type IEnumerable.

//Server Side
IEnumerable<AnotherObjectName> SomeDataCollection = _context.AnotherObjectName.FromSqlRaw("EXECUTE dbo.NameOfProc {0}", Parameter).AsEnumerable();
  IAsyncEnumerable<ObjectName> SomeDataFromAnotherCollection= _context.ObjectName.FromSqlRaw("NameOfStoreProc").AsAsyncEnumerable();
 ViewBag.RandomName= SomeDataFromAnotherCollection;
 return View(SomeDataCollection);


//View Side
@model IEnumerable<ProjectName.ModelsFolder.ObjectName>
//Do the Logic with the Model Data
  @{
        
        var list = @ViewBag.RandomName;
        
        }
    @await Component.InvokeAsync("YourBelovedComponent",@list)


- This error is also most likely to happen when you access the context on the Server side muiltiple times in a row and expect the result of the requested collection to be available on the View side without awaiting the Task/Thread to complete quering the data. 

- Your situetion might be different, what is important is to know the basis of the operation.

Was this page helpful?
Yes Yes! this solution to the problem was helpful. No No! this solution to the problem was not helpful.. Leave ErnesTech Feedback.Feedback

Other users would like to know if this solution helped you.

708 said:

708

Your Session is Ending
Login to Continue


© 2021 - ErnesTech - Privacy