[英]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
运行时会发生:
A DataGrid
column that had "*"
to use the remaining width just shows the column the minimum width to hold the data.具有
"*"
以使用剩余宽度的DataGrid
列仅显示该列用于保存数据的最小宽度。
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.