【C#】 Method invocation is skipped

相信大家看到这个标题也是一头雾水了. 这个问题主要是我在项目中遇到了一个问题, 然后我通过搜索引擎搜索的关键词进而找到了answer, 我先描述一下我遇到的问题:
做项目的时候我发现log时常没有输出, 就是有log文件生成但是里面并没有任何内容.
我好奇这个问题并开始寻找问题原因. 项目中用的log类是.net提供的System.Diagnostics.TraceSource, 并不是像我之前做项目时候都是引用的自己写的log类, 这个类我之前也没有用过, 从网上查了一些资料发现还是很灵活的, 可以配置很多licenser用于监控log的输出,我们的log文件实际上属于一种FileLogTraceListener, 是一种文本类型的日志监听者, 所以我网上搜索这种问题的现象, 但是没有找到跟我类似的情况的解决方案,
这时候我跟代码的时候发现我的插件提示我这行代码被skipped, 于是我就在搜索引擎里面搜索这个现象, 第一个解决方案就跟我一样.
1216080-20181220192445721-1718440448.png
看到这个问题是将vs的project的属性中将trace level勾选即可.
1216080-20181220192546513-1351843798.png

Feel free to send email to: Dennis
N|Dennis

转载于:https://www.cnblogs.com/it-dennis/p/10151742.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Version 1.7 ----------- - ADD: Delphi/CBuilder 10.2 Tokyo now supported. - ADD: Delphi/CBuilder 10.1 Berlin now supported. - ADD: Delphi/CBuilder 10 Seattle now supported. - ADD: Delphi/CBuilder XE8 now supported. - ADD: Delphi/CBuilder XE7 now supported. - ADD: Delphi/CBuilder XE6 now supported. - ADD: Delphi/CBuilder XE5 now supported. - ADD: Delphi/CBuilder XE4 now supported. - ADD: Delphi/CBuilder XE3 now supported. - ADD: Delphi/CBuilder XE2 now supported. - ADD: Delphi/CBuilder XE now supported. - ADD: Delphi/CBuilder 2010 now supported. - ADD: Delphi/CBuilder 2009 now supported. - ADD: New demo project FlexCADImport. - FIX: The height of the TFlexRegularPolygon object incorrectly changes with its rotation. - FIX: Added division by zero protect in method TFlexControl.MovePathSegment. - FIX: The background beyond docuemnt wasn't filled when TFlexPanel.DocClipping=True. - FIX: In "Windows ClearType" font rendering mode (OS Windows mode) the "garbage" pixels can appear from the right and from the bottom sides of the painted rectangle of the TFlexText object. - FIX: The result rectangle incorrectly calculated in the TFlexText.GetRefreshRect method. - FIX: Added FPaintCache.rcPaint cleanup in the TFlexPanel.WMPaint method. Now it is possible to define is the drawing take place via WMPaint or via the PaintTo direct call (if rcPaint contain non-empty rectangle then WMPaint in progress). - FIX: The TFlexPanel.FPaintCache field moved in the protected class section. Added rcPaint field in FPaintCache that represents drawing rectangle. - ADD: In the text prcise mode (TFlexText.Precise=True) takes into account the rotation angle (TFlexText.Angle). - FIX: Removed FG_NEWTEXTROTATE directive (the TFlexText Precise mode should be used instead). - FIX: The TFlexRegularPolygon object clones incorrectly drawed in case when TFlexRegularPolygon have alternative brush (gradient, texture). - ADD: Add TFlexPanel.InvalidateControl virtual method which calls from TFle
您可以使用AspectJ来获取方法执行时的连接点(joinpoint)和方法调用(method invocation)信息。AspectJ是一个面向切面编程的扩展,它可以与Java一起使用。 要获取方法执行时的连接点信息,您可以使用AspectJ的@Around注解来定义一个环绕通知(around advice)。在环绕通知中,您可以通过ProceedingJoinPoint参数来获取方法执行的连接点信息。 下面是一个示例代码片段,展示了如何使用AspectJ的@Around注解来获取方法执行时的连接点和方法调用信息: ```java import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; @Aspect public class MethodInvocationAspect { @Around("execution(* com.example.myapp.MyClass.myMethod(..))") public Object aroundMethod(ProceedingJoinPoint joinPoint) throws Throwable { // 获取方法调用的连接点信息 String methodName = joinPoint.getSignature().getName(); Object[] args = joinPoint.getArgs(); // 输出连接点和方法调用信息 System.out.println("Method name: " + methodName); System.out.println("Arguments: " + Arrays.toString(args)); // 执行原始方法 Object result = joinPoint.proceed(); // 在方法执行后可以进行一些操作 return result; } } ``` 在上面的示例中,@Around注解指定了要拦截的方法执行连接点,这里拦截了名为"myMethod"的方法。在aroundMethod方法中,可以通过ProceedingJoinPoint参数获取方法调用的连接点信息,如方法名和参数。然后,您可以根据需要执行其他操作,并调用joinPoint.proceed()来继续执行原始方法。 请注意,使用AspectJ需要进行相关配置,并将AspectJ的相关库添加到项目中。具体的配置和使用方式可以参考AspectJ的官方文档。 希望这个示例可以帮助您获取方法执行时的连接点和方法调用信息!如果您有任何疑问,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值