Još jedan događaj Debug prijemnik Trick

I’m sure I’m not the first person to come up with this. Međutim, I haven’t noticed anyone publish a trick like this since I started paying close attention to the community last July. Tako, Mislio sam da bih objaviti ga to brzo i lako ispravljanje savjet.

I’m working on an event receiver that started to generate this error in the 12 košnica:

Pogreška pri učitavanju i trčanje događaj prijemnik Conchango.xyzzyEventReceiver u xyzzy, Verzija = 1.0.0.0, Kultura = neutralni, PublicKeyToken=blahbalhbalh. Additional information is below. : Objekta nije postavljena na instancu objekta.

I didn’t know where I had introduced this bug because I had done too many things in one of my code/deploy/test cycles.

I tried this solution to get my pdb in there with hopes that SharePoint’s 12 hive would show the stack trace, but no luck. I don’t know if it’s possible and if someone does, javite mi 🙂

I know it’s possible to write your own log messages to the 12 košnica. Frankly, I wanted something a little less scary and quicker to implement.

It occurred to me that I could at least get some basic trace information by catching and re-throwing generic exceptions like this:

  pokušati {
    UpdateEditionDate(Svojstva);
  }
  ulov (Izuzetak e)
  {
    baciti novi Izuzetak("Dispatcher, UpdateEditionDate(): Izuzetak: [" + e.ToString() + "].");
  }

This showed up in the 12 hive thusly:

Pogreška pri učitavanju i trčanje događaj prijemnik Conchango.xyzzyEventReceiver u xyzzy, Verzija = 1.0.0.0, Kultura = neutralni, PublicKeyToken=blahblahblah. Additional information is below. : Dispečer, UpdateEditionDate(): Izuzetak: [System.NullReferenceException: Objekta nije postavljena na instancu objekta. at Conchango.xyzzyManagementEventReceiver.UpdateEditionDate(SPItemEventProperties svojstva) at Conchango.xyzzyManagementEventReceiver.Dispatcher(SPItemEventProperties svojstva, String eventDescription)].

That gave me all the detail I needed to track down that particular problem and I expect to use it a lot going forward.

</kraj>

Pretplatite se na moj blog!

3 misli o „Još jedan događaj Debug prijemnik Trick

  1. Anders Rask
    I have had alot of luck lately debugging this kind of issues with a combination of SPTraceView and DebugView
    Debugview alone is very usefull as well. You can pipe out output using System.Diagnostics.Debug.WriteLine().
    You dont even have to remove them when you release build, since the output only is triggered in debug build mode.
    SPTraceView is a tool created by Hristo Pavlov.
    At its default setting it will show you ULS trace events as they happen. And it catches also the ULS trace events that *doesnt* make it to the diagnostics log!
    But that i disable as soon as i run the util. Whats much better is that you can pipe output to show up in DebugView.
    It also has alot of nice features for filtering on event levels, services etc.
    hth
    Anders
    oh and nice seeing you in the bar at SPBP 🙂

Dopust jedan Odgovor

Vaša email adresa neće biti objavljena. obavezna polja su označena *