每次触摸代码时将 "Generate serialization assembly" 设置为关闭强制生成还是仅一次?

Does setting "Generate serialization assembly" to off force generation every time the code is touched or just once?

根据 Ondrej Svejdar 在 this question 中的评论,只会影响启动性能,不会影响整体性能。

获胜答案 here 的说法恰恰相反,指出序列化程序集是在每次执行时生成的。我认为这意味着每次命中该部分代码时,都会生成一个序列化程序集。

哪个是正确的?

它只会影响应用程序的启动性能。

https://docs.microsoft.com/en-us/dotnet/standard/serialization/xml-serializer-generator-tool-sgen-exe

When the XML Serializer Generator is not used, a XmlSerializer generates serialization code and a serialization assembly for each type every time an application is run. To improve the performance of XML serialization startup, use the Sgen.exe tool to generate those assemblies in advance. These assemblies can then be deployed with the application.

The XML Serializer Generator can also improve the performance of clients that use XML Web service proxies to communicate with servers because the serialization process will not incur a performance hit when the type is loaded the first time.