debug vs release

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mel

    #1

    debug vs release

    I want to send an email in release mode but not in debug mode, how
    would I accomplish this?

    Here is my email code (using vb.net, visual studio 2005, winxp pro
    sp2):
    Try
    Dim MailMsg As New MailMessage(New
    MailAddress("fr om@mycompany.co m"), New
    MailAddress("to thedeveloper@my company.com")) 'from, to
    MailMsg.Subject = "Program Generated an Error"
    MailMsg.Body = "List Error number and description here"
    MailMsg.Priorit y = MailPriority.Hi gh
    MailMsg.IsBodyH tml = True
    'Smtpclient to send the mail message
    Dim SmtpMail As New SmtpClient
    SmtpMail.Host = "MYEXCHANGESERV ER"
    SmtpMail.Send(M ailMsg) 'sends the email
    Catch ex As System.Exceptio n
    'Message Error
    End Try
  • =?Utf-8?B?S2VuIFR1Y2tlciBbTVZQXQ==?=

    #2
    RE: debug vs release

    Try something like this

    SmtpMail.Host = "MYEXCHANGESERV ER"
    #If Not Debug then
    SmtpMail.Send(M ailMsg) 'sends the email
    #Endif
    Catch ex As System.Exceptio n

    Ken
    --------------------------
    "Mel" wrote:
    I want to send an email in release mode but not in debug mode, how
    would I accomplish this?
    >
    Here is my email code (using vb.net, visual studio 2005, winxp pro
    sp2):
    Try
    Dim MailMsg As New MailMessage(New
    MailAddress("fr om@mycompany.co m"), New
    MailAddress("to thedeveloper@my company.com")) 'from, to
    MailMsg.Subject = "Program Generated an Error"
    MailMsg.Body = "List Error number and description here"
    MailMsg.Priorit y = MailPriority.Hi gh
    MailMsg.IsBodyH tml = True
    'Smtpclient to send the mail message
    Dim SmtpMail As New SmtpClient
    SmtpMail.Host = "MYEXCHANGESERV ER"
    SmtpMail.Send(M ailMsg) 'sends the email
    Catch ex As System.Exceptio n
    'Message Error
    End Try
    >

    Comment

    • Mel

      #3
      Re: debug vs release

      On Oct 9, 8:35 pm, Ken Tucker [MVP]
      <KenTucker...@d iscussions.micr osoft.comwrote:
      Try something like this
      >
                   SmtpMail.Host = "MYEXCHANGESERV ER"
      #If Not Debug then
                   SmtpMail.Send(M ailMsg)  'sends the email
      #Endif
               Catch ex As System.Exceptio n
      >
      Ken
      --------------------------
      >
      >
      >
      "Mel" wrote:
      I want to send an email in release mode but not in debug mode, how
      would I accomplish this?
      >
      Here is my email code (using vb.net, visual studio 2005, winxp pro
      sp2):
              Try
                  Dim MailMsg As New MailMessage(New
      MailAddress("f. ..@mycompany.co m"), New
      MailAddress("to thedevelo...@my company.com")) 'from, to
                  MailMsg.Subject = "Program Generated an Error"
                  MailMsg.Body = "List Error number and description here"
                  MailMsg.Priorit y = MailPriority.Hi gh
                  MailMsg.IsBodyH tml = True
                  'Smtpclient to send the mail message
                  Dim SmtpMail As New SmtpClient
                  SmtpMail.Host = "MYEXCHANGESERV ER"
                  SmtpMail.Send(M ailMsg)  'sends the email
              Catch ex As System.Exceptio n
                  'Message Error
              End Try- Hide quoted text -
      >
      - Show quoted text -
      Thanks, that worked great.

      Comment

      • rowe_newsgroups

        #4
        Re: debug vs release

        On Oct 10, 8:08 am, Mel <MLights...@gma il.comwrote:
        On Oct 9, 8:35 pm, Ken Tucker [MVP]
        >
        >
        >
        <KenTucker...@d iscussions.micr osoft.comwrote:
        Try something like this
        >
                     SmtpMail.Host = "MYEXCHANGESERV ER"
        #If Not Debug then
                     SmtpMail.Send(M ailMsg)  'sends the email
        #Endif
                 Catch ex As System.Exceptio n
        >
        Ken
        --------------------------
        >
        "Mel" wrote:
        I want to send an email in release mode but not in debug mode, how
        would I accomplish this?
        >
        Here is my email code (using vb.net, visual studio 2005, winxp pro
        sp2):
                Try
                    Dim MailMsg As New MailMessage(New
        MailAddress("f. ..@mycompany.co m"), New
        MailAddress("to thedevelo...@my company.com")) 'from, to
                    MailMsg.Subject = "Program Generated an Error"
                    MailMsg.Body = "List Error number and description here"
                    MailMsg.Priorit y = MailPriority.Hi gh
                    MailMsg.IsBodyH tml = True
                    'Smtpclient to send the mail message
                    Dim SmtpMail As New SmtpClient
                    SmtpMail.Host = "MYEXCHANGESERV ER"
                    SmtpMail.Send(M ailMsg)  'sends the email
                Catch ex As System.Exceptio n
                    'Message Error
                End Try- Hide quoted text -
        >
        - Show quoted text -
        >
        Thanks, that worked great.
        You can also use System.Diagnost ics.Debugger.Is Attached to detect
        whether the application is being debugged, this can have benefits over
        using a precompiler statement.

        Thanks,

        Seth Rowe [MVP]


        Comment

        • Michel Posseth  [MCP]

          #5
          Re: debug vs release


          "rowe_newsgroup s" <rowe_email@yah oo.comschreef in bericht
          news:c9e2de63-d9c2-425f-86b6-7cee80febe4d@a1 8g2000pra.googl egroups.com...
          On Oct 10, 8:08 am, Mel <MLights...@gma il.comwrote:
          On Oct 9, 8:35 pm, Ken Tucker [MVP]
          >
          >
          >
          <KenTucker...@d iscussions.micr osoft.comwrote:
          Try something like this
          >
          SmtpMail.Host = "MYEXCHANGESERV ER"
          #If Not Debug then
          SmtpMail.Send(M ailMsg) 'sends the email
          #Endif
          Catch ex As System.Exceptio n
          >
          Ken
          --------------------------
          >
          "Mel" wrote:
          I want to send an email in release mode but not in debug mode, how
          would I accomplish this?
          >
          Here is my email code (using vb.net, visual studio 2005, winxp pro
          sp2):
          Try
          Dim MailMsg As New MailMessage(New
          MailAddress("f. ..@mycompany.co m"), New
          MailAddress("to thedevelo...@my company.com")) 'from, to
          MailMsg.Subject = "Program Generated an Error"
          MailMsg.Body = "List Error number and description here"
          MailMsg.Priorit y = MailPriority.Hi gh
          MailMsg.IsBodyH tml = True
          'Smtpclient to send the mail message
          Dim SmtpMail As New SmtpClient
          SmtpMail.Host = "MYEXCHANGESERV ER"
          SmtpMail.Send(M ailMsg) 'sends the email
          Catch ex As System.Exceptio n
          'Message Error
          End Try- Hide quoted text -
          >
          - Show quoted text -
          >
          Thanks, that worked great.
          >You can also use System.Diagnost ics.Debugger.Is Attached to detect
          >whether the application is being debugged, this can have benefits over
          >using a precompiler statement.
          >Thanks,
          >Seth Rowe [MVP]
          >http://sethrowe.blogspot.com/

          Yes advantages and dissadvantages :-)

          1 . if using System.Diagnost ics.Debugger.Is Attached this would mean that
          the code is delivered with your assembly
          while in Ken`s solution the code is there when needed and removed when it
          isn`t ( so the mail code would not be in the assembly )

          2. debugging the compiled executable because it doesn`t send e-mails is
          getting impossible

          3. using runtime checks makes the app slower , while using a precompile
          contstant the app gets faster when you remove the unnecesary code


          regards

          Michel Posseth [MCP]






          Comment

          Working...