0

I have recently shown to my team leader the ElmahR Dashboard and now he wants to implement ExceptionsLog with ElmahR in all of our current projects, including those that are Winform Applications, and after many days of searching I can't find a way to add a Winform Application as "ElmahR source".

Does anyone have a clue?

Mike Marks
  • 10,017
  • 17
  • 69
  • 128
cyberdantes
  • 1,342
  • 3
  • 16
  • 28

2 Answers2

1

ErrorPostModule in ElmahR.Elmah does not support Winforms apps because it's been written to be an ELMAH module, so it's tied to an ASP.NET lifecycle and cannot be easily adapted. That said, ErrorPostModule does not do anything so magic and can be easily taken as a guideline to write a small "handler" to be used in a Winforms app. Take a look at its code here, what you should do is:

  • replace what's in the OnInit method, which simply reads configuration bits and attaches the error handler
  • when an error occurs, handle it like it's done in the SetError method to post it to the right destination reading the configuration parameters you read before. You would reference ELMAH and create an Error instance from your exception, and then use ErrorJson.EncodeString to encode it

You may want to borrow the W3.cs file to simplify the http form compilation.

At some point I might generalize this work and put it in ElmahR.Elmah, but not sure when I'll be able to do it.

Wasp
  • 3,395
  • 19
  • 37
0

I just forked the elmahr source code to work on this, I want to post errors from console applications, so I'm going to remove the dependency on Elmah and create the "error" objects and send them to the dashboard.

It's a work in progress but can be used as starting point for solving your problem.

https://bitbucket.org/rudygt/elmahr

Update: the fork now include full support to post to ElmahR using a ServiceStack endpoint, using json over http. This remove the dependency over the original Elmah to publish errors to the dashboard. The first example is a C# Console Application

rudygt
  • 75
  • 3
  • 6
  • That would be a cool contribution if you manage to find the time to complete it, please keep me updated about that, I'd like to pull it in at some point :) – Wasp Apr 22 '13 at 07:26
  • Sure @Wasp, I will take the time to work on that, when I feel that it is on a good quality point I will ask you for review and if you like it, make the pull request, Thanks for the great job you are doing with Elmahr. – rudygt Apr 22 '13 at 22:02