0
오류를 컴파일 ... 그리고 나는이 개 간단한 프로젝트했습니다 :PostSharp 내가 postsharp 1.5과 함께 제공되는 예제를 따라 한
[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");
}
}
, I했습니다 다음의 시험기구 :
나는이 같은 테스트 케이스를했습니다코드는 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
어떻게해야합니까?
저는 RTM을 사용하고 있었는데, 모르겠어요. 새로운 솔루션을 처음부터 시작 했으므로 매력처럼 작동합니다. 내가 재현을 할 수 있는지 알 겠어. 감사합니다. –
VS 2008에서 동일한 문제가 있습니다. PostSharp 2.0. CS에서 새로운 클래스 라이브러리 프로젝트를 만들고 PostSharp.dll에 대한 참조를 추가하고 컴파일하려고 시도했습니다. –
VS2010 PostSharp 2.0 Win7 x64에서 동일합니다. 거의 같은 코드. – Maciek