# Design-time Preview fails: DI services (DialogService, IStringLocalizer) not registered in Radzen Preview host

**URL:** <https://forum.radzen.com/t/design-time-preview-fails-di-services-dialogservice-istringlocalizer-not-registered-in-radzen-preview-host/21217>\
**Category:** Radzen Blazor Studio\
**Created:** [December 10, 2025, 8:41am UTC](https://forum.radzen.com/t/design-time-preview-fails-di-services-dialogservice-istringlocalizer-not-registered-in-radzen-preview-host/21217 "2025-12-10T08:41:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Agefer](https://forum.radzen.com/user_avatar/forum.radzen.com/agefer/32/3308_2.png) [@Agefer](https://forum.radzen.com/u/Agefer)\
**Post date:** [December 10, 2025, 8:41am UTC](https://forum.radzen.com/t/design-time-preview-fails-di-services-dialogservice-istringlocalizer-not-registered-in-radzen-preview-host/21217/1 "2025-12-10T08:41:45Z")

</div>

Hello,

I am experiencing an issue when Radzen Studio tries to render my custom `MainLayout` in design‑time preview. The application itself runs correctly in the browser, but Radzen Preview fails with the following exception:

```auto
System.InvalidOperationException: Cannot provide a value for property 'DialogService' on type 'EventsApproval.Components.Layout.MainLayout'. There is no registered service of type 'Radzen.DialogService'.
   at Microsoft.AspNetCore.Components.ComponentFactory...
   at Radzen.Server.RemoteRenderer.HandleException(Exception exception)
   at Radzen.Server.Router.Render(Type layout, Type component, Boolean renderLayout)
   at Radzen.Server.ProjectServer.Render(String fileName, String source, Boolean renderLayout)

```

In my actual Blazor Server application, all Radzen services are correctly registered in `Program.cs`:

```auto
builder.Services.AddScoped<DialogService>();
builder.Services.AddScoped<TooltipService>();
builder.Services.AddScoped<ContextMenuService>();
builder.Services.AddScoped<NotificationService>();

```

The application works without any errors when running normally. The problem occurs **only inside Radzen Studio** , which appears to use its own DI container and does not register Radzen services or localization services required by my layout.

As a result, Radzen Preview cannot instantiate my layout component and throws the exception above.

Could you please advise:

1. How to configure Radzen Studio so that design‑time rendering uses the same DI services as the actual application?

2. Or how to disable design‑time rendering for specific components/layouts to avoid these errors?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [December 10, 2025, 8:59am UTC](https://forum.radzen.com/t/design-time-preview-fails-di-services-dialogservice-istringlocalizer-not-registered-in-radzen-preview-host/21217/2 "2025-12-10T08:59:31Z")

</div>

Hi @Agefer,

Radzen Blazor Studio uses the same DI container as the app. Also those services are registered in every single Radzen Blazor app and work without issue. I suspect something else throws an exception before those services are registered. You can try moving this code up:

```auto
builder.Services.AddScoped<DialogService>();
builder.Services.AddScoped<TooltipService>();
builder.Services.AddScoped<ContextMenuService>();
builder.Services.AddScoped<NotificationService>();

```

You can also [hide](https://www.radzen.com/blazor-studio/documentation/troubleshooting#hide-code-from-design-time-builds) certain service registration code from the design time build.

---

<div class="post-metadata">

**Author:** ![Agefer](https://forum.radzen.com/user_avatar/forum.radzen.com/agefer/32/3308_2.png) [@Agefer](https://forum.radzen.com/u/Agefer)\
**Post date:** [December 11, 2025, 8:06am UTC](https://forum.radzen.com/t/design-time-preview-fails-di-services-dialogservice-istringlocalizer-not-registered-in-radzen-preview-host/21217/3 "2025-12-11T08:06:27Z")

</div>

Dear @korchev ,

Thanks for the quick reply!

I found the commit after which Radzen Blazor Studio started throwing the error.

The screenshot shows that the `Program.cs` file was refactored: a `partial class Program` and an `async Main` method were introduced, and all application setup logic (builder creation, configuration, and service registrations) was moved inside this new `Main` method.

After reverting these changes, Radzen Blazor Studio stopped producing the error.

 ![Screenshot 2025-12-11 110255](https://forum.radzen.com/uploads/default/original/3X/a/f/af8f4b03bf4667e05d87627aeff5e50faf68cef0.png)

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [December 11, 2025, 8:29am UTC](https://forum.radzen.com/t/design-time-preview-fails-di-services-dialogservice-istringlocalizer-not-registered-in-radzen-preview-host/21217/4 "2025-12-11T08:29:01Z")

</div>

Hi @Agefer,

Can you prepare a minimal reproduction of this issue and send it to [info@radzen.com](mailto:info@radzen.com)? It sounds as a scenario that Radzen Blazor Studio should support out of the box.

---

<div class="post-metadata">

**Author:** ![Agefer](https://forum.radzen.com/user_avatar/forum.radzen.com/agefer/32/3308_2.png) [@Agefer](https://forum.radzen.com/u/Agefer)\
**Post date:** [December 11, 2025, 1:57pm UTC](https://forum.radzen.com/t/design-time-preview-fails-di-services-dialogservice-istringlocalizer-not-registered-in-radzen-preview-host/21217/5 "2025-12-11T13:57:59Z")

</div>

Dear @korchev .

Please find enclosed simple project with error.

[Demo.zip](https://forum.radzen.com/uploads/short-url/nLpMOnY8r36fRGMfrPWa9ZyB2Yv.zip) (339.7 KB)

My Gmail doesn't want to attach the archive, even though I deleted the binaries.
