diff --git a/src/BootstrapBlazor/Components/ErrorLogger/BootstrapBlazorErrorBoundary.cs b/src/BootstrapBlazor/Components/ErrorLogger/BootstrapBlazorErrorBoundary.cs
index 41c1f32d08d..56df12709f9 100644
--- a/src/BootstrapBlazor/Components/ErrorLogger/BootstrapBlazorErrorBoundary.cs
+++ b/src/BootstrapBlazor/Components/ErrorLogger/BootstrapBlazorErrorBoundary.cs
@@ -5,7 +5,6 @@
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System.Reflection;
@@ -32,10 +31,6 @@ class BootstrapBlazorErrorBoundary : ErrorBoundaryBase
[NotNull]
private NavigationManager? NavigationManager { get; set; }
- [Inject]
- [NotNull]
- private IHostEnvironment? HostEnvironment { get; set; }
-
///
/// 获得/设置 自定义错误处理回调方法
///
@@ -161,16 +156,8 @@ public async Task RenderException(Exception exception, IHandlerException? handle
if (handler != null)
{
- if (HostEnvironment.IsDevelopment())
- {
- // IHandlerException 处理异常逻辑
- await handler.HandlerExceptionAsync(exception, ExceptionContent);
- }
- else
- {
- // 非开发模式下弹窗提示错误信息
- await ToastService.Error(ToastTitle, exception.Message);
- }
+ // 非开发模式下弹窗提示错误信息
+ await ToastService.Error(ToastTitle, exception.Message);
return;
}
diff --git a/src/BootstrapBlazor/Directory.Build.props b/src/BootstrapBlazor/Directory.Build.props
index 398875e9834..789d2c09dad 100644
--- a/src/BootstrapBlazor/Directory.Build.props
+++ b/src/BootstrapBlazor/Directory.Build.props
@@ -36,7 +36,6 @@
-
@@ -47,7 +46,6 @@
-
@@ -57,7 +55,6 @@
-
@@ -67,7 +64,6 @@
-
@@ -77,7 +73,6 @@
-
diff --git a/src/BootstrapBlazor/Extensions/BootstrapBlazorServiceCollectionExtensions.cs b/src/BootstrapBlazor/Extensions/BootstrapBlazorServiceCollectionExtensions.cs
index f367c881076..a1af23b7c10 100644
--- a/src/BootstrapBlazor/Extensions/BootstrapBlazorServiceCollectionExtensions.cs
+++ b/src/BootstrapBlazor/Extensions/BootstrapBlazorServiceCollectionExtensions.cs
@@ -1,11 +1,10 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License
// See the LICENSE file in the project root for more information.
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection.Extensions;
-using Microsoft.Extensions.Hosting;
using System.Globalization;
namespace Microsoft.Extensions.DependencyInjection;
@@ -37,9 +36,6 @@ public static IServiceCollection AddBootstrapBlazor(this IServiceCollection serv
services.TryAddSingleton();
services.TryAddSingleton(typeof(IDispatchService<>), typeof(DefaultDispatchService<>));
- // 增加 IHostEnvironment 服务
- services.TryAddSingleton();
-
// 增加 OtpOptions 配置支持
services.AddOptionsMonitor();
diff --git a/src/BootstrapBlazor/Extensions/HostEnvironmentExtensions.cs b/src/BootstrapBlazor/Extensions/HostEnvironmentExtensions.cs
deleted file mode 100644
index 15819a28492..00000000000
--- a/src/BootstrapBlazor/Extensions/HostEnvironmentExtensions.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the Apache 2.0 License
-// See the LICENSE file in the project root for more information.
-// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
-
-using Microsoft.Extensions.Hosting;
-
-namespace BootstrapBlazor.Components;
-
-///
-/// 扩展方法"
-///
-public static class HostEnvironmentExtensions
-{
- ///
- /// 当前程序是否为 WebAssembly 环境
- ///
- ///
- ///
- public static bool IsWasm(this IHostEnvironment hostEnvironment) => hostEnvironment is MockWasmHostEnvironment;
-}
diff --git a/src/BootstrapBlazor/Services/MockWasmHostEnvironment.cs b/src/BootstrapBlazor/Services/MockWasmHostEnvironment.cs
deleted file mode 100644
index 3430620d3de..00000000000
--- a/src/BootstrapBlazor/Services/MockWasmHostEnvironment.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the Apache 2.0 License
-// See the LICENSE file in the project root for more information.
-// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
-
-using Microsoft.Extensions.FileProviders;
-using Microsoft.Extensions.Hosting;
-
-namespace BootstrapBlazor.Components;
-
-[ExcludeFromCodeCoverage]
-class MockWasmHostEnvironment : IHostEnvironment
-{
-#if DEBUG
- public string EnvironmentName { get; set; } = "Development";
-#else
- public string EnvironmentName { get; set; } = "Production";
-#endif
-
- public string ApplicationName { get; set; } = "BootstrapBlazor";
-
- public string ContentRootPath { get; set; } = "";
-
- public IFileProvider ContentRootFileProvider { get; set; } = null!;
-}
diff --git a/test/UnitTest/Extensions/HostEnvironmentExtensionsTest.cs b/test/UnitTest/Extensions/HostEnvironmentExtensionsTest.cs
deleted file mode 100644
index 276b13d39ea..00000000000
--- a/test/UnitTest/Extensions/HostEnvironmentExtensionsTest.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the Apache 2.0 License
-// See the LICENSE file in the project root for more information.
-// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
-
-using Microsoft.Extensions.FileProviders;
-using Microsoft.Extensions.Hosting;
-
-namespace UnitTest.Extensions;
-
-public class HostEnvironmentExtensionsTest
-{
- [Fact]
- public void IsWasm_Ok()
- {
- var hostEnvironment = new MockWasmHostEnvironment();
- Assert.False(hostEnvironment.IsWasm());
- }
-
- class MockWasmHostEnvironment : IHostEnvironment
- {
- public string EnvironmentName { get; set; } = "Development";
-
- public string ApplicationName { get; set; } = "BootstrapBlazor";
-
- public string ContentRootPath { get; set; } = "";
-
- public IFileProvider ContentRootFileProvider { get; set; } = null!;
- }
-}