-1

私はpostsharp 1.5に付属する例に従いました..そして、2つの簡単なプロジェクトがあります:

次のような側面があります。

[Serializable]
public class MyAspectAttribute : OnMethodBoundaryAspect
{
    public override void OnEntry(MethodExecutionEventArgs eventArgs)
    {
        Console.WriteLine(eventArgs.Method.Name);
        base.OnEntry(eventArgs);
    }
}

他のプロジェクトでは、次のようなテスト ケースがあります。

public class Test
{
    [MyAspect]
    public void DoSomething()
    {
        Console.Write("aa");
    }
}

「テスト」の同じプロジェクトでは、次のテスト フィクスチャがあります。

[TestFixture]
public class TestFixture
{
    [Test]
    public void TestDoSomething()
    {
        var a = new Test();
        a.DoSomething();
    }}

postsharp 例外のため、コードはコンパイルされません。

Error   2   Unhandled exception: System.InvalidCastException: Unable to cast object of type 'PostSharp.CodeModel.TypeDefDeclaration' to type 'PostSharp.CodeModel.IMethod'.
   at PostSharp.Laos.Weaver.MethodLevelAspectWeaver.get_TargetMethod()
   at PostSharp.Laos.Weaver.MethodLevelAspectWeaver.Initialize()
   at PostSharp.Laos.Weaver.OnMethodBoundaryAspectWeaver.Initialize()
   at PostSharp.Laos.Weaver.LaosTask.Execute()
   at PostSharp.Extensibility.Project.ExecutePhase(String phase)
   at PostSharp.Extensibility.Project.Execute()
   at PostSharp.Extensibility.PostSharpObject.ExecuteProjects()
   at PostSharp.Extensibility.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation)
   at PostSharp.MSBuild.PostSharpRemoteTask.Execute(PostSharpTaskParameters parameters, TaskLoggingHelper log)  MyExample.Tests

私は何をすべきか?

4

1 に答える 1

0

バグのように見えますが、サンプルがこのバグを引き起こす可能性があるのではないかと思います。最新のビルドで試しましたか、それともRTMだけで試しましたか?

バグが解決されない場合は、repro(自己完結型のコマンドラインプロジェクト)をsupport@sharpcrafters.comに送信できますか?

于 2010-03-06T13:31:45.950 に答える