mo.notono.us

Thursday, August 26, 2004

Note to self: The designer can't access the app.config file

So when your class can't be loaded in the designer because of a seemingly obscure error, typically it's because some code is being executed in the constructor or in the initialization process. In my most recent case, I got an "Invalid URI" caused by some deep-down nested object call to get the URI of a webservice from the app.config file. But, of course since this was at design time, the actual application that was executing was devenv.exe, and silly me - I didn't have the same app key in the devenv.exe.config file, so my utility function returned an empty string.

The short term solution was to check which app was running and not set the URI if in devenv.exe, but the better, long term fix will be to implement Lazy Initialization as described by Martin Fowler in P of EAA: Lazy Load

0 Comments:

Post a Comment

<< Home