我如何确定是什么原因导致httplistenerrequest``iowincontext.request`

发布于 2025-02-08 00:57:12 字数 651 浏览 1 评论 0原文

我使用OWIN有一个C#API。

在我的一个Owinmiddleware组件中,我读取了一些属性context.request.request在控制器处理请求之后,有时 this this 以“对象已被处理”错误httplistenerrequest iowinrequest深处。

因此,某种东西正在触发该处置。 我相信这是一个错误,因为根据这个问题这不应该发生。

因此,我需要弄清楚导致这种处置的原因...但是我不能因为我不知道它何时是在呼吸(除了“之前”)。

理想情况下,我想做一些导致调试器停止与处置发生密切相关的事情。

我尝试过的事情却没有起作用:

  • 我可以让骑手对.NET代码的一些明显的位置进行反复编译,但是在那里设置的断点不会击中。

I have a C# API using OWIN.

In one of my OwinMiddleware components I read some properties off context.Request after the Controller processes the request, and sometimes this blows up with an "Object is already disposed" error from the HttpListenerRequest deep inside the IOwinRequest.

So, something is triggering that disposal.
I believe this is a bug, because according to this question that shouldn't happen.

So I need to work out what is causing that disposal ... but I can't because I have no idea when it's ocurring (other than "before this point").

Ideally, I want to do something that causes the debugger to stop at some point closely related to when the disposal happens.

Things I've tried and which haven't worked:

  • I can get Rider to decompile some obvious bits of the .NET code, but Breakpoints set in there don't hit. ????

  • I can replace the context.Request with a wrapped version of itself, and so I thought that I could track the Dispose call on the OwinRequest down through the layers ... except the Request object isn't IDisposable, and I can't see any other obvious way that the OwinRequest is in control of when the internal disposal happens.

  • I can't find a seam to be able to get at where the inner object gets set up - it looks like WebApi does that for me somewhere that I can't reach.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文