05.23.08
Problem: Your application contains User Scope Settings and you receive the exception.
“Configuration system failed to initialize” when attempting to retrieve these settings.
Solution: The settings file has been corrupted and is unreadable. Close or stop your application and delete the user.config file. The file is located at:
C:\Documents and Settings\[UserName]\Local Settings\Application Data\[AppCompany]\[AppName] \[AppVersion]\
If you are in Visual Studio you can easily find the exact file that is causing the problem by viewing the details and drilling down to the inner exception to find the file name.


02.01.08
Problem: You are using Select Method to retrieve rows from a typed DataTable and you keep getting the fallowing exception:
System.Data.EvaluateException: Cannot perform '=' operation on System.String and System.Int32.
This isn't the most helpful error message.
Solution: You are missing hyphens.
Example:
Wrong:
CustomerRow[] rows = Select(string.Format("LastName = {0}", LastName)) as CustomerRow[];
Right:
CustomerRow[] rows = Select(string.Format("LastName = '{0}'", LastName)) as CustomerRow[];
10.11.07
Problem: You need functionality turned off or on when you are running your program in Debug mode.
Solution: System.Diagnostics.Debugger.IsAttached; it is a static property that returns true if there is a Debugger attached. I like to use this when debugging websevices, timing out while fixing a problem can be annoying.
if (Debugger.IsAttached)
_webService.Timeout = -1;
More info:
MSDN
09.21.07
Problem: I have an editable grid that needs to contain numeric integer values only.
My Solution: TryParse, this function accepts a string and an out value then returns a bool True if it was successful, also it does not throw exceptions. I am a 100% sure there is someone with a better way of doing this but this is what I came up with. Feedback encouraged!
private string RemoveNonNumericValues(string p)
{
int tempValue = 0;
StringBuilder value = new StringBuilder(p.Length);
foreach (char charValue in p.ToCharArray())
{
if (int.TryParse(charValue.ToString(), out tempValue))
value.Append(tempValue.ToString());
}
return value.ToString();
}
private void dataGrid_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
dataGridView[e.ColumnIndex, e.RowIndex].Value = RemoveNonNumericValues(dataGridView[e.ColumnIndex, e.RowIndex].Value.ToString());
}
09.15.07
This is great! I dont know why I didnt do this earlier, but you can Debug your code and run NUnit at the same time. You just need to set the Debug>Start Action to start external aplication NUnit.exe. Then set your start project to be the same project as your test code and tada you now have debuging and break point goodness wile running nunit.

09.13.07
I was reorganizing a project and I moved a crystal report after that I received this error at runtime "Unable to find the report in the manifest resources. please build the project, and try again." No amount of building could fix this problem. I eventually had to open up the project file in note pad and edit the entries in the xml/MSBUILD.
Here is what a Crystal Report should look like in your MSBUILD script.
<Compile Include="CrystalReport1.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>CrystalReport1.rpt</DependentUpon>
<SubType>Component</SubType>
</Compile>
<EmbeddedResource Include="CrystalReport1.rpt">
<Generator>CrystalDecisions.VSDesigner.CodeGen.ReportCodeGenerator</Generator>
<LastGenOutput>CrystalReport1.cs</LastGenOutput>
</EmbeddedResource>
After you correct the entry Rename the file Build then rename it again to the old name and build again.