0

i currently switch my workstation from windows 7 to windows 10. after that i am facing problem with my project as it crashes without showing any error or exception even while debugging. I never faced such situation. Also the project is still working fine on windows 7. If any one faced such scenario kindly help to throw the exception or error.

i already check all the option in exception setting but still no success.

  Public Sub Main()
    Const C_FunctionName As String = "Main"
    Try
        Application.EnableVisualStyles() ' Visuelle XP Stile aktivieren
        Control.CheckForIllegalCrossThreadCalls = False
        If IstInstanzSchonVorhanden() = True Then Exit Sub

        Meldungen.InitByRegistry("SOFTWARE\abc\cdf\")

        Meldungen.Log(1, "START", C_FunctionName)
        ModAnimation.ScreenMessage("vvv wird initialisiert", abc.cdf.Utils.ctScreens.cStartEnterpriseIndividual)

        'Benutzer initialisieren und anmelden
        My.User.InitializeWithWindowsUser()

        mBenutzer = New x.y.Core.Benutzer
        If RegLesen("Anmeldemaske", "0") = "1" Then
            ModAnimation.ScreenStop()
            Dim lLoginform As New x.LoginForm
            lLoginform.Validiere = AddressOf ValidateNamePwd
            lLoginform.Programmname = "E N T E R P R I S E"
            lLoginform.Fenstername = "x Enterprise"
            lLoginform.Username = RegLesen("Anmeldename", "")
            If lLoginform.ShowDialog() = DialogResult.OK Then
                RegSchreiben("Anmeldename", lLoginform.Username)
                lLoginform.Close()
                If Not My.User.IsAuthenticated Then
                    Exit Sub
                End If
            Else
                lLoginform.Close()
                Exit Sub
            End If
            ModAnimation.ScreenMessage("x Enterprise wird initialisiert", abc.cdf.Utils.ctScreens.cStartEnterpriseIndividual)
        End If

        ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
        ModAnimation.ScreenMessage("Benutzer wird angemeldet", abc.cdf.Utils.ctScreens.cStartEnterpriseIndividual)
        If mBenutzer.Init("abc Enterprise", My.Application.Info.DirectoryPath, "test.log", 0, "", "default.udl") Then
            If mBenutzer.Anmelden = False Then
                MsgBox("Benutzer konnte nicht angemeldet werden." & vbCrLf & mBenutzer.Fehler.TextAus)
                Exit Sub
            End If
            ModAnimation.ScreenMessage("Archivbereiche werden initialisiert", abc.cdf.Utils.ctScreens.cStartEnterpriseIndividual)
            mArchivCol = mBenutzer.AlleArchivBes
        Else
            MsgBox("Benutzer konnte nicht angemeldet werden." & vbCrLf & mBenutzer.Fehler.TextAus)
            Exit Sub
        End If

        Meldungen.Log(9, "frmMain anzeigen", C_FunctionName)

        ModAnimation.ScreenMessage("abc Enterprise wird gestartet", abc.cdf.Utils.ctScreens.cStartEnterpriseIndividual)
        With frmMain
            .Width = CType(RegLesen("FensterBreite", .Width.ToString), Integer)
            .Height = CType(RegLesen("FensterHöhe", .Height.ToString), Integer)
            .Left = CType(RegLesen("FensterPosY", .Left.ToString), Integer)
            .Top = CType(RegLesen("FensterPosX", .Top.ToString), Integer)
            .WindowState = CType(RegLesen("FensterStand", CStr(FormWindowState.Maximized)), FormWindowState)
        End With

        **frmMain.ShowDialog()**
        Meldungen.Log(1, "OK", C_FunctionName)
    Catch ex As Exception
        Debug.Assert(False)
        Meldungen.Log(1, "Fehler: " & ex.Message, C_FunctionName)
    End Try
End Sub
Maqsood
  • 369
  • 4
  • 17
  • 1
    Did you check the [**Event Viewer**](https://technet.microsoft.com/en-us/library/cc749408(v=ws.11).aspx)? – Visual Vincent Sep 14 '17 at 12:13
  • @VisualVincent yes i checked but nothing there. – Maqsood Sep 14 '17 at 12:22
  • When does it crash? Can you repeat the crash using the same steps everytime? If yes, then put break points in these methods and see exactly where it crash. – the_lotus Sep 14 '17 at 12:31
  • @the_lotus yes it crash always at the same step i.e. after showing the splash screen when the mainform is going to be displayed (frmMain.ShowDialog()). I put the break before and try to debug through it but it crashes. – Maqsood Sep 14 '17 at 12:39
  • Could you please add your code snippet where error comes? – Balagurunathan Marimuthu Sep 14 '17 at 12:49
  • @BalagurunathanMarimuthu code is added. at this point **frmMain.ShowDialog()** code crashes. also i am not sure whether u will be able to understand as the code is not in english – Maqsood Sep 14 '17 at 12:59
  • @Maqsood Is `frmMain` object initialized globally? Have you initialized it using `new` keyword? I could see, you were attempting to write the error into the log. Please check that too. – Balagurunathan Marimuthu Sep 14 '17 at 13:12
  • @BalagurunathanMarimuthu no error is recorded and yes i use it with new – Maqsood Sep 14 '17 at 13:50
  • Ah, the first indicator that you're doing something wrong: `Control.CheckForIllegalCrossThreadCalls = False` - Setting this to False is _**VERY**_ bad practice, and leaves your application open to what you experience: _unexpected behaviour_. – Visual Vincent Sep 14 '17 at 14:01
  • Remove the `Control.CheckForIllegalCrossThreadCalls = False` line and implement proper thread-safe marshalling instead. You will find more about that in my answer here: https://stackoverflow.com/a/45571728/3740093 – Visual Vincent Sep 14 '17 at 14:05
  • Additional note: What I'm referring to is called _marshalling calls to the UI thread_ (shorter known as _threads-safe marshalling/calls_) which can be found in my answer under _**Accessing the UI thread**_. This practice is **REQUIRED** every time you want to access your UI (forms, labels, textboxes, anything the user can see...) from a thread. `Control.CheckForIllegalCrossThreadCalls` exists _**to prevent**_ you from doing something bad, by throwing an exception every time you access the UI **incorrectly** from a background thread - which is why you should **NEVER** set it to `False`. – Visual Vincent Sep 14 '17 at 14:22

0 Answers0