{"id":203,"date":"2024-03-17T11:42:07","date_gmt":"2024-03-17T11:42:07","guid":{"rendered":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2024\/03\/17\/winforms-in-a-64-bit-world-our-strategy-going-forward\/"},"modified":"2024-03-17T18:34:31","modified_gmt":"2024-03-17T18:34:31","slug":"winforms-in-a-64-bit-world-our-strategy-going-forward","status":"publish","type":"post","link":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2024\/03\/17\/winforms-in-a-64-bit-world-our-strategy-going-forward\/","title":{"rendered":"WinForms in a 64-Bit world \u2013 our strategy going forward"},"content":{"rendered":"<p>As a part of a community that thrives on innovation and growth, WinForms<br \/>\ndevelopers are often pushing boundaries to create new possibilities. Our<br \/>\ndevelopers are also responsible for the maintenance of mission critical line of<br \/>\nbusiness software, often well over a decade in the making. We value your trust<br \/>\nand your passion for creating excellent software solutions with our tools. As<br \/>\nyou may be aware, the transition from 32-bit to 64-bit in Visual Studio 2022 has<br \/>\nresulted in some complexities. We are aware that these changes are causing some<br \/>\nspeed bumps along your development journey, and we want to clarify these issues<br \/>\nby pointing out workarounds already available and our additional plans to<br \/>\naddress them.<\/p>\n<h2>Embracing 64-bit: A Change for the Better<\/h2>\n<p>The decision to switch to a 64-bit platform is far more than a simple upgrade.<br \/>\nIt\u2019s a major improvement that helps Visual Studio work better in several ways.<br \/>\nOne of the biggest benefits is the ability to use more memory. In the 32-bit<br \/>\nversion, there were limits to how much memory Visual Studio could use, which<br \/>\noften led to slower performance or even errors when working on large projects.<br \/>\nThe 64-bit version removes these limitations, allowing Visual Studio to handle<br \/>\nlarger projects with greater efficiency.<\/p>\n\n<p>But it\u2019s not just about having access to more memory. The switch to 64-bit also<br \/>\nenables Visual Studio to make better use of your computer\u2019s processor,<br \/>\nparticularly of its multiple cores. Because a 64-bit application can process<br \/>\nmore data at once, it can use more cores simultaneously and effectively, which<br \/>\nleads to faster operations. This is particularly noticeable when building your<br \/>\nproject. If your project is large, with many files and lots of code, the build<br \/>\noperation can be considerably faster on 64-bit. This means less waiting around<br \/>\nfor builds to complete, which helps you get your work done quicker. But those<br \/>\nare not the only advantages. Others are:<\/p>\n<p><strong>Compatibility with 64-bit libraries:<\/strong> There are numerous 64-bit libraries<br \/>\nand components that simply couldn\u2019t be used effectively with a 32-bit version of<br \/>\nVisual Studio. The 64-bit version enables better utilization and integration of<br \/>\nthese resources.<\/p>\n<p><strong>Enhanced Security:<\/strong> 64-bit systems have some built-in security advantages<br \/>\nover 32-bit ones, including a feature called Address Space Layout Randomization<br \/>\n(ASLR) that makes it more difficult for malicious code to exploit the system.<\/p>\n<p><strong>Future-proofing:<\/strong> As technology continues to evolve, more and more<br \/>\napplications and operating systems are transitioning towards 64-bit<br \/>\narchitectures. By moving to 64-bit now, Visual Studio is following the wave,<br \/>\nensuring compatibility with future technological advancements.<\/p>\n<p><strong>Larger Datasets:<\/strong> With 64-bit computing, you can work with significantly<br \/>\nlarger datasets that previously might have been impossible to handle due to<br \/>\nmemory restrictions. This is particularly advantageous at design-time in<br \/>\ndata-intensive fields like machine learning, big data analytics but also for<br \/>\ntasks which involve the processing of schemas of large and complex databases for<br \/>\nexample for code generation.<\/p>\n<h2>Where does WinForms fit in?<\/h2>\n<p>These advantages are also true for the WinForms Designer. It is very common<br \/>\nfor WinForms application to reflect complex business cases. As a result, those<br \/>\napplications often contain of hundreds of Forms and UserControls which<br \/>\nthemselves can grow really big and complex. All of this leads to a lot of code<br \/>\nwhich needs to be generated as soon as a Form gets edited. One of the biggest<br \/>\nbeneficiaries of the 64-bit transition is therefore undoubtedly the WinForms<br \/>\nDesigner. The Designer leverages the ability to access more memory in the 64-bit<br \/>\narchitecture, greatly enhancing its performance and capacity to handle complex<br \/>\ndesign tasks.<\/p>\n<h3>32-Bit legacy component challenges<\/h3>\n<p>All this said, we are fully aware that this advancement comes with certain<br \/>\nchallenges concerning components which are bound to a 32-Bit architecture and<br \/>\nwhich are used in the context of the Windows Forms designer for projects<br \/>\ntargeting .NET Framework Versions up to 4.8.1.<\/p>\n<p>The shift from 32-bit to 64-bit systems is not just about increasing power, but<br \/>\nit involves fundamental architectural changes. These changes directly affect how<br \/>\nwe manage .NET Framework versions and .NET Core applications. For instance, it<br \/>\nis not possible to host 32-bit exclusive components in a 64-bit process or .NET<br \/>\nCore types in a .NET Framework process. However, this should not be seen as an<br \/>\napproach that could have been avoided. Instead, it\u2019s a necessary part of the<br \/>\nnatural progression and evolution in technology.<\/p>\n<h3>What are my options?<\/h3>\n<p>You have several avenues to consider, each with its own advantages:<\/p>\n<p><strong>Move to .NET 8+<\/strong>: The most forward-thinking option, though, would be to<br \/>\nupgrade to .NET 8 or higher. The .NET 8+ environment is the future of (not only)<br \/>\nWinForms Application development and provides the most robust support,<br \/>\nespecially when it comes to third-party control vendors. With .NET 8+, you\u2019re<br \/>\nnot just keeping up with the times \u2013 you\u2019re staying ahead, ensuring that your<br \/>\napplications are ready for whatever the future brings.<\/p>\n<p><strong>Use AnyCPU:<\/strong> Firstly, for the design time, switch everything to build with<br \/>\n\u2018AnyCPU\u2019. The \u2018AnyCPU\u2019 compile option in Visual Studio offers a versatile<br \/>\nsolution for addressing the 32-bit component issue in your WinForms project.<br \/>\nWhen your project is set to \u2018AnyCPU\u2019, Visual Studio will compile your<br \/>\napplication in such a way that it can run on both 32-bit and 64-bit platforms.<br \/>\nIn the context of design time, this flexibility means your process can run as<br \/>\n64-bit on a 64-bit system, allowing you to take full advantage of the benefits<br \/>\nof 64-bit Visual Studio, such as improved memory utilization and faster<br \/>\noperations. In many cases, this work quite well for projects, which require<br \/>\n32-Bit-runtime components. When it comes to runtime after a design session has<br \/>\nfinished, the \u2018Prefer 32-bit\u2019 project setting becomes key for compatibility with<br \/>\nolder 32-bit components or libraries. By enabling this setting, you\u2019re<br \/>\ninstructing the Common Language Runtime (CLR) to run your \u2018AnyCPU\u2019 compiled<br \/>\napplication in a 32-bit process, even on a 64-bit system. This provides an<br \/>\nenvironment where your 32-bit components function as expected, thereby<br \/>\nmaintaining the smooth operation of your application. While this approach does<br \/>\nimpose some of the 32-bit limitations, such as a smaller memory space, it offers<br \/>\nan effective solution for balancing between the need for 64-bit design time<br \/>\ncapabilities and the requirements of 32-bit components at runtime.<\/p>\n<p><strong>Modernizing the 32-Bit components:<\/strong> If the first option is not feasible due<br \/>\nto the architecture of the 32-bit component, you might consider migrating away<br \/>\nfrom the 32-bit components. While this may require an initial investment of time<br \/>\nand resources, the benefits you stand to gain in the long run are significant.<br \/>\nTransitioning to a 64-bit environment offers not only better performance but<br \/>\nalso enhanced security. Moreover, it prepares your applications for future<br \/>\nupdates and advancements, thus ensuring their longevity.<\/p>\n<p>If all those options are not working for your special case, then there is the<br \/>\nout-of-process WinForms Designer as a final option:<\/p>\n<h2>Adapting to the New Landscape: The Out-of-Process Designers<\/h2>\n<p>To support .NET Core 3.1 and above, we\u2019ve created an out-of-process version of<br \/>\nthe WinForms Designer; a separate process that can handle tasks that Visual<br \/>\nStudio cannot execute as a .NET Framework process. This essentially required us<br \/>\nto create an entirely new architecture and extensibility model <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/state-of-the-windows-forms-designer-for-net-applications\/\">to handle the<br \/>\ntwo types of processes simultaneously<\/a>.<br \/>\nUpgrading to .NET does have its challenges with changes in both the runtime and<br \/>\nin the new out-of-process designer. While we do have parity with the most<br \/>\nimportant design time functions, there are cases where legacy approaches don\u2019t<br \/>\nreally make sense to pursue any longer in the new technical landscape.<\/p>\n<p>The out-of-process designer allows us to circumvent the restrictions that<br \/>\nproblematic with the in-process design, namely the issues of hosting components<br \/>\nwhich are incompatible with the Target Framework of the hosting Designer, e.g.,<br \/>\nVisual Studio. This is accomplished by launching a new designer process, which<br \/>\nthen operates in the exact Target Framework Version, the WinForms project was<br \/>\nset up to target, allowing for greater flexibility in managing components of<br \/>\ndifferent architectures.<\/p>\n<p>In addition, the out-of-process designer permits us to provide support for<br \/>\nhigher versions of .NET, such as .NET 8, 9, and beyond. It does this by<br \/>\nallowing components to utilize features from these newer versions of .NET that<br \/>\nmay not be compatible with the .NET Framework.<\/p>\n<p>However, this also means that all the individual components and their control<br \/>\ndesigners must be adjusted to work across different process boundaries. When you<br \/>\nare using your own WinForms control libraries with highly customized design-time<br \/>\nsupport through dedicated Control Designers which provide custom CodeDOM<br \/>\nserialization, specialized type editors, customized adorner rendering or<br \/>\nindividualized Designer action items, <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/custom-controls-for-winforms-out-of-process-designer\/\">you need to migrate your Designer code to<br \/>\nuse the WinForms Designer<br \/>\nSDK<\/a>.<br \/>\nWe\u2019ve made strides towards this with our stock controls for .NET (Core, 5+). And<br \/>\nwhat\u2019s also important: Most of our bigger third-party Control Library partners<br \/>\nalso provide their product to be used for .NET Versions 5, 6 and 7 \u2013 and<br \/>\nmodernized versions for .NET 8 are in the making.<\/p>\n<p>It\u2019s important to note that as we\u2019re addressing these issues, we\u2019re prioritizing<br \/>\ncomponents based on usage. Some of the lesser-used components in .NET Core have<br \/>\nhad their designer support deprecated in favor of more commonly used components.<\/p>\n<h2>The Out-Of-Process Designer for .NET Framework Application with 32-bit Components<\/h2>\n<p>We saw that more people needed support with designing WinForms applications for<br \/>\nthe 32-Bit .NET Framework, since these applications used parts that only worked in a<br \/>\n32-bit process. That was the reason, we adapted the approach of the WinForms<br \/>\nout-of-process-designer for .NET and are introducing the 32-Bit out-of-process<br \/>\n<em>.NET Framework<\/em> designer based of this.<\/p>\n<p>The out-of-process designer is engineered to spawn a separate 32-bit process<br \/>\nthat can host the components required for such applications. By doing so, it<br \/>\nsidesteps the incompatibility between the 64-bit environment of Visual Studio<br \/>\nand the 32-bit components. This design allows for smoother integration and<br \/>\ncompatibility, despite the disparity in system architectures.<\/p>\n<p>If you try top open a WinForms .NET Framework project, which has a reference to<br \/>\na 32-Bit-Component, Visual Studio will automatically bring up a dialog and ask,<br \/>\nif you want to open your project with the 32-Bit .NET Framework out-of-process designer.<\/p>\n\n<p>Just like its counterpart for .NET, the out-of-process designer for 32-Bit .NET<br \/>\n<em>Framework<\/em> WinForms applications aims to provide the same design time experience,<br \/>\npreserving the ability to use existing, even legacy, 32-bit components. Despite<br \/>\nthe challenging task of bridging the architectural gap, we are committed to<br \/>\nensuring a smooth transition and maintaining the functionality you\u2019ve come to<br \/>\nrely upon, while also providing a pathway towards future upgrades and<br \/>\nenhancements.<\/p>\n<p>We understand that important legacy projects can rely on 32-bit ActiveX controls<br \/>\nand other legacy components that are currently incompatible with Visual Studio<br \/>\n2022, specifically for projects which are not targeting .NET (Core, 5+) but .NET Framework up<br \/>\nto Version 4.8.1. In these cases, the out-of-process designers can be the<br \/>\nsolution for many use cases. But note, that also the .NET (6+) WinForms out-of-process designer should be considered the preferred and best-practice way forward \u2013 you<br \/>\nwould get the best of both worlds: 32-Bit compatibility at design time and<br \/>\nruntime <em>and<\/em> the latest, most modern and most performant .NET version.<\/p>\n<p><strong>It <em>is<\/em> important to note<\/strong> that the updated out-of-process 32-Bit .NET Framework<br \/>\ndesigner will <em>not<\/em> achieve full parity with the old in-process .NET Framework Designer due to the same architectural differences mentioned for the out-of-process designer for<br \/>\n.NET Core. That also means that highly customized Control Designers will not be<br \/>\ncompatible to the .NET Framework in-process designer out of the box. If you use<br \/>\ncustom control libraries from 3rd parties you need to check if they offer<br \/>\nversions which support the out-of-process <em>.NET Framework<\/em> Designer.<\/p>\n<h2>Supporting Legacy Components: Our Commitment and Plans<\/h2>\n<p>The out-of-process designers are where we are putting in most of our efforts<br \/>\ngoing forward. And here is the planning of our road map <em>for this current year<\/em>:<\/p>\n<p><strong>Improving the 32-Bit Framework out-of-process designer:<\/strong> This designer will<br \/>\nbe the choice for maintaining projects, which cannot be migrated to .NET<br \/>\n(Core, 5+), but depend on legacy 32-Bit components. This designer will not<br \/>\nhave feature parity with the in-process designer, but we will be adding more<br \/>\nfeatures as we see the customer demand for it. Note that the 32-Bit-Framework<br \/>\nDesigner is in Preview already and can be activated through the <em>Tools\/Option<\/em><br \/>\npage.<\/p>\n<p>For the Visual Studio 2022 version 17.9 we released a feature<br \/>\nwhich assists you to easily choose whether a .NET Framework project should be opened<br \/>\nfor the classic Visual Studio-in-process designer or the out-of-process designers.<br \/>\nThe differences compared to the classic WinForms in-process-designer will be:<\/p>\n<p>You will be able to open and design Forms and UserControls which are targeting<br \/>\n.NET Framework (up to version 4.8.1) and rely on 32-bit-based ActiveX<br \/>\ncomponents or most other reasons, which would force the resulting assembly to<br \/>\nbe 32-Bit in the Designer.<\/p>\n<p>If you are depending on special 3rd party control libraries for projects which<br \/>\nrely on legacy 32-bit components, you cannot use the same versions of those<br \/>\nlibraries which the 3rd party vendors provide for the classic in-process<br \/>\ndesigner. Check with your control library vendor, if they provide an updated<br \/>\nversion for the .NET Framework out-of-process designer.<\/p>\n<p>The typed DataSet designer and SQL Server query editor in the context of<br \/>\ndesigned DataSets will only remain available for the classic in-process<br \/>\ndesigner. We will, however, introduce updated features later this year, which<br \/>\nmake it easier and possible to <strong>consume<\/strong> Data Sources based on existing<br \/>\nTyped DataSets, so that maintaining Data Binding scenarios based on existing<br \/>\ndata sources will continue to be supported. We have no plans, however, at this<br \/>\ntime to support the classic Data Source tool windows in the .NET Framework<br \/>\nout-of-process designer.<\/p>\n<p>Data Sources based on classic SOAP Web services will not be supported by the<br \/>\nout-of-process designer for either .NET or .NET Framework applications.<\/p>\n<p>Providing the infrastructure for Root Designers: Third party vendors and<br \/>\ncontrol library authors rely on Root Designers \u2013 for example when they want to<br \/>\nmigrate their report designers from .NET Framework to .NET Core. By adding<br \/>\nroot designer support to the out-of-process designer, we\u2019ll enable control<br \/>\nauthors to modernize their powerful reporting designers and other document<br \/>\ndesigner types and bring them to .NET 6, 7 and 8+. We have, however, no plans<br \/>\nat this time, to support custom Root Designers for the .NET Framework<br \/>\nout-of-process Designer.<\/p>\n<h2>Moving Forward: A Collaborative Effort<\/h2>\n<p>The transition to a 64-bit system is a significant milestone that requires a new<br \/>\napproach, innovative solutions, and patience. As mentioned before, this is not a<br \/>\nquick bug fix; rather, it\u2019s a transition that we need to manage together as a<br \/>\ncommunity.<\/p>\n<p>We are committed to making this journey as smooth as possible for you. Your<br \/>\nfeedback is invaluable, and it helps us identify the areas where we need to<br \/>\nfocus our efforts. We have a road map and we\u2019re making progress, but the<br \/>\ntimeline for completion depends on the unique challenges that you bring to our<br \/>\nattention.<\/p>\n<p>In conclusion, we understand the complexities you\u2019re facing, and we want to<br \/>\nreassure you that we\u2019re making strides in addressing these challenges. Remember,<br \/>\nchange often comes with a bit of discomfort, but it paves the way for growth and<br \/>\nbetter outcomes. We want to underscore the importance of your active engagement<br \/>\nin this ongoing transition. As we continually strive to improve and fine-tune<br \/>\nthe 64-bit designer and our out-of-process designer support, your feedback and<br \/>\nerror reports are invaluable. If you encounter any specific issues while using<br \/>\nWinForms, we strongly encourage you to report them directly in the WinForms<br \/>\nrepository on GitHub or via the feedback feature of Visual Studio. Detailed,<br \/>\nconcrete issue reports, especially those that include information about the<br \/>\nenvironment, steps to reproduce, and the specific error messages, help us<br \/>\nimmensely in identifying and addressing problems more effectively and rapidly.<br \/>\nYour participation in this process is crucial for the successful development of<br \/>\na more robust and efficient Visual Studio, since the technology, legacy<br \/>\n32-Bit-components are based all, is in many cases 20 years old and older.<\/p>\n<h2>Final Thoughts<\/h2>\n<p>The journey from 32-bit to 64-bit has been a complex one and not without its<br \/>\nchallenges. We\u2019re committed to making this transition as smooth as possible for<br \/>\nall our users, but we understand that there will be bumps along the way.<\/p>\n<p>Thank you for your support and commitment as we push forward to a more capable<br \/>\nand versatile WinForms ecosystem, and as always\u2026<\/p>\n<p>\u2026happy coding!<\/p>\n<p>The post <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/winforms-designer-64-bit-path-forward\/\">WinForms in a 64-Bit world \u2013 our strategy going forward<\/a> appeared first on <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\">.NET Blog<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>As a part of a community that thrives on innovation and growth, WinForms developers are often pushing boundaries to create [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":204,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[7],"tags":[],"class_list":["post-203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet"],"_links":{"self":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/comments?post=203"}],"version-history":[{"count":1,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/203\/revisions"}],"predecessor-version":[{"id":219,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/203\/revisions\/219"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/media\/204"}],"wp:attachment":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/media?parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/categories?post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/tags?post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}