问题
I have a class library project for .NET 3.5 built with Visual Studio 2008.
If I try to NGEN the core assembly in this solution file, NGEN never completes, or at least not in the time I've bothered to let it run (like overnight).
Has anyone else experienced this? And if so, did you solve it? And if you did, how? What steps did you take?
If this is a bug in NGEN, how do I post this to Microsoft? I have a connect account, but where do I post a bug-report for this particular product, instead of a .NET class (which I know where to go for.)
The class library in question can be found here:
- http://svn.vkarlsen.no:81/svn/LVK/LVK_3_5/trunk (subversion 1.6 repository)
The problematic assembly is the LVK.Core assembly.
Update: NGEN for .NET 4.0 completed, but it took nearly 15 minutes to do so:
time /t
12:44:39
ngen install lvk.core.dll
Microsoft (R) CLR Native Image Generator - Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Installing assembly C:\Dev\VS.NET\LVK\LVK.Core\bin\x86\Debug\lvk.core.dll
Compiling assembly C:\Dev\VS.NET\LVK\LVK.Core\bin\x86\Debug\lvk.core.dll (CLR v2.0.50727) ...
LVK.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=8dbb1dd9b1276c0a <debug>
time /t
12:59:24
Update #2: Created issue in Microsoft Connect.
回答1:
The reason for this was later found to be my implementation of Tuple<...>
generic classes.
It turns out that the JIT process when invoked through NGEN will create NGEN'ed versions of each Tuple<...>
type for the following types:
- One common version for all reference types
- One version for each value type
Since I had Tuple-versions up to 16 generic arguments, just for good measure, NGEN was busy churning out every combination there was for a Tuple<T1, T2, T3, T4, ..., T16>
for all the value types.
I reduced the number of types down to a lot fewer generic arguments, and NGEN now completes.
来源:https://stackoverflow.com/questions/2644294/any-reason-why-ngen-should-hang-and-never-complete-for-a-particular-assembly