Bug 322654 (MONO79956) - [GMCS] not making nested enums genericinsts
Summary: [GMCS] not making nested enums genericinsts
Status: RESOLVED FIXED
Alias: MONO79956
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-17 14:46 UTC by Hans-Joachim Ott
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
compiled .exe which throws the exception (16.00 KB, application/octet-stream)
2006-11-17 15:41 UTC, Thomas Wiest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:16:23 UTC


---- Reported by hans@hj-ott.de 2006-11-17 07:46:15 MST ----

Please fill in this template when reporting a bug, unless you know what 
you are doing.
Description of Problem:

I have an application compiled with Microsoft .NET 2.0, but it gives an 
"System.InvalidProgramException: Invalid IL code" when run on Mono 
(1.1.15 as well as 1.2)

Steps to reproduce the problem:
1. 
Compile following program with Microsoft 2.0:

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
//  public enum TestEnum { one, two, three }     // (1)
  class Parent<T, U>
  {
    protected enum TestEnum { one, two, three }  // (2)
    protected TestEnum te;
  }
  class Child : Parent<int, int>
  {
    public void DoIt()
    {
      te = TestEnum.one;                 
      Console.WriteLine(te.ToString());
    }
  }
  class Program
  {
    static void Main(string[] args)
    {
      Child C = new Child();
      C.DoIt();
    }
  }
}

2. 
3. 

Actual Results:

Unhandled Exception: System.InvalidProgramException: Invalid IL code in 
ConsoleApplication1.Child:DoIt (): IL_0002: stfld     0x0a000011


  at <0x00000> <unknown method>
  at ConsoleApplication1.Program.Main (System.String[] args) [0x00000]


Expected Results:


How often does this happen? 

Always.

Additional Information:

The program works if you put line (2) in comment and uncomment line (1). 
It might be a problem with Generics, because it works when Parent has no 
generic type parameters.



---- Additional Comments From lupus@ximian.com 2006-11-17 07:48:13 MST ----

Please attach the compiled .exe.



---- Additional Comments From hans@hj-ott.de 2006-11-17 08:41:46 MST ----

Created an attachment (id=170901)
compiled .exe which throws the exception




---- Additional Comments From lupus@ximian.com 2007-01-18 13:30:51 MST ----

The runtime side of this bug is fixed in svn.
I asked the binary because the gmcs compiled exe worked fine.
The difference is that csc compiles the enum to a generic inst class
with the generic parameters of the nesting generic class.
Since this is a user-visible difference, gmcs should likely do the same.



---- Additional Comments From martin@ximian.com 2007-03-13 10:11:16 MST ----

Fixed in SVN; added gtest-313.cs.

Imported an attachment (id=170901)

Unknown operating system unknown. Setting to default OS "Other".