VB.net如果/ else执行bug ......? [英] VB.net If / else execution bug...?

查看:70
本文介绍了VB.net如果/ else执行bug ......?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有其他人遇到以下情况...



我的代码类似于

I'm wondering if anyone else has run into the following...

I have code similar to

Dim ServerSet as Boolean = False              ' determine at least one server is selected
Dim Server as String = "MSN"                  ' This is actually from a structure
If Server = "MSN" then
  ServerSet = True                            ' Sets the 'flag' that a server has been selected
  ...
  ...
End If
If Server = "YAHOO" then
  ServerSet = True
  ...
  ...
End If
If ServerSet = True then                      ' if a server has been selected...
  Sendemail                                   ' sub that sends an email
Else                                          ' if a server hasn't been selected
  WriteErrorLog("Mail Server not selected")   ' sub that writes a message to a log file
End If



问题是我收到了电子邮件,当我查看日志时,错误信息也已被记录....



认为错误消息记录在另一部分代码中我更改了该特定行上的消息,更改显示在日志中,30秒后,电子邮件也进入了



它似乎正在执行SendEmail和WriteErrorLog潜艇,但是逐行走,甚至在WriteErrorLog上放置一个断点,该行永远不会执行但仍然写入日志并发送电子邮件。



任何人?


The 'issue' is that I'm receiving the email and when I check the log, the error message has been logged as well....

Thinking the error message was logged in another section of code I changed the message on that specific line and the change showed up in the log and 30 seconds later, the email came in as well

It appears to be executing both the SendEmail and WriteErrorLog subs but walking line by line and even putting a break point on the WriteErrorLog, the line never executes but still writes to the log AND sends the email.

Anyone?

推荐答案

在极少数情况下,Visual Studio可以丢失跟踪哪些程序集需要重建并在选择调试/执行时执行过时的程序集。当看起来有一个没有意义的奇怪错误时,重建解决方案很有可能解决这个问题。
In rare cases Visual Studio can lose track which assemblies need rebuilding and executes an out-of-date assembly when selecting debug/execute. When there seems to be a strange bug that makes no sense, rebuilding the solution has a good chance to fix this.


这篇关于VB.net如果/ else执行bug ......?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆