Hi ,
Since this issue is closly related to winform design time behavior, Tim has
transferred this issue to me. I'd like to confirm if I have understood your
scenario correctly.
You have a component which in its constructor will read
ConfigurationSettings.AppSettings collection to get the path setting from a
.config file. the path setting could be get correctly in run-time
regardless in or not in the debugger, however you could not get the value
if put the component onto form in design-time. If there is any
mis-understanding, please feel free to correct me.
I could reproduce the behavior described above on my system, after some
investigation, I found this is because the .NET configuration system always
try to load the .config file with the same name as the executable name
from the Application Base, when the component are created in design-time,
it's actually running in the AppDomain of Vs.NET IDE, so that it tries to
retrieve the corresponding data from
"<path_to_devenv.exe>\devenv.exe.config"
here, the Application Base is where the app start from
and the entry assembly name is devenv.exe
Of course by default devenv.exe.config does not contain "appSettings"
section and your settings, that's why you could not get the corresponding
settings.
Does it answer your question?
If you have anything unclear about my reply, please feel free to reply this
thread.
By the way, we have a special group for design-time programming in windows
forms, you may post design-time issues to that group next time.
Thanks!
Best regards,
Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! -
www.microsoft.com/security This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.