dotnet / dotnet/winforms

winform aot,Binding operations are not supported when application clipping is enabled

Open
#12,411 6 comments 0 reactions 1 assignee Claimed by @KlausLoeffelmann View on GitHub
area-Binding area-Trimming
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

### .NET version

.NET SDK:
Version: 9.0.100-rc.2.24474.11
Commit: 315e1305db
Workload version: 9.0.100-manifests.4872d5d5
MSBuild version: 17.12.0-preview-24473-03+fea15fbd1

运行时环境:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.100-rc.2.24474.11\

### Did it work in .NET Framework?

Yes

### Did it work in any of the earlier releases of .NET Core or .NET 5+?

net 8

### Issue description

build to winform aot mode ,Binding operations are not supported when application clipping is enabled

System.NotSupportedException:“启用应用程序剪裁时不支持绑定操作。”

[异常] System.Windows.Forms.dll!System.Windows.Forms.Control.DataBindings.get() 未知
> [异常] xt.dll!xt.Form1.button2_Click_1(object sender, System.EventArgs e) 行 187 C#
[异常] System.Windows.Forms.dll!System.Windows.Forms.Button.OnClick(System.EventArgs e) 未知
[异常] System.Windows.Forms.dll!System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs mevent) 未知
[异常] System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseUp(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) 未知
[异常] System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) 未知
[异常] System.Windows.Forms.dll!System.Windows.Forms.ButtonBase.WndProc(ref System.Windows.Forms.Message m) 未知
[异常] System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(Windows.Win32.Foundation.HWND hWnd, Windows.Win32.MessageId msg, Windows.Win32.Foundation.WPARAM wparam, Windows.Win32.Foundation.LPARAM lparam) 未知

### Steps to reproduce

`
<_SuppressWinFormsTrimError>true
true
partial

`

`
textBox1.DataBindings.Add("Text", button1, "Text");

`

![Image](https://github.com/user-attachments/assets/10ff9226-886f-439d-96d5-db704b90761a)
![Image](https://github.com/user-attachments/assets/d25d0fbc-e138-4061-a7e0-1b2173eb78e9)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.