奇怪的系统.__佳能例外 [英] Strange System.__Canon exception

查看:127
本文介绍了奇怪的系统.__佳能例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用单个类 ThreadQueue℃的窗口服务; T> 。在服务启动时它使一个呼叫 ThreadQueue<字符串方式>。开始()此类然后接受和队列的任务限制并发线程的配置数量。



ThreadQueue<字符串方式>。开始()被调用一次,只有一次在服务启动

$

  $ b 

在的场合,该服务运行几个小时后,我收到下面的异常>应用:myservice.exe
Framework版本:v4.0.30319
说明:该进程被终止,由于未处理的异常。
异常信息信息:System.NullReferenceException
堆栈:在Apollo.Business.Framework.Threading.ThreadQueue.ThreadQueue`1
[系统.__佳能,mscorlib程序,版本= 4.0.0.0,文化=在System.Threading.ThreadHelper.ThreadStart_Context(System.Object的)中性公钥= b77a5c561934e089]]。开始()

在System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,的System.Threading .ContextCallback,System.Object的,布尔)
在System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object的,布尔)
在System.Threading.ExecutionContext .RUN(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object的)
在System.Threading.ThreadHelper.ThreadStart()

什么是系统.__佳能,什么是在进行此调用这个传递的类型参数?



任何人都可以摆脱任何轻?


解决方案

您应该的不可以读取方法的参数类型名称事情。系统.__佳能是与泛型是在CLR实现方式的实现细节。我不知道它的确切用法,但强烈怀疑它由Ngen.exe,.NET中的优化工具,可以预即时编译器组件。由于具体类型是在运行时实例化泛型预jitting的问题。您将获得带有一个类型参数的参数类型的方法的多个副本。刚有一个的处理方法的任何的引用类型,每个值类型的其他方法,如果有的话。系统.__佳能可替代型这对任何引用类型的占位符,让Ngen.exe到prejit即使它不能猜出实际类型会在运行时使用该方法。类似的东西。



鞋合脚,Apollo.Business.Framework.Threading.ThreadQueue听起来像那种类的那是在一个框架样式库,这将是预即时编译当它被安装,因为它的意思是由多个程序使用。



所以忽略类型名称,注重实际的异常。的NullReferenceException当然是的非常的常见异常。没有什么是从堆栈跟踪,将给出提示是什么原因导致它,否则可见。我在一个初始化的问题与阿波罗框架猜测,一些对象,应该有一个价值,但仍是空。具有为ThreadQueue构造的源代码偷看应该给一个提示。给供应商呼救声,如果你没有它。在8岁的版本抖动的错误没有解释得很好,这些错误已得到修复前很长一段时间。


I have a windows service that uses a singleton class ThreadQueue<T>. When the service starts it makes a call to ThreadQueue<string>.Start() this class then accepts and queues tasks limiting the concurrency to a configurable number of threads.

ThreadQueue<string>.Start() is called once and only once when the service starts up.

On occasion, after a few hours of the service running i receive the following exception:

Application: myservice.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
Stack:
   at Apollo.Business.Framework.Threading.ThreadQueue.ThreadQueue`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Start()
   at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()

What is System.__Canon and what is making this call passing in this as a type argument?

Can anyone shed any light?

解决方案

You should not read anything in the method argument type name. System.__Canon is an implementation detail related to the way generics are implemented in the CLR. I don't know the exact usage for it but strongly suspect it is used by Ngen.exe, the optimization tool in .NET that pre-jits assemblies. Generics are a problem in pre-jitting since the concrete type is instantiated at runtime. You'll get multiple copies of a method that takes an argument type of a type parameter. Just one method that handles any reference type, additional methods for each value type, if any. System.__Canon can be the substitute type that's the place holder for any reference type, allowing Ngen.exe to prejit that method even though it cannot guess what actual type will be used at runtime. Something like that.

The shoe fits, Apollo.Business.Framework.Threading.ThreadQueue sounds like the kind of class that's present in a framework style library that would be pre-jitted when it is installed since it was meant to be used by multiple programs.

So ignore the type name, focus on the actual exception. NullReferenceException is a very common exception of course. Nothing is otherwise visible from the stack trace that would give a hint what causes it. I'd guess at an initialization problem with that "Apollo" framework, some object that should have a value but is still null. Having a peek at the source code for the ThreadQueue constructor should give a hint. A call to the vendor for help if you don't have it. A bug in a 8 year old version of the jitter doesn't explain it well, those bugs have been fixed a long time ago.

这篇关于奇怪的系统.__佳能例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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