I’m sure I’m not the first person to come up with this. Hins, I haven’t noticed anyone publish a trick like this since I started paying close attention to the community last July. Svo, Ég hélt ég myndi eftir það þetta fljótleg og auðveld kemba þjórfé.
I’m working on an event receiver that started to generate this error in the 12 Hive:
Villa hleðsla og gangi móttakari Conchango.xyzzyEventReceiver í xyzzy, Útgáfa = 1.0.0.0, Menning = hlutlaus, PublicKeyToken=blahbalhbalh. Additional information is below. : Object tilvísun ekki sett til dæmis á hlut.
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, please let me know 🙂
I know it’s possible to write your own log messages to the 12 Hive. 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:
reyna { UpdateEditionDate(eignir); } veiða (Undantekning e) { kasta ný Undantekning("Dispatcher, UpdateEditionDate(): Undantekning: [" + e.ToString() + "]."); }
This showed up in the 12 hive thusly:
Villa hleðsla og gangi móttakari Conchango.xyzzyEventReceiver í xyzzy, Útgáfa = 1.0.0.0, Menning = hlutlaus, PublicKeyToken=blahblahblah. Additional information is below. : Dispatcher, UpdateEditionDate(): Undantekning: [System.NullReferenceException: Object tilvísun ekki sett til dæmis á hlut. at Conchango.xyzzyManagementEventReceiver.UpdateEditionDate(SPItemEventProperties eignir) at Conchango.xyzzyManagementEventReceiver.Dispatcher(SPItemEventProperties eignir, 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.
</enda>
Gerast áskrifandi að bloggið mitt!
Better yet, fella skógarhögg bókasafn eins Enterprise Library eða log4net og líf þitt verður enn auðveldara.