OYIon / LiveSharp

Public repository for the LiveSharp project
96 stars 4 forks source link

Null Reference #86

Open wocar opened 4 years ago

wocar commented 4 years ago

Im getting this error while using server side blazor


System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at lambda_method(Closure , RenderTreeBuilder )
   --- 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.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at LiveSharp.Runtime.LiveSharpRuntime.ExecuteVoid(Object methodBody, Object thisInstance, Int32 argCount, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11)
   at XXX.Content.Web.Pages.Handlers.Posts.Index.BuildRenderTree(RenderTreeBuilder __builder)
   at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(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()

I can't seem to find the NullReferenceException, it only happens when i change something and the page reloads. Can i get better tracing so that i can find the error. I have no clue where it could be

wocar commented 4 years ago

I found the error already. took me like 1 hr, but managed to find it. If there could be a more detailed error, or a way to find the line where the error is happening might be nice. I know it sounds simple but maybe it isn't. Thank you!

ionoy commented 4 years ago

Current .NET Core doesn't support debugging symbols for Expression Trees, that's why you don't see a proper call stack. It seems that they have added the support in .NET 5.0, so I will try to implement it before the official release.