I've encountered some very strange behaviour when debugging in VS 2010 with a WCF Service. Here's a snippet:
public MapFileInfo[] ListFiles(string user, string pass)
{
return s.ListFiles(user, pass);
}
I want an exception to bubble up to the main application if authentication fails. However, what actually happens during debug mode is that it recalls s.ListFiles(user, pass). So to further test my theory that VS is doing something fishy I just did the following:
try
{
return s.ListFiles(user, pass);
}
catch (SoapHeaderException e)
{
throw e;
}
Lo and behold, throw e gets called over, and over, and over when I step into (F8) instead of throwing it to the calling statement through the call stack.
Anyone experienced this weird behaviour before? I can't debug through my app because of it. Additionally, I can step through the service code which obviously throws an exception and returns to the calling statement (s.ListFiles that is) so I know that's happening.