简体   繁体   English

WPF.Net v4.7.2 令人担忧的调试和直接运行的区别

[英]WPF .Net v4.7.2 worrying difference between running in debug and direct

I was using.Net 4.0 and now I have updated to.Net 4.7.2.我使用的是.Net 4.0,现在我已经更新到.Net 4.7.2。 I have noticed very worrying problems.我注意到非常令人担忧的问题。 The program now behaves differently when running from the Visual Studio (2012) debugger or running from the ex e directly.现在,当从 Visual Studio (2012) 调试器运行或直接从ex e 运行时,程序的行为会有所不同。

These are two problems I have noticed that don't happen with the debugger but do happen when running from the exe :这是我注意到的两个问题,调试器不会发生,但从exe运行时会发生:

  1. A DataGrid column that had "*" to use the remaining width just shows the column the minimum width to hold the data.具有"*"以使用剩余宽度的DataGrid列仅显示该列用于保存数据的最小宽度。

  2. Page Loaded events are only fired sometimes. Page Loaded事件仅有时会触发。 This seems to be affected by the amount of working being done when displaying the page.这似乎受到显示页面时正在完成的工作量的影响。 Like if there is too much work it just does not bother firing the event.就像如果工作太多,它就不会打扰触发事件。

Anyone else having this or know why?其他人有这个或知道为什么?


More info on this.有关此的更多信息。 I have discovered it is always firing the Page Loaded event but it was before I had subscribed to it.我发现它总是触发 Page Loaded 事件,但它是在我订阅它之前。

So what this means is that in debug things are happening at a different speed to direct running causing things to happen in a different order - race condition.所以这意味着在调试中事情发生的速度与直接运行不同,导致事情以不同的顺序发生 - 竞争条件。

They introduced a new allocation algorithm in 4.7 to prevent infinite loops that ocurred during the layout of a Grid under some circumstances.他们在 4.7 中引入了一种新的分配算法,以防止在某些情况下在Grid布局期间发生的无限循环。 Please refer to the docs for more information.请参阅文档以获取更多信息。

You can disable the new algorithm by adding a switch to your App.config file:您可以通过在App.config文件中添加一个开关来禁用新算法:

<runtime>
  <AppContextSwitchOverrides value="Switch.System.Windows.Controls.Grid.StarDefinitionsCanExceedAvailableSpace=true" />
</runtime>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 .Net Core 项目中使用 .Net Framework dll (v4.7.2) - Use .Net Framework dll (v4.7.2) in .Net Core project 从 .NET v4.7.2 切换到 .NET 标准 v2.0 时,在 DefaultContractResolver 中找不到 IgnoreSerializableAttribute - IgnoreSerializableAttribute not found in DefaultContractResolver when switching from .NET v4.7.2 to .NET Standard v2.0 在分支之间转换时生成错误:您的项目未引用“.NETFramework,Version=v4.7.2”框架 - Build error while transitioning between branches: Your project is not referencing the ".NETFramework,Version=v4.7.2" framework 如何从运行 .NET 4.7.2 的 WPF 访问 gRPC 服务? - How to access gRPC service from WPF running .NET 4.7.2? Ranorex 构建失败 9.4.1 找不到框架“.NETFramework,Version=v4.7.2”的参考程序集 - Ranorex build fails 9.4.1 The reference assemblies for framework “.NETFramework,Version=v4.7.2” were not found 项目“ClassLibraryX.csproj”针对“netstandard2.1”。 它不能被以“.NETFramework,Version=v4.7.2”为目标的项目引用 - Project 'ClassLibraryX.csproj' targets 'netstandard2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.7.2 项目“ClassLibrary1.csproj”针对“netcoreapp2.1”。 它不能被以“.NETFramework,Version=v4.7.2”为目标的项目引用 - Project 'ClassLibrary1.csproj' targets 'netcoreapp2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.7.2' debug:pdb.net 2和.net 4之间的区别 - debug:pdbonly difference between .Net 2 and .Net 4 WPF设计视图与运行之间的区别 - WPF Difference Between Design View and Running 第三方同步方法冻结.NET 4.7.2 WPF中的UI - 3rd party sync method freezing the UI in .NET 4.7.2 WPF
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM