I have started building a simple console application and ran into some weird behavior. I have isolated the problem to the below code. For some reason when the the s.replace line is executed I immediately see this in the output: "'appname.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'" and then "The program '[17680] appname.vshost.exe: Managed' has exited with code -2147023895 (0x800703e9)."
Debugging is stopped. The value in the arg for path is the full UNC path where a file is located. I want to strip the path= and use the path value. Did I skip something somewhere and VS isnt giving me an exception? I've used VS 2008 and 2010 both with the same issue. Is this because the s is an arg?
foreach (string s in args)
{
if ((s != "") && (s.ToString().ToLower().Contains("path=")))
{
string a = @"\\computer\dir\";
a.Replace("path=", "");
}
}
This may be a visual studio issue because it appears to happen on any string I assign a value. I simply added the below removing the replace and got the same response:
string a = @"value";
Path example is \computer\directory1\directory2\
I've updated the code based on suggestions but the above still has the same problem. Fails on the replace line of code.