Skip to content
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

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

Open
aadog opened this issue Nov 1, 2024 · 6 comments
Assignees
Labels
area-Binding Impacting DataBinding area-Trimming
Milestone

Comments

@aadog
Copy link

aadog commented Nov 1, 2024

.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</_SuppressWinFormsTrimError>
true
partial

`

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

`

Image
Image

@aadog aadog added the untriaged The team needs to look at this issue in the next triage label Nov 1, 2024
@Olina-Zhang
Copy link
Member

@aadog I cannot reproduce this issue in my machine with same .NET 9.0 version:
Image

@aadog
Copy link
Author

aadog commented Nov 1, 2024

@Olina-Zhang *.csproj add
<PropertyGroup> <OutputType>WinExe</OutputType> <TargetFramework>net9.0-windows</TargetFramework> <Nullable>enable</Nullable> <UseWindowsForms>True</UseWindowsForms> <PlatformTarget>x64</PlatformTarget> <_SuppressWinFormsTrimError>true</_SuppressWinFormsTrimError> <PublishAot>true</PublishAot> <TrimMode>partial</TrimMode> </PropertyGroup>

@aadog
Copy link
Author

aadog commented Nov 1, 2024

@Olina-Zhang like he

Image

@Olina-Zhang
Copy link
Member

Trimming/AOTing WinForms Apps is not supported at this time. When setting it, the form designer cannot be loaded successfully.
Related issue: #10741.

Image

@JeremyKuhne JeremyKuhne added area-Binding Impacting DataBinding area-Trimming labels Nov 6, 2024
@merriemcgaw
Copy link
Member

This is on our radar but there is not a specific schedule to get this working. It is expected that you will get trim warnings with data binding and we need to redesign how databinding and trimming work.

@merriemcgaw merriemcgaw added this to the Future milestone Nov 6, 2024
@merriemcgaw merriemcgaw removed the untriaged The team needs to look at this issue in the next triage label Nov 6, 2024
@aadog
Copy link
Author

aadog commented Nov 10, 2024

What options do we have to not crop parts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Binding Impacting DataBinding area-Trimming
Projects
None yet
Development

No branches or pull requests

5 participants