Skip to content

Commit aa441c2

Browse files
committed
Revert "fix: 修复 Wasm 下无法使用 Host 问题"
This reverts commit a54d3d4.
1 parent d1acd67 commit aa441c2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/BootstrapBlazor/Components/ErrorLogger/BootstrapBlazorErrorBoundary.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
using Microsoft.AspNetCore.Components.Rendering;
77
using Microsoft.Extensions.Configuration;
8-
using Microsoft.Extensions.DependencyInjection;
98
using Microsoft.Extensions.Hosting;
109
using Microsoft.Extensions.Logging;
1110
using System.Reflection;
@@ -35,7 +34,7 @@ class BootstrapBlazorErrorBoundary : ErrorBoundaryBase
3534

3635
[Inject]
3736
[NotNull]
38-
private IServiceProvider? ServiceProvider { get; set; }
37+
private IHostEnvironment? HostEnvironment { get; set; }
3938

4039
/// <summary>
4140
/// 获得/设置 自定义错误处理回调方法
@@ -153,8 +152,7 @@ public async Task RenderException(Exception exception, IHandlerException? handle
153152

154153
if (handler != null)
155154
{
156-
var host = ServiceProvider.GetService<IHostEnvironment>();
157-
if (host?.IsDevelopment() ?? false)
155+
if (HostEnvironment.IsDevelopment())
158156
{
159157
// IHandlerException 处理异常逻辑
160158
await handler.HandlerException(exception, ExceptionContent);

0 commit comments

Comments
 (0)