Skip to content

Hydro Crashes when the Namespace does not represent the Path where the View Lies #144

Description

@thumpnail

What happens: Hydro Crashes on Page Load with Argument Exception that view cannot be null.
What did i find: through some debugging of hydro at runtime of an enterprise app i figured that the path, which gets "generated" based on the namespace, was not correct.
What has been done or needs to be done: the namespace of HydroViews do need to represent exactly where the view lies in the folder structure of the project.
What would be expected: either a better error which does some explaining what exactly went wrong since exceptions in asp pages aren't exactly "verbose" or some workaround if a path cannot be found or some decoupling of namespace <-> view path.

i did only tested this with HydroView, don't know from other issues.

Activity

  1. thumpnail commented on Sep 26, 2025

    @thumpnail
    Author
    Image
    fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
          An unhandled exception has occurred while executing the request.
          System.ArgumentNullException: Value cannot be null. (Parameter 'view')
             at System.ArgumentNullException.Throw(String paramName)
             at System.ArgumentNullException.ThrowIfNull(Object argument, String paramName)
             at Microsoft.AspNetCore.Mvc.Rendering.ViewContext..ctor(ViewContext viewContext, IView view, ViewDataDictionary viewData, TextWriter writer)
             at Hydro.HydroView.GetViewHtml()
             at Hydro.HydroView.GetViewHtml()
             at Hydro.HydroView.ProcessAsync(TagHelperContext context, TagHelperOutput output)
             at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>g__Awaited|0_0(Task task, TagHelperExecutionContext executionContext, Int32 i, Int32 count)
             at ███████████████████.<ExecuteAsync>b__13_0()
             at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.GetChildContentAsync(Boolean useCachedResult, HtmlEncoder encoder)
             at Hydro.HydroView.UpdateSlots(TagHelperContext context, TagHelperOutput output)
             at Hydro.HydroView.ProcessAsync(TagHelperContext context, TagHelperOutput output)
             at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>g__Awaited|0_0(Task task, TagHelperExecutionContext executionContext, Int32 i, Int32 count)
             at ███████████████████.ExecuteAsync() in ███████████████████.cshtml:line 10
             at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
             at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
             at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
             at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
             at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
          --- End of stack trace from previous location ---
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
          --- End of stack trace from previous location ---
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
             at ███████████████████.Program.<>c.<<SetupWebsocket>b__6_0>d.MoveNext() in ███████████████████\Program.cs:line 296
          --- End of stack trace from previous location ---
             at ███████████████████.Program.<>c.<<ConfigureApp>b__5_0>d.MoveNext() in ███████████████████\Program.cs:line 246
          --- End of stack trace from previous location ---
             at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
             at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
             at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
    
  2. kjeske commented on Sep 27, 2025

    @kjeske
    Contributor

    Good catch. Definitely, a better exception message would be helpful, I will fix that. I will also add overridable ViewPath property, same as for HydroComponent.

  3. added theissue type on Oct 5, 2025
  4. self-assigned this
    on Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions