Exception.Message contains only the message (doh) associated with the exception. Example:

Object reference not set to an instance of an object

The Exception.ToString() method will give a much more verbose output, containing the exception type, the message (from before), a stack trace, and all of these things again for nested/inner exceptions. More precisely, the method returns the following:

ToString returns a representation of the current exception that is intended to be understood by humans. Where the exception contains culture-sensitive data, the string representation returned by ToString is required to take into account the current system culture. Although there are no exact requirements for the format of the returned string, it should attempt to reflect the value of the object as perceived by the user.

The default implementation of ToString obtains the name of the class that threw the current exception, the message, the result of calling ToString on the inner exception, and the result of calling Environment.StackTrace. If any of these members is a null reference (Nothing in Visual Basic), its value is not included in the returned string.

If there is no error message or if it is an empty string (""), then no error message is returned. The name of the inner exception and the stack trace are returned only if they are not a null reference (Nothing in Visual Basic).

Use Exception.ToString() instead of Exception.Message.的更多相关文章

  1. exception 'yii\base\ErrorException' with message 'Class 'MongoClient' not found'

    问题描述: 本来项目运行的好好的,搬了一次办公室(电脑主机一起搬的),第二天的时候就登录不了了. php版本和扩展没有改变,且没有修改任何配置,我尝试重启php5-fpm 服务,又重启nginx服务, ...

  2. springcloud 集成kafka问题记录,发消息报错:ERROR o.s.kafka.support.LoggingProducerListener - Exception thrown when sending a message with key='null' and payload='{-1,

    在springcloud集成kafka,发送消息时报错: 2018-08-15 16:01:34.159 [http-nio-8081-exec-1] INFO  org.apache.kafka.c ...

  3. 扩展Exception,增加判断Exception是否为SQL引用约束异常方法!

    在设计数据表时,如果将某些列设置为关联其它表的外键,那么如果对其进行增加.修改操作时,其关联表若没有相匹配的记录则报错,或者在对其关联表进行删除时,也会报错,这就是外键约束的作用,当然除了外键还有许多 ...

  4. org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Cannot open con

    org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session f ...

  5. org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener threw exception

    RabbitMQ   报出的错! org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException ...

  6. HTTP Status 500 - Request processing failed; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement

    1.什么操作出现:当我在项目中添加产品或者修改时,浏览器出现HTTP Status 500 - Request processing failed; nested exception is org.h ...

  7. code is 9998;desc is 插入失败exception is org.hibernate.exception.JDBCConnectionException: Could not op

    1.错误描述 [ERROR:]2015-05-05 09:27:12,090 [插入失败] org.hibernate.exception.JDBCConnectionException: Could ...

  8. 报错org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet"

    org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n ...

  9. 【hibernate】报错:org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement

    报错如下: org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a ...

随机推荐

  1. luogu1632 点的移动

    其实只需要开三重循环 根据OI中的一个重要的原理 给定一个序列a,求一个数x使得\(\sum |a_i-x|\)最小,那么这个数是序列a的中位数 证明略 然后既然是中位数,一定是数列中的数,类比到这题 ...

  2. [HAOI2012]音量调节 BZOJ2748 dp

    题目描述 一个吉他手准备参加一场演出.他不喜欢在演出时始终使用同一个音量,所以他决定每一首歌之前他都需要改变一次音量.在演出开始之前,他已经做好一个列表,里面写着每首歌开始之前他想要改变的音量是多少. ...

  3. centos下yum搭建安装linux+apache+mysql+php环境教程

    我们利用linux系统中yum安装Apache+MySQL+PHP是非常的简单哦,只需要几步就可以完成,具体如下: 一.脚本YUM源安装: 1.yum install wget             ...

  4. CentOS7l联网

    原文:https://blog.csdn.net/nothing2017/article/details/61420767 步骤: 1.以root管理员身份登录系统,输入   --->(ls / ...

  5. vs快捷键(SharePoint项目)

    1.ctrl+c,alt+c,shift+ctrl+c: ========== Copying to SharePoint Root =========={ProjectRoot}\pkg\Debug ...

  6. linux学习四x系统指令

    一.任务调度 任务调度:系统在某个时间执行特定的命令或者程序 如: 1.对于一些需要周期性执行的一些系统指令 2.定期的病毒扫描 3.定期数据库备份等   命令:crontab 设置任务调度文件: / ...

  7. 斑马打印机客户端GET和POST,以及后端两种打印方式。

    斑马打印机客户端GET和POST,以及后端两种打印方式. 背景环境:打印机安装在客户端外网.当用户登录时,通过ajax取服务器数据,返回打印机命令,然后客户端通过JS发送给斑马打印机. 1.使用Get ...

  8. ubuntu下用apt-get安装lamp缺少mcrypt , curl

    用apt-get安装的LAMP环境,但安装magento报没有mcrypt和curl,   解决方法如下: curl安装: sudo apt-get install curl libcurl3 lib ...

  9. 约瑟夫环问题poj1012

    题意: 有k个坏人k个好人坐成一圈,前k个为好人(编号1~k),后k个为坏人(编号k+1~2k) 现在有一个报数m,从编号为1的人开始报数,报到m的人就要自动死去. 问当m为什么值时,可以使得在出现好 ...

  10. thinkphp自动验证和自动完成

    tp验证码的自动验证小案例 模板文件 <form action="" method="post"> <p> User: <inpu ...