有没有办法将异常跟踪挂钩到sql clinet中 [英] Is there any way to hook in exception tracking into sql clinet

查看:74
本文介绍了有没有办法将异常跟踪挂钩到sql clinet中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个.net应用程序(由外部合作伙伴开发),它产生了我们需要调查的问题。我们没有源代码,因此我们已经反映了代码,并注意到异常处理非常懒惰,在大多数情况下,异常处理一般,实际细节被抑制而不记录。因此,即使我们知道问题出在哪里,我们也无法弄清楚究竟是什么。

我的问题是:是否有任何客户端工具可用于跟踪从本机sql引发的异常客户端驱动程序或.net驱动程序,在达到应用程序级别之前。像配置文件在服务器端做的事情。

谢谢。

We have a .net application (developed by an external partner), that is producing issues we need to investigate. We don't have the source, thus we have reflected the code, and noticed, that the exception handling is quite lazy, in most cases exceptions are handled generally, actual details are suppressed and not logged. Thus even if we know where the problem is, we can not figure out what exactly it is.
My question is: is there any client side tool that can be used to track exceptions raising from the native sql client driver or the .net driver, before reaching the application level. Something like the profiled does on server side.
Thank you.

推荐答案

无异常 [ ^ ]可能会对您有所帮助。
Exceptionless[^] may help you.


谢谢大家的有用建议。但我发现自己的答案看起来不错。

Dotnet 4有异常服务 [ ^ ]和允许一个的AppDomain添加 FirstChanceException [ ^ ] AppDomain的处理程序。所以我们只需添加此处理程序。我们可以通过将第三方clr可执行文件加载到appdomain中来创建一个包装器。所以我们可以追踪已经捕获的异常。这足够我们不想处理它们只是为了拦截。它也适用于需要更早.net的客户端应用程序。



我只有一个概念证明,但它似乎有效!

应用程序,例外情况:

Thank you all for your helpful suggestions. But I found my own answer that looks good.
Dotnet 4 has ExceptionServices[^] and the AppDomain that allows one to add FirstChanceException[^] handler to an AppDomain. So we simply add this handler. And we can make a wrapper around the third party clr executable by loading it into the appdomain. So we can trace exceptions already caught. And this is enough we don't want to handle them only to intercept. And it is working also with "client" applications that need earlier .net.

I have only a proof of concept, but it seems to work!
The application with the exception:
using System;

namespace _throw
{
    class Program
    {
        public static void Main(string[] args)
        {
            try
            {
                throw new NotImplementedException("catch this");
            }
            catch
            {
            }
        }
    }
}



和处理程序:


And the handler:

using System;
using System.Runtime.ExceptionServices;

namespace catchh
{
    class Program
    {
        public static void Main()
        {
            AppDomain.CurrentDomain.FirstChanceException += FirstChance;
            AppDomain.CurrentDomain.ExecuteAssembly("throw.exe");
            Console.ReadKey();
        }

        static void FirstChance(object sender, FirstChanceExceptionEventArgs e)
        {
            Console.WriteLine("Exception: {0}\nMessage: {1}\nStack trace:\n{2}", e.Exception.GetType().FullName, e.Exception.Message, e.Exception.StackTrace);
        }
    }
}



这里有更多细节的文章可以在这里找到: http://firstchanceexception.com/tag/appdomain/ [ ^ ]。


这篇关于有没有办法将异常跟踪挂钩到sql clinet中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆