Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Redocking last Tab causes exception below build 17763. #1

Open
PaulaScholz opened this issue Nov 20, 2018 · 4 comments
Open

Redocking last Tab causes exception below build 17763. #1

PaulaScholz opened this issue Nov 20, 2018 · 4 comments
Labels
bug Something isn't working

Comments

@PaulaScholz
Copy link

When a Tab is moved from the application to the desktop, it works fine. Other tabs may now also be moved to the new window. You may also move tabs back to the original window, but when you try to move the last desktop tab back to the main application window, an exception occurs in MainPage.xaml.cs Items_DragItemsCompleted.

Details:

System.ArgumentException
HResult=0x80070057
Message=Value does not fall within the expected range.
Source=
StackTrace:
at Windows.UI.Xaml.Controls.Primitives.Selector.put_SelectedIndex(Int32 value)
at Microsoft.Toolkit.Uwp.UI.Controls.TabView.OnItemsChanged(Object e)
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at TabViewTear.Views.MainPage.<Items_DragItemsCompleted>d__19.MoveNext()

exceptionwindow

codesnippetwithexception

For fun, I am going to try to fix it.

@PaulaScholz PaulaScholz changed the title Redocking last TTab causes exception. Redocking last Tab causes exception. Nov 20, 2018
@michael-hawker
Copy link
Member

Thanks for the report @PaulaScholz, looks like an issue on builds before 17763, I'll have to spin up a VM after the holiday and take a look in more depth.

I would imagine this is a timing issue with the tab not being put back from the drag operation to remove again, there's some oddness with how dragging works there. I wonder if we dispatch the code in the DragItemsCompleted to the next cycle if it'd fix it or not.

@michael-hawker michael-hawker added the bug Something isn't working label Nov 21, 2018
@michael-hawker michael-hawker changed the title Redocking last Tab causes exception. Redocking last Tab causes exception below build 17763. Nov 21, 2018
@PaulaScholz
Copy link
Author

No joy on the dispatch.

dispatchexception

@PaulaScholz
Copy link
Author

PaulaScholz commented Nov 21, 2018

Interestingly, putting TabItems.RemoveAt(value); in a Try/Catch block and eating the exception clears up the behavior and the app then operates normally.

But, eating exceptions is no way to live your life. Unhandled exceptions taste horrible.

"If you eat the exception, it'll work." - Famous Last Words

@michael-hawker
Copy link
Member

I have the sample running on a 16299 VM and can repro the issue now. I was slowed down a bit by a toolkit issue, but I think I have a resolution for that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants