the following code fails to compile. Could not create activity of Type 'WorkflowConsoleApplication1.Workflow1'. System.NullReferenceException. Object reference not set to an instance...when i double click on the error list in VS i get a message box "Cannot open file 'c:\bla...'. Verify that the file exists and try again..."
//WF BETA 2.2
Steps to recreate:
create a new sequential console app project. drop a code activity with some code in the activity code. Add reference to System.Configuration dll. add an App.config file with the foll. 2 settings
<appSettings>
<add key="myDBConn" value="connectionstring goes here"></add>
</appSettings>
<connectionStrings>
<add name="NewConn" connectionString="bla bla bla"></add>
</connectionStrings>
in Workflow1.cs code beside add the following code.
using System.Configuration;
//inside the Workflow1 Class add
string connString = ConfigurationManager.AppSettings["myDBConn"];
string newConnString = ConfigurationManager.ConnectionStrings["NewConn"].ConnectionString;
// if i comment out the last statement in Workflow1.cs but add it to Program.cs it works fine.
how come appSettings work inside the WF but not connectionStrings setting
thanks
-vt

Workflow wont compile when i use ConfigurationManager.ConnectionStrings[""]
susanowo
This happens because configuration file is not accessible at design time. ConnectionStrings["NewConn"] returns null.
In order to make compilation successfull, change the code inside Workflow1 class to this:
string connString = ConfigurationManager.AppSettings["myDBConn"]; string newConnString = (ConfigurationManager.ConnectionStrings["NewConn"]!=null) ConfigurationManager.ConnectionStrings["NewConn"].ConnectionString : "";