Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Debug not working in VS2015

$
0
0

App being debugged in Visual Studio 2015 is not stopping at breakpoints, even though the code where those breakpoints are defined is definitely being executed.  Debug was working 2 days ago (Wed 10 Apr 2017), but on Thursday it wasn't and I haven't figured out why as of today, Friday.  I am running VS2015 in Administrator mode on my desktop on Windows 7 SP1.  VS2015 is at Update 3.  I have debug="true" in my web.config file, and ASP.NET and Native code debuggers are checked in my project properties.

What else could I be missing? (And, why is it so bloody difficult to accomplish anything in VS - rhetorical question, no need to answer).

Any help would be greatly appreciated.

If it's of any help ,here's the code behind the page:

Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Imports System.Xml
Imports System.Net
Public Class _ExportLabelXML
    Inherits System.Web.UI.Page

    Dim strManufdate As Date
    Dim strUseByDate As Date
    Dim intShelfLifeDays As Int16
    Dim strColName As String
    Dim strColType As String
    Dim strColValue As String
    Dim strConnString As String = "Server=vdfy-tro-db01; Database=livedb; Integrated Security=false; " &"Connect Timeout=300; User=rolivedb; Password=rolivedb"
    Dim cnnTroposConnection As New SqlConnection(strConnString)
    Dim cmdLabelQry As String ="SELECT " &" [Partno_txt] " &",[Partno_Short] As [SKU Number] " &",[Description_txt] As [Item Description] " &",[Prodgroup] As [Product Group Code] " &",' ' As [Allergen Info] " &",[Text_Safety] As [Handling Instructions] " &",[ITF14Number] As [UPC Number] " &",Case When PATINDEX('%-%',[Partno_txt]) <> 0 Then RIGHT(rtrim([Partno_txt]),3) Else ' ' End As [Plant Number] " &",[Text_Contains] As [Ingredients] " &",[USDAGraphic] As [USDA Graphic] " &",[TrademarkGraphic] As [Trademark Graphic] " &",[QtyPerCase] As [Quantity Per Case] " &",[CaseWeightLbs] As [Case Weight lb] " &",[UnitWeightLbs] As [Unit Weight lb] " &",[CaseWeightKgs] As [Case Weight gm] " &",[UnitWeightgms] As [Unit Weight gm] " &"FROM [livedb].[dbo].[VDFY_vw_GetText] " &"WHERE Partno_txt = @SKU_Number "
    Dim cmdGetShelfLife As String ="SELECT SHELFLIFE FROM MBC010 WHERE PARTNO_INV = @SKU_Number and ACCOUNT15_INV = '000010000100001' and " &"WAREHOUSE = ' ' and LOCSTOR_INV = ' ' and LOCBIN_INV = ' '"
    Dim sqlCmdGetLabel As New SqlCommand(cmdLabelQry, cnnTroposConnection)
    Dim sqlCmdGetShelfLife As New SqlCommand(cmdGetShelfLife, cnnTroposConnection)
    Dim strSKUNumber As String
    Dim strFileName As String
    Dim strFilePath As String = "C:\TEMP\"
    Dim strURIPath As String = "file://C/TEMP/"
    Dim strDwnLodPath As String = "C:\Users\peterst\Documents\Access Projects"
    Dim xmlLblWriter As XmlWriter
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        lblMessage.Text = ""
    End Sub

    Protected Sub btnGenLabelFile_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnGenLabelFile.Click
        Dim xmlLabelWriterSettings As New XmlWriterSettings()

        If Page.IsValid Then
            ' Set sqlCmdGetLabel parameters
            sqlCmdGetLabel.Parameters.Add("@SKU_Number", SqlDbType.Char)
            sqlCmdGetLabel.Parameters("@SKU_Number").Value = txItemNumber.Text
            ' Set sqlCmdGetShelfLife parameters
            sqlCmdGetShelfLife.Parameters.Add("@SKU_Number", SqlDbType.Char)
            sqlCmdGetShelfLife.Parameters("@SKU_Number").Value = txItemNumber.Text
            ' Set xmlLabelWriterSettings
            xmlLabelWriterSettings.CheckCharacters = True
            xmlLabelWriterSettings.CloseOutput = True
            xmlLabelWriterSettings.Indent = True
            xmlLabelWriterSettings.IndentChars = vbTab
            xmlLabelWriterSettings.NewLineChars = vbCrLf
            ' Set output label file name
            strFileName = "Label_" & Left(txItemNumber.Text, InStr(txItemNumber.Text, "-") - 1) & ".xml"
            ' Set SKU number for file name buildString
            strSKUNumber = Left(txItemNumber.Text, InStr(txItemNumber.Text, "-") - 1)
            strManufdate = CDate(txManufDate.Text)
            strUseByDate = CDate(txManufDate.Text)

            cnnTroposConnection.Open()
            Dim sqlReader As SqlDataReader = sqlCmdGetShelfLife.ExecuteReader()
            If sqlReader.HasRows Then
                sqlReader.Read()
                intShelfLifeDays = sqlReader.GetDecimal(sqlReader.GetOrdinal("SHELFLIFE"))
            Else
                intShelfLifeDays = 0
            End If
            strUseByDate = DateAdd(DateInterval.Day, intShelfLifeDays, strUseByDate)
            'strUseByDate = DateAdd(DateInterval.Day, intShelfLifeDays, strUseByDate)
            sqlReader.Close()
            sqlReader = sqlCmdGetLabel.ExecuteReader()
            If sqlReader.HasRows Then
                ' Create XML output file
                xmlLblWriter = XmlWriter.Create(strFilePath & strFileName, xmlLabelWriterSettings)
                ' Start writing XML
                xmlLblWriter.WriteStartElement("Label")
                xmlLblWriter.WriteStartElement("Printer_Info")
                xmlLblWriter.WriteStartElement("Printer")
                xmlLblWriter.WriteValue(txPrinter.Text)
                xmlLblWriter.WriteEndElement() ' End Printer element
                xmlLblWriter.WriteStartElement("Copies")
                xmlLblWriter.WriteValue(txLabelQty.Text)
                xmlLblWriter.WriteEndElement() ' End Copied element
                xmlLblWriter.WriteEndElement() ' End Printer Info element

                xmlLblWriter.WriteStartElement("Label_Info")
                While sqlReader.Read()
                    For iColumn As Integer = 0 To sqlReader.FieldCount - 1
                        strColName = sqlReader.GetName(iColumn)
                        strColType = sqlReader.GetDataTypeName(iColumn)
                        If Not IsDBNull(sqlReader.GetValue(iColumn)) Then
                            strColValue = CStr(sqlReader.GetValue(iColumn))
                        Else
                            strColValue = " "
                        End If
                        If strColType = "varchar" Then
                            ReplaceSpecialXMLChar(strColValue)
                        End If
                        xmlLblWriter.WriteStartElement(Replace(strColName, " ", ""))
                        xmlLblWriter.WriteValue(strColValue)
                        xmlLblWriter.WriteEndElement()
                    Next
                End While
                xmlLblWriter.WriteStartElement("Manufactured_Date")
                xmlLblWriter.WriteValue(Format(strManufdate, "yyyy-MM-dd"))
                xmlLblWriter.WriteEndElement()
                xmlLblWriter.WriteStartElement("Use_By_Date")
                xmlLblWriter.WriteValue(Format(strUseByDate, "yyyy-MM-dd"))
                xmlLblWriter.WriteEndElement()
                xmlLblWriter.WriteEndElement()
                xmlLblWriter.WriteEndElement()
                xmlLblWriter.Close()
                sqlReader.Close()

                DownloadLabelFile()

                lblMessage.ForeColor = Drawing.Color.Green
                lblMessage.Font.Bold = True
                lblMessage.Text = "Item " & txItemNumber.Text & " label created."
                ClearInputBoxes()
            Else
                lblMessage.ForeColor = Drawing.Color.Red
                lblMessage.Font.Bold = True
                lblMessage.Text = "Item " & txItemNumber.Text & " does not exist!"
                ClearInputBoxes()
            End If
        End If
    End Sub

    Protected Sub ManufDateFormatValidator_ServerValidate(source As Object, args As ServerValidateEventArgs) Handles ManufDateFormatValidator.ServerValidate
        Try
            DateTime.ParseExact(args.Value, "d", Nothing)
            args.IsValid = True
        Catch
            args.IsValid = False
        End Try
    End Sub
    Protected Function ReplaceSpecialXMLChar(ByRef XMLValue As String) As String
        Replace(XMLValue, "&amp;", "&",,)
        Replace(XMLValue, "&lt;", "<",,)
        Replace(XMLValue, "&gt;", ">",,)
        Replace(XMLValue, "&apos;", "'",,)
        Replace(XMLValue, "&quot;", """",,)
        ReplaceSpecialXMLChar = XMLValue
        Exit Function
    End Function

    Protected Sub ClearInputBoxes()
        txItemNumber.Text = ""
        txManufDate.Text = ""
        txLabelQty.Text = ""
        txPrinter.Text = ""
    End Sub

    Public Sub DownloadLabelFile()
        Dim objWebClient As New WebClient()
        Dim objInnerEx As New Exception
        Dim mpeWarningWindow As New AjaxControlToolkit.ModalPopupExtender
        'Try
        objWebClient.DownloadFile(strURIPath, strDwnLodPath)
            lblWarnMessage.Text = "Label for " & strSKUNumber & " created."
        'Catch ex As Exception
        'objInnerEx = ex.InnerException
        'lblWarnMessage.Text = "Error: " & objInnerEx.Message & vbCrLf & objInnerEx.HResult.ToString

        'mpe1.Show()
        'mpeWarningWindow.
        'MsgBox(CStr(ex.HResult) & " " & ex.Message & " " & ex.HelpLink)
        'MsgBox(CStr(objInnerEx.HResult) & " " & objInnerEx.Message & " " & objInnerEx.HelpLink)
        'End Try
    End Sub

End Class


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>