Fix OpenMappedWebConfiguration throws: System.IndexOutOfRangeException, when using...
authorPablo Ruiz García <pruiz@users.noreply.github.com>
Sun, 11 Jun 2017 23:55:26 +0000 (01:55 +0200)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Sun, 11 Jun 2017 23:55:26 +0000 (01:55 +0200)
mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationHost.cs

index 8f9aff4d0fd2e580e76bead3e6496dc6434d17e6..85942d311a41401ea76c73d6ac30d9fde70dd1c4 100644 (file)
@@ -174,7 +174,11 @@ namespace System.Web.Configuration
                {
                        string fullPath = (string) hostInitConfigurationParams [1];
                        map = (WebConfigurationFileMap) hostInitConfigurationParams [0];
-                       bool inAnotherApp = (bool) hostInitConfigurationParams [7];
+                       bool inAnotherApp = false;
+
+                       if ((hostInitConfigurationParams.Length > 7)
+                               && (hostInitConfigurationParams[7] is bool))
+                               inAnotherApp = (bool) hostInitConfigurationParams[7];
 
                        if (inAnotherApp)
                                appVirtualPath = fullPath;