Fix Breaking Changes Introduced in .NET MAUI Preview 14#325
Fix Breaking Changes Introduced in .NET MAUI Preview 14#325TheCodeTraveler merged 5 commits intomainfrom
Conversation
87b2d80 to
cdf2e74
Compare
48df87d to
0abeb86
Compare
bdd5676 to
b1c90f9
Compare
TheCodeTraveler
left a comment
There was a problem hiding this comment.
Thanks Vlad!!
Hopefully this'll be the last time we have to update nfloat 😅
And thanks for fixing our typos!!
| public UIView ParentView => UIApplication.SharedApplication.ConnectedScenes.ToArray() | ||
| .Where(x => x.ActivationState == UISceneActivationState.ForegroundActive) | ||
| .Select(x => x as UIWindowScene) | ||
| .FirstOrDefault()? | ||
| .Windows.FirstOrDefault(x => x.IsKeyWindow) ?? throw new NullReferenceException("KeyWindow is not found"); |
There was a problem hiding this comment.
Let's just use .First() since it's the same as .FirstOrDefault() ?? throw new NullReferenceException()
| public UIView ParentView => UIApplication.SharedApplication.ConnectedScenes.ToArray() | |
| .Where(x => x.ActivationState == UISceneActivationState.ForegroundActive) | |
| .Select(x => x as UIWindowScene) | |
| .FirstOrDefault()? | |
| .Windows.FirstOrDefault(x => x.IsKeyWindow) ?? throw new NullReferenceException("KeyWindow is not found"); | |
| public UIView ParentView => UIApplication.SharedApplication.ConnectedScenes.ToArray() | |
| .Where(x => x.ActivationState == UISceneActivationState.ForegroundActive) | |
| .Select(x => x as UIWindowScene) | |
| .First() | |
| .Windows.First(x => x.IsKeyWindow); |
There was a problem hiding this comment.
Or, another idea (and maybe this one is better because it'll help users more easily track down the Exception), we throw InvalidOperationException:
| public UIView ParentView => UIApplication.SharedApplication.ConnectedScenes.ToArray() | |
| .Where(x => x.ActivationState == UISceneActivationState.ForegroundActive) | |
| .Select(x => x as UIWindowScene) | |
| .FirstOrDefault()? | |
| .Windows.FirstOrDefault(x => x.IsKeyWindow) ?? throw new NullReferenceException("KeyWindow is not found"); | |
| public UIView ParentView => UIApplication.SharedApplication.ConnectedScenes.ToArray() | |
| .Where(x => x.ActivationState == UISceneActivationState.ForegroundActive) | |
| .Select(x => x as UIWindowScene) | |
| .FirstOrDefault()? | |
| .Windows.FirstOrDefault(x => x.IsKeyWindow) ?? throw new InvalidOperationException("KeyWindow is not found"); |
There was a problem hiding this comment.
yes, the type of ConnectedScenes is NSSet<UIScene> and doesn't support Linq
There was a problem hiding this comment.
We cannot use First() because we cast to UIWindowsScene and still need to check for null. I will change it to InvalidOperationException
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description of Change
Linked Issues
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRAdditional information