GVKun编程网logo

C#反射DeBugInfo(C#反射的应用场景)

7

如果您想了解C#反射DeBugInfo和C#反射的应用场景的知识,那么本篇文章将是您的不二之选。我们将深入剖析C#反射DeBugInfo的各个方面,并为您解答C#反射的应用场景的疑在这篇文章中,我们将

如果您想了解C#反射DeBugInfoC#反射的应用场景的知识,那么本篇文章将是您的不二之选。我们将深入剖析C#反射DeBugInfo的各个方面,并为您解答C#反射的应用场景的疑在这篇文章中,我们将为您介绍C#反射DeBugInfo的相关知识,同时也会详细的解释C#反射的应用场景的运用方法,并给出实际的案例分析,希望能帮助到您!

本文目录一览:

C#反射DeBugInfo(C#反射的应用场景)

C#反射DeBugInfo(C#反射的应用场景)

using System;
using System.Reflection;

namespace BugFixApplication {
   //a custom attribute BugFix to be
   //assigned to a class and its members
   [AttributeUsage(AttributeTargets.Class |
   AttributeTargets.Constructor |
   AttributeTargets.Field |
   AttributeTargets.Method |
   AttributeTargets.Property,
   AllowMultiple = true)]

   public class DeBugInfo : System.Attribute {
      private int bugNo;
      private string developer;
      private string lastReview;
      public string message;

      public DeBugInfo(int bg, string dev, string d) {
         this.bugNo = bg;
         this.developer = dev;
         this.lastReview = d;
      }

      public int BugNo {
         get {
            return bugNo;
         }
      }

      public string Developer {
         get {
            return developer;
         }
      }

      public string LastReview {
         get {
            return lastReview;
         }
      }

      public string Message {
         get {
            return message;
         }
         set {
            message = value;
         }
      }
   }
   [DeBugInfo(45, Zara Ali, 12/8/2012, Message = Return type mismatch)]
   [DeBugInfo(49, Nuha Ali, 10/10/2012, Message = Unused variable)]

   class Rectangle {
      //member variables
      protected double length;
      protected double width;
      public Rectangle(double l, double w) {
         length = l;
         width = w;
      }

      [DeBugInfo(55, Zara Ali, 19/10/2012, Message = Return type mismatch)]
      public double GetArea() {
         return length * width;
      }

      [DeBugInfo(56, Zara Ali, 19/10/2012)]
      public void display() {
         Console.WriteLine(Length: {0}, length);
         Console.WriteLine(Width: {0}, width);
         Console.WriteLine(Area: {0}, GetArea());
      }
   }//end class Rectangle

   class ExecuteRectangle {
      static void Main(string[] args) {
         Rectangle r = new Rectangle(4.5, 7.5);
         r.display();
         Type type = typeof(Rectangle);

         //iterating through the attribtues of the Rectangle class
         foreach (Object attributes in type.GetCustomAttributes(false)) {
            DeBugInfo dbi = (DeBugInfo)attributes;

            if (null != dbi) {
               Console.WriteLine(Bug no: {0}, dbi.BugNo);
               Console.WriteLine(Developer: {0}, dbi.Developer);
               Console.WriteLine(Last Reviewed: {0}, dbi.LastReview);
               Console.WriteLine(Remarks: {0}, dbi.Message);
            }
         }

         //iterating through the method attribtues
         foreach (MethodInfo m in type.getmethods()) {

            foreach (Attribute a in m.GetCustomAttributes(true)) {
               DeBugInfo dbi = (DeBugInfo)a;

               if (null != dbi) {
                  Console.WriteLine(Bug no: {0}, for Method: {1}, dbi.BugNo, m.Name);
                  Console.WriteLine(Developer: {0}, dbi.Developer);
                  Console.WriteLine(Last Reviewed: {0}, dbi.LastReview);
                  Console.WriteLine(Remarks: {0}, dbi.Message);
               }
            }
         }
         Console.ReadLine();
      }
   }
}

Android 模拟器 Debug 总是 Waiting for debuger

Android 模拟器 Debug 总是 Waiting for debuger

如题,尝试了很多网络上的说法都没有作用。

Debgu时总显示Waiting for debuger!

谢谢解答!

angularjs – 如何仅为单元测试激活debugInfoEnabled?

angularjs – 如何仅为单元测试激活debugInfoEnabled?

在我的 angularjs 1.3应用程序中,我禁用调试信息以提高性能:

$compileProvider.debugInfoEnabled(false);

但是当我用Karma启动我的Jasmine测试时,我遇到了isolateScope的错误:

var isoScope = element.isolateScope();

我知道这是完全正常的,
但我正在寻找一种方法来重新激活调试只是为了测试.
我能以编程方式完成吗?
我可以在karma-unit.conf.js中定义它吗?

解决方法

我的方法是创建一组配置文件,通过grunt或gulp创建特定于加载的文件,具体取决于任务或环境变量.

示例配置:

// configFileLocal.js
angular.module('myapp.config')
.constant('apiUrl','https://myapi.com/api')
.constant('debugInfoState',true);

Gruntfile的摘录:

copy: {
  test: {
    src: (function () {
      var filename;
      if (process.env.REMOTE_TESTS) {
        filename = './config-files/configFileTestsRemote.js';
      } else {
        filename = './config-files/configFileTestsLocal.js';
      }
      return filename;
    })(),dest: '<%= yeoman.app %>/scripts/root/config.js',},dev: {
    src: './config-files/configFileLocal.js',...

那么当然你需要在你的应用程序中加载它,如下所示:

angular.module('myapp')
.config(function ($compileProvider,debugInfoState) {
  $compileProvider.debugInfoEnabled(debugInfoState);
});

所以/app/scripts/root/config.js每次都被覆盖.在index.html中,唯一加载的文件是/app/scripts/root/config.js应在任何串联任务之前运行此任务.

centos 6 debuginfo存储库没有可用的httpd调试版本

centos 6 debuginfo存储库没有可用的httpd调试版本

我正在尝试获取httpd的调试版本,以便我可以将它与gdb结合使用.我很难得到它们,而且它们似乎不在标准的epel-debuginfo存储库中.我该怎么办?
> [root@buildBox-rhel6 ~]# debuginfo-install httpd
Loaded plugins: fastestmirror,presto
enabling epel-debuginfo
Loading mirror speeds from cached hostfile
epel-debuginfo/Metalink                                                                              | 8.3 kB     00:00     
 * base: mirrors.cicku.me
 * epel: mirrors.kernel.org
 * epel-debuginfo: mirrors.kernel.org
 * extras: mirrors.arpnetworks.com
 * updates: linux.mirrors.es.net
epel-debuginfo                                                                                       | 3.1 kB     00:00     
epel-debuginfo/primary_db                                                                            | 487 kB     00:01     
Checking for new repos for mirrors
Could not find debuginfo for main pkg: httpd-2.2.15-15.el6.centos.1.x86_64
Could not find debuginfo pkg for dependency package apr-1.3.9-5.el6_2.x86_64
Could not find debuginfo pkg for dependency package apr-util-1.3.9-3.el6_0.1.x86_64
Could not find debuginfo pkg for dependency package glibc-2.12-1.80.el6_3.6.x86_64
Could not find debuginfo pkg for dependency package glibc-2.12-1.80.el6_3.6.x86_64
Could not find debuginfo pkg for dependency package glibc-2.12-1.80.el6_3.6.x86_64
Could not find debuginfo pkg for dependency package glibc-2.12-1.80.el6_3.6.x86_64
Could not find debuginfo pkg for dependency package glibc-2.12-1.80.el6_3.6.x86_64
Could not find debuginfo pkg for dependency package glibc-2.12-1.80.el6_3.6.x86_64
Could not find debuginfo pkg for dependency package db4-4.7.25-17.el6.x86_64
Could not find debuginfo pkg for dependency package expat-2.0.1-11.el6_2.x86_64
Could not find debuginfo pkg for dependency package openldap-2.4.23-26.el6_3.2.x86_64
Could not find debuginfo pkg for dependency package openldap-2.4.23-26.el6_3.2.x86_64
Could not find debuginfo pkg for dependency package glibc-2.12-1.80.el6_3.6.x86_64
Could not find debuginfo pkg for dependency package pcre-7.8-4.el6.x86_64
Could not find debuginfo pkg for dependency package glibc-2.12-1.80.el6_3.6.x86_64
Could not find debuginfo pkg for dependency package glibc-2.12-1.80.el6_3.6.x86_64
Could not find debuginfo pkg for dependency package libselinux-2.0.94-5.3.el6.x86_64
Could not find debuginfo pkg for dependency package zlib-1.2.3-27.el6.x86_64
No debuginfo packages available to install
看起来 debuginfo-install只搜索epel-debuginfo. httpd不在EPEL中. httpd debuginfo位于名为“ debug”的仓库中.

启用调试回购:

debuginfo-install --enablerepo=debug httpd

如果这不起作用使用yum:

yum --nogpgcheck --enablerepo=debug install httpd-debuginfo

CentOS 6.7上使用gdb调试时出现Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.192.el6.x86_64

CentOS 6.7上使用gdb调试时出现Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.192.el6.x86_64

CentOS 6.7上使用gdb调试时出现Missing separate debuginfos,use: debuginfo-install glibc-2.12-1.192.el6.x86_64

1、先修改/etc/yum.repos.d/CentOS-Debuginfo.repo里面的debuginfo目录中enabled=1
2、yum install nss-softokn-debuginfo(可选)
**3、根据提示输入:debuginfo-install glibc-2.12-1.192.el6.x86_64 安装成功后就可以了**

关于C#反射DeBugInfoC#反射的应用场景的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于Android 模拟器 Debug 总是 Waiting for debuger、angularjs – 如何仅为单元测试激活debugInfoEnabled?、centos 6 debuginfo存储库没有可用的httpd调试版本、CentOS 6.7上使用gdb调试时出现Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.192.el6.x86_64的相关知识,请在本站寻找。

本文标签: