我有一個鼠標向下的事件。只有在此方法中放置斷點時,我的應用程序才能按預期工作。如果我刪除斷點並運行代碼,則該功能不起作用。只有當斷點放置在方法中時,代碼才能工作c#
有什麼具體的原因,爲什麼發生這種情況? PFB事件代碼
internal void LeftMouseDown(object sender, MouseEventArgs e)
{
try
{
recorderData.CloseRecordedActionWindows();
if (CommonRecorderHelper.IsCursorInsideRecorder())
return;
recorderData.m_lastPremitiveAction = PrimitiveMouseEvent.LeftButtonDown.ToString();
recorderData.m_lastMouseDownLocation = e.Location;
recorderData.m_IsAssertionStarted = false;
recorderData.m_readyForHookDisconnect = false;
recorderData.m_previousKeyboardSUITControl = null;
recorderData.m_RecordedValue.ResetValues(!recorderData.m_RecordedValue.IsModifierKeyPressed());
if (recorderData.m_RecordedValue.IsModifierKeyPressed())
recorderData.m_IsModifierKeyPressedForMouseAction = true;
UpdateRecorderFormWithActions(recorderData.m_lastMouseDownLocation, PrimitiveMouseEvent.LeftButtonDown);
}
catch (Exception ex)
{
recorderData.m_RecordingStopped = true;
recorderData.m_mouseDownOnValidationBtn = false;
SUITLogger.ReportMessage(ex);
}
finally
{
recorderData.m_EarlierX = e.X;
recorderData.m_EarlierY = e.Y;
}
}
請問您可以發佈完整的代碼嗎? – Pritam
代碼的哪一點是它工作時設置的斷點?你可以顯示記錄數據類型的定義嗎? –
如果您正在閱讀的內容會在另一個線索中發生變化,或者需要更多時間加載,則可能會發生這種情況。當你放置斷點時,你給代碼加載時間或其他線程完成。對於我們能夠知道情況如何,您應該提供更多關於您想要做什麼以及如何做的信息。 – Emad