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.


Databases
published
v.0.01



708 said:

708

Posted On: March 21, 2020 22:15:34 PM

© 2024 - ErnesTech - Privacy
E-Commerce Return Policy