Exemple #1
0
        void FormatCore(DbgEvaluationInfo evalInfo, IDbgValueNodeFormatParameters options, CultureInfo?cultureInfo)
        {
            evalInfo.Runtime.GetDotNetRuntime().Dispatcher.VerifyAccess();
            DbgValueFormatterOptions     formatterOptions;
            DbgValueFormatterTypeOptions typeFormatterOptions;
            var formatter = owner.Formatter;
            var dnValue   = value?.DotNetValue;

            if (!(options.NameOutput is null))
            {
                formatterOptions = PredefinedFormatSpecifiers.GetValueFormatterOptions(dnValueNode.FormatSpecifiers, options.NameFormatterOptions);
                if (dnValueNode.FormatName(evalInfo, options.NameOutput, formatter, formatterOptions, cultureInfo))
                {
                    // Nothing
                }
                else
                {
                    dnValueNode.Name.WriteTo(options.NameOutput);
                }
                evalInfo.CancellationToken.ThrowIfCancellationRequested();
            }
            if (!(options.ExpectedTypeOutput is null))
            {
                formatterOptions     = PredefinedFormatSpecifiers.GetValueFormatterOptions(dnValueNode.FormatSpecifiers, options.TypeFormatterOptions);
                typeFormatterOptions = PredefinedFormatSpecifiers.GetValueFormatterTypeOptions(dnValueNode.FormatSpecifiers, options.ExpectedTypeFormatterOptions);
                if (dnValueNode.FormatExpectedType(evalInfo, options.ExpectedTypeOutput, formatter, typeFormatterOptions, formatterOptions, cultureInfo))
                {
                    // Nothing
                }
                else if (dnValueNode.ExpectedType is DmdType expectedType)
                {
                    formatter.FormatType(evalInfo, options.ExpectedTypeOutput, expectedType, null, typeFormatterOptions, cultureInfo);
                }
                evalInfo.CancellationToken.ThrowIfCancellationRequested();
            }
            if (!(options.ActualTypeOutput is null))
            {
                formatterOptions     = PredefinedFormatSpecifiers.GetValueFormatterOptions(dnValueNode.FormatSpecifiers, options.TypeFormatterOptions);
                typeFormatterOptions = PredefinedFormatSpecifiers.GetValueFormatterTypeOptions(dnValueNode.FormatSpecifiers, options.ActualTypeFormatterOptions);
                if (dnValueNode.FormatActualType(evalInfo, options.ActualTypeOutput, formatter, typeFormatterOptions, formatterOptions, cultureInfo))
                {
                    // Nothing
                }
                else if (dnValueNode.ActualType is DmdType actualType)
                {
                    formatter.FormatType(evalInfo, options.ActualTypeOutput, actualType, dnValue, typeFormatterOptions, cultureInfo);
                }
                evalInfo.CancellationToken.ThrowIfCancellationRequested();
            }
            if (!(options.ValueOutput is null))
            {
                formatterOptions = PredefinedFormatSpecifiers.GetValueFormatterOptions(dnValueNode.FormatSpecifiers, options.ValueFormatterOptions);
                if (dnValueNode.FormatValue(evalInfo, options.ValueOutput, formatter, formatterOptions, cultureInfo))
                {
                    // Nothing
                }
                else if (!(dnValue is null))
                {
                    formatter.FormatValue(evalInfo, options.ValueOutput, dnValue, formatterOptions, cultureInfo);
                }
Exemple #2
0
 public override void Format(DbgEvaluationInfo evalInfo, IDbgValueNodeFormatParameters options, CultureInfo?cultureInfo)
 {
     if (evalInfo is null)
     {
         throw new ArgumentNullException(nameof(evalInfo));
     }
     if (!(evalInfo.Context is DbgEvaluationContextImpl))
     {
         throw new ArgumentException();
     }
     if (evalInfo.Context.Language != Language)
     {
         throw new ArgumentException();
     }
     if (evalInfo.Context.Runtime != Runtime)
     {
         throw new ArgumentException();
     }
     if (!(evalInfo.Frame is DbgStackFrameImpl))
     {
         throw new ArgumentException();
     }
     if (options is null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     engineValueNode.Format(evalInfo, options, cultureInfo);
 }
Exemple #3
0
 public override void Format(DbgEvaluationInfo?evalInfo, IDbgValueNodeFormatParameters options, CultureInfo?cultureInfo)
 {
     if (!(options.NameOutput is null))
     {
         FormatName(evalInfo, options.NameOutput, options.NameFormatterOptions, cultureInfo);
     }
     if (!(options.ValueOutput is null))
     {
         FormatValue(evalInfo, options.ValueOutput, options.ValueFormatterOptions, cultureInfo);
     }
 }
Exemple #4
0
        void FormatCore(DbgEvaluationContext context, DbgStackFrame frame, IDbgValueNodeFormatParameters options, CultureInfo cultureInfo, CancellationToken cancellationToken)
        {
            context.Runtime.GetDotNetRuntime().Dispatcher.VerifyAccess();
            if (options.NameOutput != null)
            {
                dnValueNode.Name.WriteTo(options.NameOutput);
            }
            var formatter = owner.Formatter;
            var dnValue   = value?.DotNetValue;

            if (options.ExpectedTypeOutput != null)
            {
                if (dnValueNode.FormatExpectedType(context, frame, options.ExpectedTypeOutput, cultureInfo, cancellationToken))
                {
                    // Nothing
                }
                else if (dnValueNode.ExpectedType is DmdType expectedType)
                {
                    formatter.FormatType(context, options.ExpectedTypeOutput, expectedType, null, options.ExpectedTypeFormatterOptions, cultureInfo);
                }
                cancellationToken.ThrowIfCancellationRequested();
            }
            if (options.ActualTypeOutput != null)
            {
                if (dnValueNode.FormatActualType(context, frame, options.ActualTypeOutput, cultureInfo, cancellationToken))
                {
                    // Nothing
                }
                else if (dnValueNode.ActualType is DmdType actualType)
                {
                    formatter.FormatType(context, options.ActualTypeOutput, actualType, dnValue, options.ActualTypeFormatterOptions, cultureInfo);
                }
                cancellationToken.ThrowIfCancellationRequested();
            }
            if (options.ValueOutput != null)
            {
                if (dnValueNode.FormatValue(context, frame, options.ValueOutput, cultureInfo, cancellationToken))
                {
                    // Nothing
                }
                else if (dnValue != null)
                {
                    formatter.FormatValue(context, options.ValueOutput, frame, dnValue, options.ValueFormatterOptions, cultureInfo, cancellationToken);
                }
                else if (ErrorMessage is string errorMessage)
                {
                    options.ValueOutput.Write(BoxedTextColor.Error, owner.ErrorMessagesHelper.GetErrorMessage(errorMessage));
                }
                cancellationToken.ThrowIfCancellationRequested();
            }
        }
Exemple #5
0
        public override void Format(DbgEvaluationInfo evalInfo, IDbgValueNodeFormatParameters options, CultureInfo?cultureInfo)
        {
            var dispatcher = evalInfo.Runtime.GetDotNetRuntime().Dispatcher;

            if (dispatcher.CheckAccess())
            {
                FormatCore(evalInfo, options, cultureInfo);
            }
            else
            {
                Format2(dispatcher, evalInfo, options, cultureInfo);
            }

            void Format2(DbgDotNetDispatcher dispatcher2, DbgEvaluationInfo evalInfo2, IDbgValueNodeFormatParameters options2, CultureInfo?cultureInfo2) =>
            dispatcher2.TryInvokeRethrow(() => FormatCore(evalInfo2, options2, cultureInfo2));
        }
Exemple #6
0
 public sealed override void Format(DbgEvaluationInfo?evalInfo, IDbgValueNodeFormatParameters options, CultureInfo?cultureInfo)
 {
     if (!(options.NameOutput is null))
     {
         FormatName(evalInfo, options.NameOutput, options.NameFormatterOptions, cultureInfo);
     }
     if (!(options.ValueOutput is null))
     {
         FormatValue(evalInfo, options.ValueOutput, options.ValueFormatterOptions, cultureInfo);
     }
     if (!(options.ExpectedTypeOutput is null))
     {
         WriteTo(options.ExpectedTypeOutput, CachedExpectedType);
     }
     if (!(options.ActualTypeOutput is null))
     {
         WriteTo(options.ActualTypeOutput, CachedActualType);
     }
 }
Exemple #7
0
 public override void Format(DbgEvaluationInfo?evalInfo, IDbgValueNodeFormatParameters options, CultureInfo?cultureInfo)
 {
 }
Exemple #8
0
 public abstract void Format(DbgEvaluationInfo?evalInfo, IDbgValueNodeFormatParameters options, CultureInfo?cultureInfo);
Exemple #9
0
 /// <summary>
 /// Formats the name, value, and type. This method blocks the current thread until all requested values have been formatted
 /// </summary>
 /// <param name="context">Evaluation context</param>
 /// <param name="frame">Frame</param>
 /// <param name="options">Options</param>
 /// <param name="cultureInfo">Culture or null to use invariant culture</param>
 /// <param name="cancellationToken">Cancellation token</param>
 public abstract void Format(DbgEvaluationContext context, DbgStackFrame frame, IDbgValueNodeFormatParameters options, CultureInfo cultureInfo, CancellationToken cancellationToken);
Exemple #10
0
 public override void Format(DbgEvaluationContext context, DbgStackFrame frame, IDbgValueNodeFormatParameters options, CultureInfo cultureInfo)
 {
 }
Exemple #11
0
 public sealed override void Format(DbgEvaluationContext context, DbgStackFrame frame, IDbgValueNodeFormatParameters options, CultureInfo cultureInfo)
 {
     if (options.NameOutput != null)
     {
         FormatName(context, frame, options.NameOutput, cultureInfo);
     }
     if (options.ValueOutput != null)
     {
         FormatValue(context, frame, options.ValueOutput, options.ValueFormatterOptions, cultureInfo);
     }
     if (options.ExpectedTypeOutput != null)
     {
         WriteTo(options.ExpectedTypeOutput, CachedExpectedType);
     }
     if (options.ActualTypeOutput != null)
     {
         WriteTo(options.ActualTypeOutput, CachedActualType);
     }
 }
Exemple #12
0
 public override void Format(DbgEvaluationContext context, DbgStackFrame frame, IDbgValueNodeFormatParameters options, CultureInfo cultureInfo)
 {
     if (options.NameOutput != null)
     {
         FormatName(context, frame, options.NameOutput, cultureInfo);
     }
     if (options.ValueOutput != null)
     {
         FormatValue(context, frame, options.ValueOutput, options.ValueFormatterOptions, cultureInfo);
     }
 }
Exemple #13
0
        public override void Format(DbgEvaluationContext context, DbgStackFrame frame, IDbgValueNodeFormatParameters options, CultureInfo cultureInfo, CancellationToken cancellationToken)
        {
            var dispatcher = context.Runtime.GetDotNetRuntime().Dispatcher;

            if (dispatcher.CheckAccess())
            {
                FormatCore(context, frame, options, cultureInfo, cancellationToken);
            }
            else
            {
                Format2(dispatcher, context, frame, options, cultureInfo, cancellationToken);
            }

            void Format2(DbgDotNetDispatcher dispatcher2, DbgEvaluationContext context2, DbgStackFrame frame2, IDbgValueNodeFormatParameters options2, CultureInfo cultureInfo2, CancellationToken cancellationToken2) =>
            dispatcher2.InvokeRethrow(() => FormatCore(context2, frame2, options2, cultureInfo2, cancellationToken2));
        }
Exemple #14
0
 public override void Format(DbgEvaluationContext context, DbgStackFrame frame, IDbgValueNodeFormatParameters options, CultureInfo cultureInfo, CancellationToken cancellationToken)
 {
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     if (!(context is DbgEvaluationContextImpl))
     {
         throw new ArgumentException();
     }
     if (context.Language != Language)
     {
         throw new ArgumentException();
     }
     if (context.Runtime != Runtime)
     {
         throw new ArgumentException();
     }
     if (frame == null)
     {
         throw new ArgumentNullException(nameof(frame));
     }
     if (!(frame is DbgStackFrameImpl))
     {
         throw new ArgumentException();
     }
     if (frame.Runtime != Runtime)
     {
         throw new ArgumentException();
     }
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     engineValueNode.Format(context, frame, options, cultureInfo, cancellationToken);
 }