Skip to content

Commit bdfd748

Browse files
committed
Removed reflection for HostingEnvironment.InClientBuildManager
1 parent e3d85db commit bdfd748

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

WebActivator/ActivationManager.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,24 @@ public static void Run()
2828
{
2929
if (!_hasInited)
3030
{
31-
bool _isRunningMono = Type.GetType("Mono.Runtime") != null;
31+
bool isRunningMono = Type.GetType("Mono.Runtime") != null;
3232

33-
if (_isRunningMono)
33+
if (isRunningMono)
3434
{
3535
RunPreStartMethods(designerMode: false);
3636
}
3737
else
3838
{
3939
// In CBM mode, pass true so that only the methods that have RunInDesigner=true get called
40-
RunPreStartMethods(designerMode: (bool)typeof(HostingEnvironment).GetProperty("InClientBuildManager").GetValue(null, null) == true);
40+
RunPreStartMethods(designerMode: IsInClientBuildManager());
4141
}
4242

4343
// Register our module to handle any Post Start methods. But outside of ASP.NET, just run them now
4444
if (HostingEnvironment.IsHosted)
4545
{
4646
Type startMethodType = typeof(StartMethodCallingModule);
4747

48-
if (_isRunningMono)
48+
if (isRunningMono)
4949
{
5050
HttpModuleActionCollection modules = (WebConfigurationManager.GetWebApplicationSection("system.web/httpModules") as HttpModulesSection).Modules;
5151
modules.Add(new HttpModuleAction(startMethodType.FullName, startMethodType.AssemblyQualifiedName));
@@ -64,6 +64,11 @@ public static void Run()
6464
}
6565
}
6666

67+
private static bool IsInClientBuildManager()
68+
{
69+
return HostingEnvironment.InClientBuildManager;
70+
}
71+
6772
private static IEnumerable<Assembly> Assemblies
6873
{
6974
get

0 commit comments

Comments
 (0)