コード例 #1
0
ファイル: FrameDecoder.cs プロジェクト: belav/roslyn
        private void GetNameWithGenericTypeArguments(
            DkmWorkList workList,
            DkmStackWalkFrame frame,
            Action <TMethodSymbol> onSuccess,
            Action <Exception> onFailure
            )
        {
            // NOTE: We could always call GetClrGenericParameters, pass them to GetMethod and have that
            // return a constructed method symbol, but it seems unwise to call GetClrGenericParameters
            // for all frames (as this call requires a round-trip to the debuggee process).
            var instructionAddress = (DkmClrInstructionAddress)frame.InstructionAddress;
            var compilation        = _instructionDecoder.GetCompilation(instructionAddress.ModuleInstance);
            var method             = _instructionDecoder.GetMethod(compilation, instructionAddress);
            var typeParameters     = _instructionDecoder.GetAllTypeParameters(method);

            if (!typeParameters.IsEmpty)
            {
                frame.GetClrGenericParameters(
                    workList,
                    result =>
                {
                    try
                    {
                        // DkmGetClrGenericParametersAsyncResult.ParameterTypeNames will throw if ErrorCode != 0.
                        var serializedTypeNames =
                            (result.ErrorCode == 0) ? result.ParameterTypeNames : null;
                        var typeArguments = _instructionDecoder.GetTypeSymbols(
                            compilation,
                            method,
                            serializedTypeNames
                            );
                        if (!typeArguments.IsEmpty)
                        {
                            method = _instructionDecoder.ConstructMethod(
                                method,
                                typeParameters,
                                typeArguments
                                );
                        }
                        onSuccess(method);
                    }
                    catch (Exception e)
                    {
                        onFailure(e);
                    }
                }
                    );
            }
            else
            {
                onSuccess(method);
            }
        }
コード例 #2
0
ファイル: FrameDecoder.cs プロジェクト: tinaschrepfer/roslyn
        private void GetNameWithGenericTypeArguments(
            DkmInspectionContext inspectionContext,
            DkmWorkList workList,
            DkmStackWalkFrame frame,
            Action <TMethodSymbol> onSuccess,
            Action <Exception> onFailure)
        {
            // NOTE: We could always call GetClrGenericParameters, pass them to GetMethod and have that
            // return a constructed method symbol, but it seems unwise to call GetClrGenericParameters
            // for all frames (as this call requires a round-trip to the debuggee process).
            var instructionAddress = (DkmClrInstructionAddress)frame.InstructionAddress;
            var compilation        = _instructionDecoder.GetCompilation(instructionAddress.ModuleInstance);
            var method             = _instructionDecoder.GetMethod(compilation, instructionAddress);
            var typeParameters     = _instructionDecoder.GetAllTypeParameters(method);

            if (!typeParameters.IsEmpty)
            {
                frame.GetClrGenericParameters(
                    workList,
                    result =>
                {
                    try
                    {
                        var typeArguments = _instructionDecoder.GetTypeSymbols(compilation, method, result.ParameterTypeNames);
                        if (!typeArguments.IsEmpty)
                        {
                            method = _instructionDecoder.ConstructMethod(method, typeParameters, typeArguments);
                        }
                        onSuccess(method);
                    }
                    catch (Exception e) when(ExpressionEvaluatorFatalError.ReportNonFatalException(e, DkmComponentManager.ReportCurrentNonFatalException))
                    {
                        onFailure(e);
                    }
                });
            }
            else
            {
                onSuccess(method);
            }
        }