0

I'm using Elmah and the Facebook C# SDK (http://facebooksdk.codeplex.com/)

Elmah has been working really well for me. However, when the Facebook C# SDK throws an exception, the stack trace is not logged.

For example, when I throw this exception:

throw new FacebookApiException("this is a test");

The stack trace shows up properly in my browser (with debug turned on, of course), but Elmah doesn't store it. Instead, this is all I see inside Elmah's "AllXml" column in the database:

detail="(Unknown) this is a test"

Usually, the detail attribute of the AllXml column will contain the full stack trace. Do you know why this is? How can I get Elmah to log the stack trace?

Thanks in advance.

demongolem
  • 9,474
  • 36
  • 90
  • 105
Johnny Oshika
  • 54,741
  • 40
  • 181
  • 275
  • Are you making use of the MVC handle error attribute? Keep in mind that elmah logs only unhandled exceptions and you'd need to do some plumbing to log handled exceptions. – WorldIsRound Mar 17 '11 at 20:43

2 Answers2

1

I believe this was caused by the override we had on FacebookApiException.ToString(). I removed the override. If you want, download the current source and give that a try. Let me know if it solved the issue.

Nate Totten
  • 8,904
  • 1
  • 35
  • 41
  • Thanks Nathan. That was exactly the problem. I'm now getting the full stack trace stored in Elmah. BTW, I had to modify the source code for Beta 5.06 to do this test because as soon as I threw a FacebookApiException() in Change Set 4927605c3ca6 (e.g. even as simple as throw new FacebookApiException("this is a test")), I got a stackoverlow exception. – Johnny Oshika Mar 20 '11 at 05:15
  • Great. I will check out the other error, I threw that code in there late last night, so it probably needs to be cleaned up. – Nate Totten Mar 20 '11 at 16:05
0

If you are using the HandleError Attribute, you'll find this question really useful.

ELMAH and HandleError

Community
  • 1
  • 1
Simon Hazelton
  • 1,245
  • 10
  • 13