小编Chr*_*ris的帖子

在Visual Studio 2013中对托管单元测试使用混合模式调试

我在Visual Studio 2013测试框架中进行了C#单元测试,该测试框架运行CLI和本机代码.我想在执行C#单元测试时调查代码的本机部分.但是,运行Test - > Debug - > All Tests运行托管调试器,因此本机代码中的断点不会被命中,我无法跟踪C# - > C++/CLI代码,就像在混合模式调试器下运行程序一样.

例如,我的单元测试中的代码:

[TestMethod]
public void TestRoundTripEvaluate()
{
     var obj = new MyCLIObject();
     var roundtripped = RoundtripXml( obj );

     // I would like to trace into here to see why Equals returns false.
     // But the definition for MyCLIObject is in a CPP file and cannot be navigated 
     // to running the unit test because Visual Studio starts the debugger as "managed only"
     // when using Test -> Debug …
Run Code Online (Sandbox Code Playgroud)

c# mixed-mode unit-testing visual-studio-2013

17
推荐指数
1
解决办法
2016
查看次数

使用 AvalonEdit 自定义超链接

我正在尝试使用 AvalonEdit 创建自定义超链接。我创建了一个生成器(基于示例),它可以识别语法,并且可以设置 Uri:

  public class LinkGenerator : VisualLineElementGenerator
  {
    readonly static Regex imageRegex = new Regex(@"<mylink>", RegexOptions.IgnoreCase);

    public LinkGenerator()
    {}

    Match FindMatch(int startOffset)
    {
        // fetch the end offset of the VisualLine being generated
        int endOffset = CurrentContext.VisualLine.LastDocumentLine.EndOffset;
        TextDocument document = CurrentContext.Document;
        string relevantText = document.GetText(startOffset, endOffset - startOffset);
        return imageRegex.Match(relevantText);
    }

    /// Gets the first offset >= startOffset where the generator wants to construct
    /// an element.
    /// Return -1 to signal no interest.
    public override int GetFirstInterestedOffset(int …
Run Code Online (Sandbox Code Playgroud)

c# wpf avalonedit

3
推荐指数
1
解决办法
1511
查看次数