When you have LazyLoading() enabled on an EF context, the grid throws errors similar to
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.NotImplementedException: This is a DynamicProxy2 error: The interceptor attempted to 'Proceed' for method 'Void set_LazyLoader(Microsoft.EntityFrameworkCore.Infrastructure.ILazyLoader)' which has no target.
Here is a sample of the service registration that causes the issue
services.AddDbContext<ApplicationDbContext>(options =>
options
.UseLazyLoadingProxies()
.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")), ServiceLifetime.Transient);
Here is the full stack trace
Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Blazor.Components.Grid.GridContentCell`1.get_PropInfo()
at Telerik.Blazor.Components.Grid.GridContentCell`1.get_Value()
at Telerik.Blazor.Components.Grid.GridContentCell`1.BuildRenderTree(RenderTreeBuilder __builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit '-ctJ-ctr0bp4mytl5k9AxUWcoK3LyC8ybsC6BxFhGhA'.
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Blazor.Components.Grid.GridContentCell`1.get_PropInfo()
at Telerik.Blazor.Components.Grid.GridContentCell`1.get_Value()
at Telerik.Blazor.Components.Grid.GridContentCell`1.BuildRenderTree(RenderTreeBuilder __builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
[2020-01-31T17:09:22.390Z] Error: System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Blazor.Components.Grid.GridContentCell`1.get_PropInfo()
at Telerik.Blazor.Components.Grid.GridContentCell`1.get_Value()
at Telerik.Blazor.Components.Grid.GridContentCell`1.BuildRenderTree(RenderTreeBuilder __builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
[2020-01-31T17:09:22.393Z] Information: Connection disconnected.
Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: Exception has been thrown by the target of an invocation.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.NotImplementedException: This is a DynamicProxy2 error: The interceptor attempted to 'Proceed' for method 'Void set_LazyLoader(Microsoft.EntityFrameworkCore.Infrastructure.ILazyLoader)' which has no target. When calling method without target there is no implementation to 'proceed' to and it is the responsibility of the interceptor to mimic the implementation (set return value, out arguments etc)
at Castle.DynamicProxy.AbstractInvocation.ThrowOnNoTarget()
at Castle.DynamicProxy.Internal.CompositionInvocation.EnsureValidTarget()
at Castle.Proxies.Invocations.IProxyLazyLoader_set_LazyLoader.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.DynamicProxy.StandardInterceptor.PerformProceed(IInvocation invocation)
at Castle.DynamicProxy.StandardInterceptor.Intercept(IInvocation invocation)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.AttivitaProxy.set_LazyLoader(ILazyLoader value)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
at Telerik.Blazor.Components.TelerikGridBase`1.Clone(TItem original)
at Telerik.Blazor.Components.TelerikGridBase`1.Edit(GridCommandEventArgs args)
at Telerik.Blazor.Components.TelerikGridBase`1.ExecuteCommand(Object args)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Telerik.Blazor.Components.Grid.GridRowBase`1.OnExecuteCommand(GridCommandEventArgs commandArgs)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Telerik.Blazor.Components.Grid.GridContentCell`1.ExecuteCommandAsync(String commandName)
at Telerik.Blazor.Components.Grid.GridContentCell`1.EditAsync()
at Telerik.Blazor.Components.Grid.GridContentCell`1.OnClick()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit '-ctJ-ctr0bp4mytl5k9AxUWcoK3LyC8ybsC6BxFhGhA'.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.NotImplementedException: This is a DynamicProxy2 error: The interceptor attempted to 'Proceed' for method 'Void set_LazyLoader(Microsoft.EntityFrameworkCore.Infrastructure.ILazyLoader)' which has no target. When calling method without target there is no implementation to 'proceed' to and it is the responsibility of the interceptor to mimic the implementation (set return value, out arguments etc)
at Castle.DynamicProxy.AbstractInvocation.ThrowOnNoTarget()
at Castle.DynamicProxy.Internal.CompositionInvocation.EnsureValidTarget()
at Castle.Proxies.Invocations.IProxyLazyLoader_set_LazyLoader.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.DynamicProxy.StandardInterceptor.PerformProceed(IInvocation invocation)
at Castle.DynamicProxy.StandardInterceptor.Intercept(IInvocation invocation)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.AttivitaProxy.set_LazyLoader(ILazyLoader value)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
at Telerik.Blazor.Components.TelerikGridBase`1.Clone(TItem original)
at Telerik.Blazor.Components.TelerikGridBase`1.Edit(GridCommandEventArgs args)
at Telerik.Blazor.Components.TelerikGridBase`1.ExecuteCommand(Object args)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Telerik.Blazor.Components.Grid.GridRowBase`1.OnExecuteCommand(GridCommandEventArgs commandArgs)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Telerik.Blazor.Components.Grid.GridContentCell`1.ExecuteCommandAsync(String commandName)
at Telerik.Blazor.Components.Grid.GridContentCell`1.EditAsync()
at Telerik.Blazor.Components.Grid.GridContentCell`1.OnClick()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)