-
Notifications
You must be signed in to change notification settings - Fork 696
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
Fixes #3675. Adds ObjectDisposedException
s
#3676
base: v2_develop
Are you sure you want to change the base?
Conversation
Just cross-posting a reference to commentary I put in #3675 for the work being done for this. |
Removed from Title.
Note while this is ready for review (and is probably enough for now), tests fail due to #3678 |
May re-introduce if events or observer pattern are implemented
Oh wow that Title bug came back? Pretty sure that's a regression, unless I never made a PR for the branch I fixed it in. 🤔 |
I'll review this in a bit. I'm actually considering maybe making at least part of #3677 a PR to your branch for this, since they're conceptually pretty related, for the IDisposable portion, and would be wise to be vetted as a whole before this PR gets merged. Might save a small amount of work and potential wild goose chases. Then I'll just rebase the other parts of that issue on top of that. Sound good? |
Thar ye goeth: tig#39 |
IDisposable portion of gui-cs#3677
Coolio. I'll take a look at it in a minute. Just gotta stash what I'm working on at the moment. |
Whoops. Got an idea and got distracted on it. NOW I'm taking a look. 😅 |
I have some items to run by you on this one. Some are pretty important. I'm writing it up and validating specifics. I'll have a small amount of code plus commentary that I'll include with it, as a PR to your branch again. |
In addition to the stuff I'm preparing, my other main general commentary is that, until that test issue is fixed, I wouldn't advise merging this yet, since this change isn't isolated to a specific single unit that is still passing, while also not being coupled in any way to other units under test. That recommendation isn't limited to this PR. It applies to any which can't be deterministically proven to be fully isolated from all failing tests. However, this change set in particular involves code paths that involve the entire lifetime of the library, so I'm not comfortable putting my stamp on it if it won't pass Release mode tests. Can we temporarily back out whatever caused the failures in the mainline v2_develop branch until a fix is ready, and just have that work and any that is dependent on it continue on a parallel branch until it's all ready for merge, so other stuff isn't a big question mark and being potentially either missed til later or lumped in with unrelated breaking changes? 🫤 I have a sneaking suspicion that the need for a lot of this extra exception throwing/debugging is related to some other more fundamental issues and is going after the symptom, rather than the problem. ODE should be thrown in pretty specific situations, from the object that was disposed, specifically. An ODE being thrown is pretty much always a bug when you're the one receiving it, and also the vast majority of the time when you are the one throwing it, unless it's being thrown in that narrow set of specific circumstances. The remarks in the .net docs for ODE do at least a decent job of trying to explain when it might be thrown and by whom. I know there's a more detailed doc (or there was) somewhere else on MS Learn but I'm getting errors accessing the site, at the moment so I don't have a quick link handy for ya right now. Ugh. Sorry. :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way the commented line was before is preferred, since it's a constant and also more trim-friendly for consumer custom View-derived types.
@@ -62,7 +55,7 @@ public static void UngrabMouse () | |||
} | |||
|
|||
#if DEBUG_IDISPOSABLE | |||
ObjectDisposedException.ThrowIf (MouseGrabView.WasDisposed, typeof (View)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typeof was better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you would like the consumer to benefit from better specificity of the most-derived type, rather than always calling it just a View
, you can just make that method generic:
public static void GrabMouse<T> (T? view) where T : View
and then the only change necessary should likely be that the typeof uses turn into typeof(T)
instead of typeof(View)
. There could be other small tweaks needed in the method, and in callers, if they're making comparisons to specific types without calling that method with something more specific than a View, but they'd likely be pretty trivial to adapt, as well, if any exist.
Fixes
ObjectDisposedException
#3675Proposed Changes/Todos
Title
check per @dodexahedronPull Request checklist:
CTRL-K-D
to automatically reformat your files before committing.dotnet test
before commit///
style comments)