Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException when showing TaskDialog without buttons #48

Closed
mgpreston opened this issue Jun 21, 2021 · 4 comments
Closed

NullReferenceException when showing TaskDialog without buttons #48

mgpreston opened this issue Jun 21, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@mgpreston
Copy link

If you attempt to call ShowDialog on a TaskDialog that you haven't added any buttons to, the call to ShowDialog will throw a NullReferenceException.

Could this be improved to throw a more meaningful exception - or perhaps add a default button to it?

Example:

var dialog = new Ookii.Dialogs.Wpf.TaskDialog {
	Content = "Message",
	MainInstruction = "Instruction"
};

dialog.ShowDialog(); // NullReferenceException here. dialog is not null.

Thank you!

@augustoproiete
Copy link
Member

augustoproiete commented Jun 21, 2021

Thanks for reporting @mgpreston. I fixed the NullReferenceException so that a more meaningful exception is thrown, but showing a default button might be a better experience.

What do you think the button should be? OK? Close? Cancel? Something else?

@augustoproiete augustoproiete added the enhancement New feature or request label Jun 21, 2021
@augustoproiete augustoproiete added this to the 3.2.0 milestone Jun 21, 2021
@mgpreston
Copy link
Author

That's great, thanks!

I would be tempted to go for OK as the default button, but I'd consider any of them to be fine.

@augustoproiete
Copy link
Member

Tracking adding the default button via #55

Closing this one as fixed by 5582dcb

@augustoproiete augustoproiete self-assigned this Sep 5, 2021
@augustoproiete augustoproiete modified the milestones: v3.2.0, v4.0.0 Sep 9, 2021
@augustoproiete
Copy link
Member

🎉 This issue has been resolved in Ookii.Dialogs.Wpf v4.0.0

The release is available on:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants