“Internal error in the expression evaluator”

后端 未结 9 1466
梦谈多话
梦谈多话 2020-12-23 13:09

I\'ve encountered a problem in expression evaluator of visual studio 2015 that says \"Internal error in the expression evaluator\", after some investigations I found that th

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-23 14:00

    Check your use of the [DebuggerBrowsable] attribute; I found a minimal case in VisualStudio 2017 15.5 and posted it here.

    In this particular case, the expression evaluator (EE) crash appears related to the [DebuggerBrowsable] attribute applied to a property overriding a field of the same name. This will account for some percentage of the cases that people are experiencing out there, but there's no way of knowing how many are due to this specific issue until it gets fixed.

    The full and complete demonstration example is shown in the image (and included below for good measure)

    Machine-readable copy of the code in the image:

    using System;
    using System.Diagnostics;
    
    class Program { static void Main() => new _derived(); }
    
    abstract class _base
    {
        [DebuggerBrowsable(DebuggerBrowsableState.Never)]
        public Object trace;
    };
    
    class _derived : _base
    {
        public _derived() => Debugger.Break();      // <-- vs2017 EE crash when stopped here
    
        [DebuggerBrowsable(DebuggerBrowsableState.Never)]
        new public Object trace => base.trace;
    }
    

提交回复
热议问题