CommunityToolkit / CommunityToolkit/Windows

Native AOT: InvalidCastException when using GridSplitter

Aperta
#612 8 commenti 1 reazione 0 assegnatari Vedi su GitHub
components::controls::sizers nativeaot
Lingua principale
C#
Stelle
1.1k
Fork
166
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Describe the bug

I'm seeing this crash reported on a device with `Windows 10.0.19045`. I wasn't able to reproduce it locally on a Windows 11 machine
```
System.InvalidCastException: Specified cast is not valid
at System.Runtime.RuntimeExports.RhUnbox2(MethodTable*, Object) + 0x3f
at CommunityToolkit.WinUI.Controls.GridSplitter.IsStarColumn(ColumnDefinition) + 0x53
at CommunityToolkit.WinUI.Controls.GridSplitter.OnDragHorizontal(Double) + 0xf9
at CommunityToolkit.WinUI.Controls.SizerBase.OnManipulationDelta(ManipulationDeltaRoutedEventArgs) + 0x11b
at ABI.Microsoft.UI.Xaml.Controls.IControlOverrides.Do_Abi_OnManipulationDelta_15(IntPtr, IntPtr) + 0x58
```

I'm using `CommunityToolkit.WinUI.Controls.Sizers 8.2.241112-preview1` in a .NET9 WinUI3 app that is compiled using Native AOT

### Steps to reproduce
I'm essentially only using a GridSplitter and adjusting Grid.Row and Grid.Column in code

```text

```

### Expected behavior

No crash

### Screenshots

_No response_

### Code Platform

- [ ] UWP
- [x] WinAppSDK / WinUI 3
- [ ] Web Assembly (WASM)
- [ ] Android
- [ ] iOS
- [ ] MacOS
- [ ] Linux / GTK

### Windows Build Number

- [ ] Windows 10 1809 (Build 17763)
- [ ] Windows 10 1903 (Build 18362)
- [ ] Windows 10 1909 (Build 18363)
- [ ] Windows 10 2004 (Build 19041)
- [ ] Windows 10 20H2 (Build 19042)
- [ ] Windows 10 21H1 (Build 19043)
- [ ] Windows 10 21H2 (Build 19044)
- [x] Windows 10 22H2 (Build 19045)
- [ ] Windows 11 21H2 (Build 22000)
- [ ] Other (specify)

### Other Windows Build number

_No response_

### App minimum and target SDK version

- [x] Windows 10, version 1809 (Build 17763)
- [ ] Windows 10, version 1903 (Build 18362)
- [ ] Windows 10, version 1909 (Build 18363)
- [ ] Windows 10, version 2004 (Build 19041)
- [ ] Windows 10, version 2104 (Build 20348)
- [ ] Windows 11, version 22H2 (Build 22000)
- [ ] Other (specify)

### Other SDK version

_No response_

### Visual Studio Version

2022

### Visual Studio Build Number

_No response_

### Device form factor

_No response_

### Additional context

_No response_

### Help us help you

Yes, I'd like to be assigned to work on this item.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with the GridSplitter.IsStarColumn and OnDragHorizontal entry points named in the stack trace, then reproduce the GridSplitter interaction in a Native AOT WinUI 3 app on Windows 10. Done means adjusting the splitter no longer throws InvalidCastException.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
desktop, frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
52/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.