Null reference when trying to load project in Radzen Blazor Studio

I'm working on developing a new Blazor website that I originally created in Radzen Blazor Studio but have been editing in Visual Studio 2022 afterwards. However, now when trying to load the project in the Radzen Blazor Studio again, I always receive the following errors:

[2024-07-07 19:30:58.228] [error] Error: System.NullReferenceException: Object reference not set to an instance of an object.
   at Radzen.Server.SolutionContext.<>c.<OpenAsync>b__34_4(String f)
   at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.ToList()
   at Radzen.Server.SolutionContext.OpenAsync(MSBuildWorkspace workspace, String fileName)
   at Radzen.Server.SolutionContext.OpenAsync(String fileName, Boolean lifeCycle, IDesignTimeContext context, Action`1 activate)
   at Radzen.Server.SolutionFacade.LoadProject(String filePath, Boolean overrideLifeCycle, Boolean throwOnBuildError)
   at Radzen.Server.ProgramController.OpenProject(OpenApplicationRequest request)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   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 Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)

The errors aren't the most helpful on my end so hoping someone here has seen it before and knows the solution. Thanks!

1 Like

Hi @Foxxers,

We haven't seen this error either. We would need access to the source code of this project in order to tell more.

I also have the same exception in Radzen Blazor Studio.

[2024-11-28 09:22:50.249] [error] Error: System.NullReferenceException: Object reference not set to an instance of an object.
at Radzen.Server.SolutionContext.<>c.b__35_4(String f)
at System.Linq.Enumerable.IEnumerableWhereIterator1.ToArray() at System.Linq.Enumerable.OrderedIterator1.ToList()
at Radzen.Server.SolutionContext.OpenAsync(MSBuildWorkspace workspace, String fileName)
at Radzen.Server.SolutionContext.OpenAsync(String fileName, Boolean lifeCycle, IDesignTimeContext context, Action1 activate) at Radzen.Server.SolutionFacade.LoadProject(String filePath, Boolean overrideLifeCycle, Boolean throwOnBuildError) at Radzen.Server.ProgramController.OpenProject(OpenApplicationRequest request) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
.

Let us know how to reproduce it.

Hi enchev

i'm using Radzen Blazor Studio 1.36.0 and VS 2022 17.12.2

Test9.zip it'a simple app at this link

You can test our master branch where the fix is already submitted. Instead Radzen.Blzor NuGet package you can add project reference to Radzen.Blazor.csproj.