[Mono-bugs] [Bug 622051] New: Interal compiler error

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jul 13 16:59:54 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=622051

http://bugzilla.novell.com/show_bug.cgi?id=622051#c0


           Summary: Interal compiler error
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: 64bit
        OS/Version: RHEL 5
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: srfcanada at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; WOW64;
Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; MS-RTC LM 8)

Im getting this error for projects that need to access internal classing using
the InternalsVisableTo: attribute in the AssemblyInfo class:

error CS0584: Internal compiler error: Object reference not set to an instance
of an object


The following test case shows this problem.

1. using the following classes:
TestSharedClass.cs:
using System.Collections;
using System.Collections.Generic;

namespace TestSharedProject
{
   public class TestSharedClass
   {
      private readonly List<TestSharedClass2.PostProcessingStruct>
m_postProcessingList = new List<TestSharedClass2.PostProcessingStruct>();   

      internal void SharedMember1()
      {

      }

      public void SharedMember2()
      {

      }

      internal List<TestSharedClass2.PostProcessingStruct> PostProcessingList
      {
         get { return m_postProcessingList; }
      }
   }



}

TestSharedClass2.cs:
using System.Collections;

namespace TestSharedProject
{
   internal class TestSharedClass2
   {
      internal struct PostProcessingStruct
      {
         public IDictionary originalDictionary;
         public IDictionary newClonedEmptyDictionary;
      }
   }
}

AssemblyInfo.cs:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.

[assembly : ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed
to COM

[assembly : Guid("9cde0952-0974-4941-9a5e-86e80e66a686")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build
Numbers 
// by using the '*' as shown below:

[assembly : AssemblyVersion("1.0.0.0")]
[assembly : AssemblyFileVersion("1.0.0.0")]

[assembly: InternalsVisibleTo("TestSharedProjectSecond")]

SharedClassAccess.cs:
using System.Collections.Generic;
using TestSharedProject;

namespace TestSharedProjectSecond
{
   public class SharedClassAccess
   {
      public SharedClassAccess()
      {
         TestSharedClass t1 = new TestSharedClass();
         t1.PostProcessingList.Add(new
TestSharedClass2.PostProcessingStruct());
     //List<TestSharedClass2.PostProcessingStruct> postProcessingStructs =
t1.PostProcessingList;
      }
   }
}

2. compile the first set of classes as follows:
gmcs  /target:library /out:TestSharedProject.dll /define:DEBUG 
TestSharedClass.cs TestSharedClass2.cs  AssemblyInfo.cs  

3. compile the second set of classes as follows:
gmcs /target:library /define:DEBUG  /r:TestSharedProject.dll
/out:TestSharedProjectSecond.dll  SharedClassAccess.cs 

Compiling the second set of classes will generate the following error on mono
but works on windows:
SharedClassAccess.cs(11,36): error CS0584: Internal compiler error: Object
reference not set to an instance of an object
SharedClassAccess.cs(11,32): error CS1502: The best overloaded method match for
`System.Collections.Generic.List<TestSharedProject.PostProcessingStruct>.Add(TestSharedProject.PostProcessingStruct)'
has some invalid arguments
/usr/local/lib/mono/2.0/mscorlib.dll (Location of the symbol related to
previous error)
SharedClassAccess.cs(11,32): error CS1503: Argument `#1' cannot convert
`object' expression to type `TestSharedProject.PostProcessingStruct'
Compilation failed: 3 error(s), 0 warnings

Note that removing the commented line 12 will cause this compiler error to go
away . We are getting other errors where we need to access internal classes
from other projects but hopfully this will address all of the issues.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list