2 Commits

Author SHA1 Message Date
Developer01
cee6a11c99 Fix: Konsistente Freigabe von Dateien vor Aktionen
Ein kritischer Fix wurde implementiert, um sicherzustellen, dass die Methode `PRTF_PROFILE_FILES_WORK("FreeFile")` in verschiedenen Szenarien aufgerufen wird, bevor Aktionen abgeschlossen werden. Dies verhindert potenzielle Probleme mit asynchronen Prozessen und freigegebenen UI-Objekten.

- Direkte SQL-Strings zur Freigabe von Dateien wurden entfernt und durch die Methode `PRTF_PROFILE_FILES_WORK("FreeFile")` ersetzt, um die Lesbarkeit und Wartbarkeit zu verbessern.
- Zusätzliche Aufrufe von `PRTF_PROFILE_FILES_WORK("FreeFile")` wurden in Fehlerbehandlungsblöcke und Workflow-Schritte integriert, um die Stabilität zu erhöhen.
- Die Methode `PRTF_PROFILE_FILES_WORK` wurde angepasst, um unnötige Datenbankaufrufe zu vermeiden, wenn `CURRENT_DOC_ID` gleich 0 ist.
- Einheitliche Handhabung der Datei-Freigabe in verschiedenen Kontexten wie Dokumentüberspringen und Kommentarverarbeitung.

Diese Änderungen verbessern die Stabilität und Konsistenz der Anwendung erheblich.

V 2.9.6
2026-08-05 13:13:58 +02:00
Developer01
de80d564b1 V 2.9.5 Logging Hotspots, 2026-07-02 16:35:40 +02:00
4 changed files with 42 additions and 3169 deletions

View File

@@ -114,9 +114,9 @@ Namespace ControlCreator
' *** DEBUG: Log VOR/NACH (nur beim ersten Aufruf) *** ' *** DEBUG: Log VOR/NACH (nur beim ersten Aufruf) ***
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
_Logger.Info("[ResolveSqlTemplate] BEFORE: {0}", _Logger.Info("LOG_HOTSPOTS [ResolveSqlTemplate] BEFORE: {0}",
beforeReplace.Substring(0, Math.Min(150, beforeReplace.Length))) beforeReplace.Substring(0, Math.Min(150, beforeReplace.Length)))
_Logger.Info("[ResolveSqlTemplate] AFTER: {0}", _Logger.Info("LOG_HOTSPOTS [ResolveSqlTemplate] AFTER: {0}",
resolvedSql.Substring(0, Math.Min(150, resolvedSql.Length))) resolvedSql.Substring(0, Math.Min(150, resolvedSql.Length)))
End If End If
Else Else
@@ -843,14 +843,14 @@ Namespace ControlCreator
' Cache prüfen ' Cache prüfen
SyncLock _DynamicEditorCacheShared SyncLock _DynamicEditorCacheShared
If _DynamicEditorCacheShared.ContainsKey(cacheKey) Then If _DynamicEditorCacheShared.ContainsKey(cacheKey) Then
_Logger.Info("[CustomRowCellEdit] ✓ CACHE HIT: [{0}]", cacheKey) _Logger.Debug("[CustomRowCellEdit] ✓ CACHE HIT: [{0}]", cacheKey)
e.RepositoryItem = _DynamicEditorCacheShared(cacheKey) e.RepositoryItem = _DynamicEditorCacheShared(cacheKey)
Return Return
End If End If
End SyncLock End SyncLock
' Editor erstellen mit RESOLVED SQL ' Editor erstellen mit RESOLVED SQL
_Logger.Info("[CustomRowCellEdit] 🆕 MISS: Creating editor for [{0}]", e.Column.FieldName) _Logger.Debug("[CustomRowCellEdit] 🆕 MISS: Creating editor for [{0}]", e.Column.FieldName)
Dim realEditor = CreateRowSpecificEditor( Dim realEditor = CreateRowSpecificEditor(
e.Column.FieldName, e.Column.FieldName,
resolvedSql, resolvedSql,
@@ -865,7 +865,7 @@ Namespace ControlCreator
_DynamicEditorCacheShared.Add(cacheKey, realEditor) _DynamicEditorCacheShared.Add(cacheKey, realEditor)
End If End If
End SyncLock End SyncLock
_Logger.Info("[CustomRowCellEdit] ✓ Cached [{0}] editor (Type=[{1}])", e.Column.FieldName, realEditor.GetType().Name) _Logger.Debug("[CustomRowCellEdit] ✓ Cached [{0}] editor (Type=[{1}])", e.Column.FieldName, realEditor.GetType().Name)
e.RepositoryItem = realEditor e.RepositoryItem = realEditor
Else Else
_Logger.Warn("[CustomRowCellEdit] CreateRowSpecificEditor returned Nothing for [{0}]", e.Column.FieldName) _Logger.Warn("[CustomRowCellEdit] CreateRowSpecificEditor returned Nothing for [{0}]", e.Column.FieldName)

View File

@@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.9.4.0")> <Assembly: AssemblyVersion("2.9.6.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.0")>
<Assembly: NeutralResourcesLanguage("")> <Assembly: NeutralResourcesLanguage("")>

View File

@@ -722,6 +722,8 @@ Public Class frmValidator
End If End If
_isClosingGuard = True _isClosingGuard = True
_FormClosing = True _FormClosing = True
' KRITISCH: Dokument freigeben bevor Form schließt
PRTF_PROFILE_FILES_WORK("FreeFile")
' ===== FIX: Grid-Events SOFORT deregistrieren ===== ' ===== FIX: Grid-Events SOFORT deregistrieren =====
' Der GridControl-Lambda läuft noch asynchron weiter und greift sonst ' Der GridControl-Lambda läuft noch asynchron weiter und greift sonst
@@ -811,13 +813,7 @@ Public Class frmValidator
Try Try
Dim oSQL As String Dim oSQL As String
If CURRENT_DOC_GUID <> 0 Then oSQL = $"DELETE FROM TBPM_DOCWALKOVER WHERE UserID = {USER_ID};"
Dim oPRoc = String.Format("EXEC PRTF_PROFILE_FILES_WORK {0},{1},{2},'FreeFile';", CURRENT_DOC_ID, CURRENT_ProfilGUID, USER_ID)
oSQL = $"DELETE FROM TBPM_DOCWALKOVER WHERE UserID = {USER_ID};" & vbCrLf & oPRoc
Else
oSQL = $"DELETE FROM TBPM_DOCWALKOVER WHERE UserID = {USER_ID};"
End If
DatabaseFallback.ExecuteNonQueryECM(oSQL) DatabaseFallback.ExecuteNonQueryECM(oSQL)
Catch ex As Exception Catch ex As Exception
MyValidationLogger.Error(ex) MyValidationLogger.Error(ex)
@@ -4150,7 +4146,7 @@ Public Class frmValidator
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
perfStart = DateTime.Now perfStart = DateTime.Now
perfLastCheck = perfStart perfLastCheck = perfStart
MyValidationLogger.Info("[PERF LND] Load_Next_Document START") MyValidationLogger.Info("[LOG_HOTSPOTS] Load_Next_Document START")
End If End If
_CachedSqlDataCache.Clear() _CachedSqlDataCache.Clear()
@@ -4198,7 +4194,7 @@ Public Class frmValidator
End If End If
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF LND] Nach Get_Next_GUID: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms") MyValidationLogger.Info($"[LOG_HOTSPOTS] Nach Get_Next_GUID: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now perfLastCheck = DateTime.Now
End If End If
@@ -4209,7 +4205,7 @@ Public Class frmValidator
End If End If
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF LND] Nach GetDocPathWindows: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms") MyValidationLogger.Info($"[LOG_HOTSPOTS] Nach GetDocPathWindows: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now perfLastCheck = DateTime.Now
End If End If
@@ -4221,7 +4217,7 @@ Public Class frmValidator
Load_IDB_DOC_DATA() Load_IDB_DOC_DATA()
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF LND] Nach Load_IDB_DOC_DATA: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms") MyValidationLogger.Info($"[LOG_HOTSPOTS] Nach Load_IDB_DOC_DATA: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now perfLastCheck = DateTime.Now
End If End If
If IsNothing(IDB_DT_DOC_DATA) Then If IsNothing(IDB_DT_DOC_DATA) Then
@@ -4235,12 +4231,12 @@ Public Class frmValidator
End If End If
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF LND] Nach CreateWMObject/Load_IDB_DOC_DATA: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms") MyValidationLogger.Info($"[LOG_HOTSPOTS] Nach CreateWMObject/Load_IDB_DOC_DATA: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now perfLastCheck = DateTime.Now
End If End If
PRTF_PROFILE_FILES_WORK("InWork") PRTF_PROFILE_FILES_WORK("InWork")
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF LND] Nach IN_WORK-UPDATE: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms") MyValidationLogger.Info($"[LOG_HOTSPOTS] Nach IN_WORK-UPDATE: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now perfLastCheck = DateTime.Now
End If End If
@@ -4268,7 +4264,7 @@ Public Class frmValidator
End If End If
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF LND] Nach Windream_get_Doc_info: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms") MyValidationLogger.Info($"[LOG_HOTSPOTS] Nach Windream_get_Doc_info: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now perfLastCheck = DateTime.Now
End If End If
@@ -4285,9 +4281,9 @@ Public Class frmValidator
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
oMilliseconts = (DateTime.Now - perfLastCheck).TotalMilliseconds oMilliseconts = (DateTime.Now - perfLastCheck).TotalMilliseconds
If oMilliseconts > 6000 Then If oMilliseconts > 6000 Then
MyValidationLogger.Warn($"[PERF LND] ⚠️ LoadDocument_DDViewer lasted far to long: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms") MyValidationLogger.Warn($"[LOG_HOTSPOTS] ⚠️ LoadDocument_DDViewer lasted far to long: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
Else Else
MyValidationLogger.Info($"[PERF LND] Nach LoadDocument_DDViewer: {oMilliseconts}ms") MyValidationLogger.Info($"[LOG_HOTSPOTS] Nach LoadDocument_DDViewer: {oMilliseconts}ms")
End If End If
perfLastCheck = DateTime.Now perfLastCheck = DateTime.Now
End If End If
@@ -4336,9 +4332,9 @@ Public Class frmValidator
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
oMilliseconts = (DateTime.Now - perfLastCheck).TotalMilliseconds oMilliseconts = (DateTime.Now - perfLastCheck).TotalMilliseconds
If oMilliseconts > 6000 Then If oMilliseconts > 6000 Then
MyValidationLogger.Warn($"[PERF LND] ⚠️ FillIndexValues lasted far to long: {oMilliseconts}ms") MyValidationLogger.Warn($"[LOG_HOTSPOTS] ⚠️ FillIndexValues lasted far to long: {oMilliseconts}ms")
Else Else
MyValidationLogger.Info($"[PERF LND] Nach FillIndexValues: {oMilliseconts}ms") MyValidationLogger.Info($"[LOG_HOTSPOTS] Nach FillIndexValues: {oMilliseconts}ms")
End If End If
perfLastCheck = DateTime.Now perfLastCheck = DateTime.Now
@@ -4370,7 +4366,7 @@ Public Class frmValidator
End If End If
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF LND] Nach LoadSQLData-Loop: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms") MyValidationLogger.Info($"[LOG_HOTSPOTS] Nach LoadSQLData-Loop: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now perfLastCheck = DateTime.Now
End If End If
@@ -4452,7 +4448,7 @@ Public Class frmValidator
End Try End Try
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF LND] Nach Currency-Format: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms") MyValidationLogger.Info($"[LOG_HOTSPOTS] Nach Currency-Format: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now perfLastCheck = DateTime.Now
End If End If
@@ -4464,9 +4460,9 @@ Public Class frmValidator
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
oMilliseconts = (DateTime.Now - perfLastCheck).TotalMilliseconds oMilliseconts = (DateTime.Now - perfLastCheck).TotalMilliseconds
If oMilliseconts > 6000 Then If oMilliseconts > 6000 Then
MyValidationLogger.Warn($"[PERF LND] ⚠️ Show_WF_Messages lasted far to long: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms") MyValidationLogger.Warn($"[LOG_HOTSPOTS] ⚠️ Show_WF_Messages lasted far to long: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
Else Else
MyValidationLogger.Info($"[PERF LND] Nach Show_WF_Messages: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms") MyValidationLogger.Info($"[LOG_HOTSPOTS] Nach Show_WF_Messages: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
End If End If
perfLastCheck = DateTime.Now perfLastCheck = DateTime.Now
@@ -4480,7 +4476,7 @@ Public Class frmValidator
Controls2B_EnDisabled_onLoad() Controls2B_EnDisabled_onLoad()
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF LND] Nach Controls2B_EnDisabled: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms") MyValidationLogger.Info($"[LOG_HOTSPOTS] Nach Controls2B_EnDisabled: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now perfLastCheck = DateTime.Now
End If End If
MyValidationLogger.Debug("frmValidator: LoadNextDocument finished!") MyValidationLogger.Debug("frmValidator: LoadNextDocument finished!")
@@ -4489,7 +4485,7 @@ Public Class frmValidator
MyValidationLogger.Error(ex) MyValidationLogger.Error(ex)
errormessage = "unexpected error in Load_Next_Document:" & ex.Message errormessage = "unexpected error in Load_Next_Document:" & ex.Message
My.Settings.Save() My.Settings.Save()
PRTF_PROFILE_FILES_WORK("FreeFile")
MyValidationLogger.Info("unexpected error in Load_Next_Document: " & ex.Message) MyValidationLogger.Info("unexpected error in Load_Next_Document: " & ex.Message)
frmError.ShowDialog() frmError.ShowDialog()
@@ -4500,11 +4496,11 @@ Public Class frmValidator
CloseOverlaySafe() CloseOverlaySafe()
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
' ========== DIAGNOSE ENDE ========== ' ========== DIAGNOSE ENDE ==========
MyValidationLogger.Info($"[INFO] Load_Next_Document ENDE") MyValidationLogger.Info($"[LHS] Load_Next_Document ENDE")
MyValidationLogger.Info($" frmValidator.IsDisposed: {Me.IsDisposed}") MyValidationLogger.Info($"[LHS] frmValidator.IsDisposed: {Me.IsDisposed}")
MyValidationLogger.Info($" frmValidator.Visible: {Me.Visible}") MyValidationLogger.Info($"[LHS] frmValidator.Visible: {Me.Visible}")
' ========== ENDE DIAGNOSE ========== ' ========== ENDE DIAGNOSE ==========
MyValidationLogger.Info($"[PERF LND] Load_Next_Document GESAMT: {(DateTime.Now - perfStart).TotalMilliseconds}ms") MyValidationLogger.Info($"[LHS] Load_Next_Document GESAMT: {(DateTime.Now - perfStart).TotalMilliseconds}ms")
End If End If
End Try End Try
End Sub End Sub
@@ -8253,9 +8249,8 @@ Public Class frmValidator
Try Try
MyValidationLogger.Debug("Skipping document....(Datei_ueberspringen)") MyValidationLogger.Debug("Skipping document....(Datei_ueberspringen)")
Dim oPRoc = String.Format("EXEC PRTF_PROFILE_FILES_WORK {0},{1},{2},{3}", CURRENT_DOC_ID, CURRENT_ProfilGUID, USER_ID, "FreeFile") PRTF_PROFILE_FILES_WORK("FreeFile")
Dim oSQL = oPRoc & vbCrLf & Dim oSQL = $"EXECUTE PRPM_FILES_NOT_INDEXED '{USER_USERNAME}',{CURRENT_ProfilGUID},'{DocPathWindows}',{CURRENT_DOC_GUID};"
$"EXECUTE PRPM_FILES_NOT_INDEXED '{USER_USERNAME}',{CURRENT_ProfilGUID},'{DocPathWindows}',{CURRENT_DOC_GUID};"
If LOG_HOTSPOTS Then If LOG_HOTSPOTS Then
' ========== DIAGNOSE: Vor DB-Execute ========== ' ========== DIAGNOSE: Vor DB-Execute ==========
MyValidationLogger.Info($"[INFO] Führe DB-UPDATE aus...") MyValidationLogger.Info($"[INFO] Führe DB-UPDATE aus...")
@@ -8308,8 +8303,13 @@ Public Class frmValidator
End Sub End Sub
Private Function PRTF_PROFILE_FILES_WORK(ByVal pMode As String) As Boolean Private Function PRTF_PROFILE_FILES_WORK(ByVal pMode As String) As Boolean
Try Try
Dim sql = $"EXEC PRTF_PROFILE_FILES_WORK {CURRENT_DOC_ID},{CURRENT_ProfilGUID},{USER_ID},'{pMode}'" If CURRENT_DOC_ID <> 0 Then
Return DatabaseFallback.ExecuteNonQueryECM(sql) Dim sql = $"EXEC PRTF_PROFILE_FILES_WORK {CURRENT_DOC_ID},{CURRENT_ProfilGUID},{USER_ID},'{pMode}'"
Return DatabaseFallback.ExecuteNonQueryECM(sql)
Else
Return False
End If
Catch ex As Exception Catch ex As Exception
MyValidationLogger.Error(ex) MyValidationLogger.Error(ex)
Return False Return False
@@ -8936,6 +8936,7 @@ Public Class frmValidator
oNoError = IDBData.SetVariableValue(PROFIL_REJECT_COMMENT_ATTRIBUTE, frmRejCommit.pRejection_Comment) oNoError = IDBData.SetVariableValue(PROFIL_REJECT_COMMENT_ATTRIBUTE, frmRejCommit.pRejection_Comment)
End If End If
End If End If
PRTF_PROFILE_FILES_WORK("FreeFile")
If oNoError Then If oNoError Then
REJECTION_ACTIVE = True REJECTION_ACTIVE = True
If Check_UpdateIndexe() = True Then If Check_UpdateIndexe() = True Then
@@ -9015,7 +9016,7 @@ Public Class frmValidator
' End If ' End If
' End If ' End If
'Next 'Next
PRTF_PROFILE_FILES_WORK("FreeFile")
If IDB_ACTIVE = False Then If IDB_ACTIVE = False Then
Indexiere_File(CURRENT_WMFILE, PROFIL_NOT_RESP_COMMENT_ATTR, frmDialog.oComment) Indexiere_File(CURRENT_WMFILE, PROFIL_NOT_RESP_COMMENT_ATTR, frmDialog.oComment)

File diff suppressed because it is too large Load Diff