Example #1
0
        //
        // Constructor
        //
        internal CachedPathData(string configPath, VirtualPath virtualPath, string physicalPath, bool exists)
        {
            // Guarantee that we return a non-null config record
            // if an error occurs during initialization.
            _runtimeConfig  = RuntimeConfig.GetErrorRuntimeConfig();
            _configPath     = configPath;
            _virtualPath    = virtualPath;
            _physicalPath   = physicalPath;
            _flags[FExists] = exists;

            // VSWhidbey 607683: Config loading for web app has a dependency on CachedPathData.
            // On the other hand, Config also has a dependency on Uri class which has
            // a new static constructor that calls config, and eventually to CachedPathData again.
            // We need a dummy reference to Uri class so the static constructor would be involved
            // first to initialize config.
            string dummy = System.Uri.SchemeDelimiter;
        }
Example #2
0
        // Initialize the data
        void Init(CachedPathData parentData)
        {
            // Note that _runtimeConfig will be set to the singleton instance of ErrorRuntimeConfig
            // if a ThreadAbortException is thrown during this method.
            Debug.Assert(_runtimeConfig == RuntimeConfig.GetErrorRuntimeConfig(), "_runtimeConfig == RuntimeConfig.GetErrorRuntimeConfig()");

            if (!HttpConfigurationSystem.UseHttpConfigurationSystem)
            {
                //
                // configRecord may legitimately be null if we are not using the HttpConfigurationSystem.
                //
                _runtimeConfig = null;
            }
            else
            {
                IInternalConfigRecord configRecord = HttpConfigurationSystem.GetUniqueConfigRecord(_configPath);
                Debug.Assert(configRecord != null, "configRecord != null");

                if (configRecord.ConfigPath.Length == _configPath.Length)
                {
                    //
                    // The config is unique to this path, so this make this record the owner of the config.
                    //
                    _flags[FOwnsConfigRecord] = true;
                    _runtimeConfig            = new RuntimeConfig(configRecord);
                }
                else
                {
                    //
                    // The config record is the same as an ancestor's, so use the parent's RuntimeConfig.
                    //
                    Debug.Assert(parentData != null, "parentData != null");
                    _runtimeConfig = parentData._runtimeConfig;
                }
            }
        }