তবুও অন্য ইভেন্ট রিসিভার ডিবাগ কৌতুক

I’m sure I’m not the first person to come up with this. কিন্তু, I haven’t noticed anyone publish a trick like this since I started paying close attention to the community last July. সুতরাং, আমি এটা এই দ্রুত এবং সহজ ডিবাগ ডগা পোস্ট চাই.

I’m working on an event receiver that started to generate this error in the 12 মধুচক্র:

ত্রুটি লোড এবং চলমান xyzzy মধ্যে ইভেন্ট রিসিভার Conchango.xyzzyEventReceiver, সংস্করণ = 1.0.0.0, সংস্কৃতি = নিরপেক্ষ, PublicKeyToken=blahbalhbalh. Additional information is below. : অবজেক্ট রেফারেন্স একটি বস্তুর উদাহরণ সেট না.

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 মধুচক্র. 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:

  চেষ্টা {
    UpdateEditionDate(বৈশিষ্ট্য);
  }
  ধরা (ব্যতিক্রম e)
  {
    নিক্ষেপ নতুন ব্যতিক্রম("Dispatcher, UpdateEditionDate(): ব্যতিক্রম: [" + e.ToString() + "].");
  }

This showed up in the 12 hive thusly:

ত্রুটি লোড এবং চলমান xyzzy মধ্যে ইভেন্ট রিসিভার Conchango.xyzzyEventReceiver, সংস্করণ = 1.0.0.0, সংস্কৃতি = নিরপেক্ষ, PublicKeyToken=blahblahblah. Additional information is below. : Dispatcher, UpdateEditionDate(): ব্যতিক্রম: [System.NullReferenceException: অবজেক্ট রেফারেন্স একটি বস্তুর উদাহরণ সেট না. at Conchango.xyzzyManagementEventReceiver.UpdateEditionDate(SPItemEventProperties বৈশিষ্ট্যাবলী) at Conchango.xyzzyManagementEventReceiver.Dispatcher(SPItemEventProperties বৈশিষ্ট্যাবলী, 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.

</শেষ>

আমার ব্লগ এর জন্য সাবস্ক্রাইব করুন!

3 চিন্তা "তবুও অন্য ইভেন্ট রিসিভার ডিবাগ কৌতুক

  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 🙂

একটি উত্তর ত্যাগ চার্লস উত্তর বাতিল করুন

আপনার ইমেইল ঠিকানা প্রচার করা হবে না. প্রয়োজনীয় ক্ষেত্রগুলি চিহ্নিত করা আছে *