[Mono-bugs] [Bug 689473] New: 'Mono.CSharp.Location.ToString()' is security transparent, but is a member of a security critical type.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Apr 23 23:05:16 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=689473

https://bugzilla.novell.com/show_bug.cgi?id=689473#c0


           Summary: 'Mono.CSharp.Location.ToString()' is security
                    transparent, but is a member of a security critical
                    type.
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.10.x
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: jmalcolm at cia.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (X11; Linux i686; rv:5.0a2) Gecko/20110422
Firefox/5.0a2

When compiling the following code on .NET 4 using Mono.CSharp.dll from Mono
2.10 you encounter the error "'Mono.CSharp.Location.ToString()' is security
transparent, but is a member of a security critical type."

================= EXAMPLE CODE ===============

using System;
using Mono.CSharp;

namespace Test
{
    class MainClass
    {
            public static void Main (string[] args)
        {
            Evaluator.Run("using System;");

            int sum = (int) Evaluator.Evaluate("1+2;");

            Console.WriteLine ("The sum of 1 + 2 is {0}", sum);
        }
    }
}

========================================================

There is a thread about it on Stackoverflow:

http://stackoverflow.com/questions/5520364/how-do-i-use-the-mono-csharp-interpreter-in-microsoft-net/5768209#5768209

A more complete stack trace is below:

    System.TypeInitializationException was unhandled by user code
      Message=The type initializer for 'Mono.CSharp.Evaluator' threw an
exception.
      Source=Mono.CSharp
      TypeName=Mono.CSharp.Evaluator
      StackTrace:
           at Mono.CSharp.Evaluator.Run(String statement)
           at Experiments.Class1.EXPR() in W:\Experiments\Class1.cs:line 16
      InnerException: System.TypeLoadException
           Message=Method 'Mono.CSharp.Location.ToString()' is security
transparent, but is a member of a security critical type.
           Source=Mono.CSharp
           TypeName=Mono.CSharp.Location.ToString()
           StackTrace:
                at Mono.CSharp.Evaluator..cctor()
           InnerException: 


Reproducible: Always

Steps to Reproduce:
1. Create a program with the code above on Windows using .NET 4
2. Include a reference to Mono.CSharp.dll from Mono 2.10.1
3. Try to compile
Actual Results:  
'Mono.CSharp.Location.ToString()' is security transparent, but is a member of a
security critical type.

Expected Results:  
Program outputs "The sum of 1 + 2 is 3" at the console.

The error no longer occurs with Mono.CSharp.dll from Mono 2.11 (trunk). That
version makes quite a few changes however, including moving from a static
invocation to multiple instances of the compiler.

It looks like perhaps Mono.CSharp.Location.ToString() is missing a
SecurityCritical attribute.

http://msdn.microsoft.com/en-us/library/system.security.securitycriticalattribute.aspx

http://msdn.microsoft.com/en-us/library/dd984947.aspx#SecurityTransparency

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


More information about the mono-bugs mailing list