Skip to content

Commit 9036ac0

Browse files
Update FAQ and rev to preview2. (#219)
1 parent 404b530 commit 9036ac0

File tree

2 files changed

+32
-18
lines changed

2 files changed

+32
-18
lines changed

docs/FAQ.md

+31-17
Original file line numberDiff line numberDiff line change
@@ -149,22 +149,36 @@ some of the most frequent along with answers that are hopefully helpful.
149149
150150
<a name="vstyperes"></a>
151151
<details>
152-
<summary><b>Why do I get an error in Visual Studio when I switch my web app to use IIS instead of IISExpress?</b></summary>
152+
<summary><b>Why do I get an error from Visual Studio when using my config builder?<br/>Or why does using IIS instead of IISExpress produce an error in Visual Studio?</b></summary>
153153
154-
> Many reasons. The gist of the situation is this... When you switch your web application to run in IIS
155-
> instead of IISExpress, Visual Studio tries to read your config file to parse connection strings. I
156-
> believe it's looking for 'LocalDB', but that's not really important. Your web app's config file is
157-
> obviously not part of the process configuration for devenv.exe, so VS opens it via
158-
> `ConfigurationManager.OpenConfiguration()` or something similar. Prior to V3, this was likely to
159-
> result in failures in many of these key/value config builders if they were applied to the
160-
> `<connectionStrings>` section.
161-
>
162-
> In V3, we handle the `ConfigurationManager.OpenConfiguration()` scenario better, but we can still
163-
> get tripped up by the insanely complicated way Visual Studio manages reference binding. As a result,
164-
> there may be version mis-matches when trying to load some builders. The Azure builders seem particularly
165-
> vulnerable to this. I haven't found a good way to deal with this.
166-
>
167-
> **However,** even though the error appears in a scary dialog box, it does not affect the behavior of
168-
> your application. When running/debugging your app on local IIS, the config builders are still able to
169-
> execute as expected.
154+
> There are many factors at play here. For the IIS/IISExpress scenario in particular (and likely
155+
> most other scenarios where VS pops up an error dialog complaining about a failure to execute
156+
> a config builder) the gist of the situation is this... When you switch your web application
157+
> to run in IIS instead of IISExpress, Visual Studio tries to read your config file to parse
158+
> connection strings. Obviously your applications's config file is not loaded as the active
159+
> configuration for the Visual Studio (devenv.exe) process. So Visual Studio has to open it via
160+
> `ConfigurationManager.OpenConfiguration()` or something similar in order to read the settings
161+
> it needs.
162+
>
163+
> Versions 1 and 2 of these builders assumed they were always working on the active process
164+
> config, and would go directly to `ConfigurationManager` to look up things like appSettings,
165+
> builder definitions, or section handler configuration. This was likely to result in failures
166+
> when working on a config section that was created in an `OpenConfiguration()` scenario,
167+
> because the appSettings (or builder definition, etc) that we need probably doesn't exist
168+
> in the active processes configuration. Rather, they probably exist in the `Configuration`
169+
> object that was created by the call to `OpenConfiguration()`.
170+
>
171+
> Version 3 fixes this error, so these config builders should be more resilient in "OpenConfig()"
172+
> scenarios.
173+
>
174+
> However, Visual Studio still complicates things by using it's own custom assembly-resolving
175+
> and binding algorithms. As a result, VS might not be able to find the assembly that contains
176+
> the builder trying to run. Or more likely (as I've seen is the case with the 'Azure' config
177+
> builders here), Visual Studio already has a version of a dependent library loaded, and when the
178+
> config builder asks for a different version, a binding failure can arise. I haven't found a
179+
> good way to deal with this.
180+
>
181+
> **However,** even though the error appears in a scary dialog box, it should not affect the
182+
> behavior of your application. When running/debugging your app on local IIS, the config builders
183+
> are still able to execute at runtime as expected.
170184
</details>

tools/MicrosoftConfigurationBuilders.settings.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
Release: Third for Info and Package.
2424
Update package and file without touching assembly, except for major releases.
2525
-->
26-
<BuildQuality Condition="'$(BuildQuality)' == ''">preview1</BuildQuality>
26+
<BuildQuality Condition="'$(BuildQuality)' == ''">preview2</BuildQuality>
2727
<VersionStartYear>2022</VersionStartYear>
2828
<VersionMajor>3</VersionMajor>
2929
<VersionMinor>0</VersionMinor>

0 commit comments

Comments
 (0)