Any reason why NGEN should hang and never complete for a particular assembly?
Asked Answered
B

1

2

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:

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.

Bagging answered 15/4, 2010 at 10:0 Comment(0)
B
2

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:

  1. One common version for all reference types
  2. 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.

Bagging answered 8/11, 2010 at 8:29 Comment(2)
Interesting case; so... did the source code make use of lots of different permutations of T? Presumably NGEN wasn't inventing permutations?Proparoxytone
That's exactly what it does. It generates JITted combinations for all the value types in that assembly, all combinations, "just in case" (I guess that's a different variation of Just-in-time). The library is a class library, for most of these types there was no usage at all, just the class definition. I did go overboard with the definition though, since I generated it with a python script so I saw no harm in just "planning for the future". I guess I was well on my way to the moon as an architect at the time :)Bagging

© 2022 - 2024 — McMap. All rights reserved.