Print Page | Close Window

DevForce Authentication Issue

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=707
Printed Date: 11-Jun-2026 at 7:46am


Topic: DevForce Authentication Issue
Posted By: Customer
Subject: DevForce Authentication Issue
Date Posted: 28-Feb-2008 at 8:50am

When debugging our application inside of Visual Studio.NET (in a non-remoting deployment environment) we encounter a break in code when our LoginManager throws an exception. Take this scenario for example:

1)      Client calls login on the persistencemanager with invalid credentials

2)      LoginManager throws an exception (invalid credentials supplied)

3)      Client application catches the exception, providing another attempt to login

It is at step 2 where our debugger is breaking on the exception, treating this as an unhandled exception. It is critical to our development team to handle this exception appropriately so that the debugger does not break unexpectedly during the login method. Do you have any suggestions to prevent the debugger from breaking when this exception is thrown?

 




Replies:
Posted By: IdeaBlade
Date Posted: 28-Feb-2008 at 8:53am

If I correctly understand your predicament, you find that you can continue advancing through the program by pressing F5 until you get through to the catch on the client. In other words, your application can continue just fine and would not stop here if you were running outside the debugger.

 

What you need, then, is to TELL the debugger to keep going (“don’t stop here”). You need to use one of the attributes that gives direction to the debugger.

 

Here’s an example from my LoginManager class code:

 

  [DebuggerStepThrough] // Let client catch exceptions

  public IPrincipal Login(ILoginCredential pCredential, PersistenceManager pManager) { ...

 

You may find several methods in your class that need this attribute … or another like it such as:

 

    [DebuggerNonUserCode] // Let client catch exceptions

  private static AppIdentity GetUserPasswordIdentity(ILoginCredential pCredential, PersistenceManager pManager) { …

 

Frankly, I don’t remember off the top of my head which of these two to use in which circumstances.

 

Here’s a web page that discusses these attributes: http://blogs.msdn.com/stevejs/archive/2005/12/03/499803.aspx - http://blogs.msdn.com/stevejs/archive/2005/12/03/499803.aspx

 

Please note that, once you have such an attribute in place, YOU CANNOT DEBUG INTO THE METHOD. If you try to put a breakpoint on a line in “Login”, you’ll see the brown dot just fine but you’ll probably overlook the tooltip that tells you the debugger won’t actually stop there.

 

So when you WANT to debug “Login”, you have to comment out the attribute. Just remember to uncomment it later J

 

 




Print Page | Close Window