Search

Application crash when retrieve type from empty TypedReference. by PetSerAl

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 764283
Opened: 9/23/2012 6:50:53 PM
Access Restriction: Public
0
Workaround(s)
1
User(s) can reproduce this bug
__reftype(new TypedReference()) — cause application crash even in security transparent code.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

.NET Framework 4.5

Steps to reproduce

using System;
using System.Reflection;
using System.Runtime.ExceptionServices;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
[assembly:AllowPartiallyTrustedCallers]
internal static class Test{
    [SecurityCritical,HandleProcessCorruptedStateExceptions]
    private static void Main(){
        if(AppDomain.CurrentDomain.FriendlyName!="TestAppDomain"){
            try{
                string al=Assembly.GetExecutingAssembly().Location;
                PermissionSet ps=new PermissionSet(PermissionState.None);
                ps.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
                ps.AddPermission(new FileIOPermission(FileIOPermissionAccess.PathDiscovery|FileIOPermissionAccess.Read,al));
                ps.AddPermission(new UIPermission(PermissionState.Unrestricted));
                AppDomain.CreateDomain("TestAppDomain",null,new AppDomainSetup{ApplicationTrust=new ApplicationTrust(ps,new StrongName[0])}).ExecuteAssembly(al);
            }catch(Exception e){
                Console.WriteLine(e);
            }
            Console.ReadKey(true);
        }else{
            RunTest();
        }
    }
    private static void RunTest(){
        Console.WriteLine(Assembly.GetExecutingAssembly().IsFullyTrusted);
        Console.WriteLine(MethodBase.GetCurrentMethod().IsSecurityTransparent);
        Console.WriteLine(__reftype(new TypedReference()));
    }
}

Product Language

Russian

Operating System

Windows 7 SP1

Operating System Language

Russian

Actual results

Application crash.

Expected results

Catchable NullReferenceException.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 12/6/2012 at 5:43 PM
The bug is fixed for the next release.
Thank you for reporting it!
Jan Kotas, CLR
Posted by Microsoft on 9/24/2012 at 2:14 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 9/23/2012 at 7:53 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.