Skip to content

Conversation

@NoNod
Copy link
Contributor

@NoNod NoNod commented Nov 9, 2025

Sometimes the spinning wait cursor stays on.
This will fix it.

Copy link
Collaborator

@ErikMogensen ErikMogensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late review, @NoNod. Do you know why the current code isn't working? I see it resetting the cursor in finally blocks, which should work. I do know it doesn't.

using System.Windows.Forms;
namespace ServiceBusExplorer.UIHelpers
{
internal class DisposableUseWaitCursor : IDisposable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the PR through Copilot which stated:

Consider renaming from DisposableUseWaitCursor to WaitCursorScope or UseWaitCursorScope. "Disposable" in a type name is redundant because IDisposable is the pattern; e.g. WaitCursorScope is clearer.

I think that is a good idea.

@AnyTick
Copy link

AnyTick commented Nov 24, 2025

Explicit On/Off WaitCursor calls work fine within try-finally blocks. However, the try-finally block was missed in the DoPurge method. As a result, the cursor wasn't reset when an exception occurred in DoPurge.

WaitCursorScope is a much better name. 😉 I think implementing the WaitCursor logic as an IDisposable class makes the code more readable than handling it with try-finally blocks.

Copy link
Collaborator

@ErikMogensen ErikMogensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the code cleaner.

Copilot suggested that the cursor class should use reference counting to support nesting, but I suggest that is done in another PR - if we see a need for it.

@SeanFeldman SeanFeldman merged commit 9a35b55 into paolosalvatori:main Nov 24, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants