我得到了:调用目标抛出了异常 [英] I'm getting: exception has been thrown by the target of an invocation

查看:185
本文介绍了我得到了:调用目标抛出了异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试打开页面时遇到异常:

I´m getting the exception when I try to open my page:


发生了未处理的异常,过程是终止。

申请ID:/ LM / W3SVC / 6 / ROOT / ROXY / es

Application ID: /LM/W3SVC/6/ROOT/ROXY/es

进程ID:2972

异常:System.InvalidOperationException

Exception: System.InvalidOperationException

消息:句柄未初始化。

StackTrace:

at System.WeakReference.set_Target(Object value)

at System.Data.ProviderBase.DbConnectionInternal.CloseConnection(DbConnection) owningObject,DbConnectionFactory connectionFactory)

at System.Data.Odbc.OdbcConnection.Close()

at DsNet.CUIHandler.CloseConn()

at DsNet.CUIHandler .Finalize()

StackTrace:
at System.WeakReference.set_Target(Object value)
at System.Data.ProviderBase.DbConnectionInternal.CloseConnection(DbConnection owningObject, DbConnectionFactory connectionFactory)
at System.Data.Odbc.OdbcConnection.Close()
at DsNet.CUIHandler.CloseConn()
at DsNet.CUIHandler.Finalize()

在页面中我收到错误:


消息:调用目标已抛出异常。

任何想法?

提前致谢

推荐答案

页面中的错误声音不相关的,应该通过捕获和记录它来调查。如果您最终捕获 TargetInvocationException ,那么您可以通过 .InnerException 实际异常$ c>。

The bug in the page sounds unrelated, and should be investigated by catching and logging it. If you do end up catching a TargetInvocationException, then you can get the actual exception via the .InnerException.

回答另一个问题:什么是DsNet?那是你的代码吗?或者您正在使用的图书馆?无论哪种方式,听起来它在终结器中都有一个错误(触摸托管对象在终结器中是一个真的坏主意)。我希望你可以通过在DsNet周围使用使用来减少脾气暴躁,以便它在常规代码中处理,而不是GC扫描中最终确定。我在谷歌获得 DsNet.CUIHandler 的唯一点击是这个问题 - 所以我猜测那是你的代码。如果是这样:请勿触摸终结器中的其他托管对象。

Re the other issue: what is DsNet? Is that your code? or a library you are using? Either way, it sounds like it has a bug in the finalizer (touching managed objects is a really bad idea in a finalizer). I expect you may be able to make this less grumpy by using using around whetever is DsNet, so that it gets disposed in regular code, rather than finalized in the GC sweep. The only "hit" I'm getting in google for DsNet.CUIHandler is this question - so I'm guessing that is your code. If so: don't touch other managed objects in a finalizer.

这篇关于我得到了:调用目标抛出了异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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