0

Visual Studio 2019 gets stuck "Opening the File" when opening the Form or user control in Designer Mode.

2
  • See solution in link. Is Visual Studio fully updated?
    – harrymc
    Aug 18, 2019 at 9:55
  • yes it's fully update and thanks I already Fixed it by Moving everything to a New Solution and Project. The problem was in the Resources (base rsx and others) I don't know why this happens but I fix it any way
    – Magnos
    Aug 19, 2019 at 5:44

2 Answers 2

1

You defiantly should check the next link: https://weblog.west-wind.com/posts/2019/Feb/14/WPF-Hanging-in-Infinite-Rendering-Loop?fbclid=IwAR23ZnUrz7buVpFLXOX2qQin1WcifQ6h280EO25URO74NTGDkTedx1TDRb4

here's a quote from the page:

Using the StarDefinitionsCanExceedAvailableSpace Override This setting overrides the new GridRendering behavior and basically lets you run with a .NET 4.7.x target in your project, but keeps the old behavior that was used in previous versions.

There is a configuration setting that can be set in app.config for your application:

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

I can verify that using that switch lets me run 4.7.1 and not see the lock up in any scaling mode. After I

had my running version in 4.6.2 back, I once again moved up to 4.7.1 in a separate branch to try this out and sure enough the switch made the application run targeted with 4.7.1. So there's a hacky workaround.

It's a workaround though. This 'fix' according to Microsoft improves grid rendering allocations, providing more precise sizing and also improves performance and reduces memory usage. On paper this is a great improvement, but... well, side effects 😃

I suspect this issue is not wildly common as there was not very much info to be found about it. I think Markdown Monster makes this issue come up because the startup sequence has a lot of window manipulation. MM uses the MahApps UI framework which uses Window Animation and extra rendering frames for the main window, and MM itself moves the window offscreen for initial render and adjusts window sizing based on screen sizes and DPI settings if the window doesn't fit on the screen or would otherwise be offscreen. IOW, there's a bit of gyration to get the initial window onto the screen that is more likely to hit this bug than a simple WPF form.

So I doubt that every application needs to worry about this, but if you have a 4.7.x WPF app it might be a good idea to try it out at various resolutions and scale levels just to see how it fares.

0

Fixed by Moving the files into new different solution and project
1-Make a new solution and project (you may just make a new project only)
2-Move cs files first then designers then resx
3-Rebuild solution
4-Complete your project files
5-Last Check on designers and files places
if any problem happen you can redo and make the form and tools cs manually then copy move it's content from the old to new with the same names
6-Change name space by using search>Replace all (Current Solution)
X-Build your Solution and have Fun Programming

1
  • Please add more explanation on how to implement your answer.
    – Albin
    Aug 19, 2019 at 11:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .