Silverlight hangs at 100% loaded - silverlight

My Silverlight website hangs at 100% loaded. There is no code for it, so far it is just the design in XAML, and it shows up fine in Expression Blend 3. It is the standard "Silverlight Website" project from Blend 3, without any modifications.
When I press F5 to run it, it shows as a 100% loading circle in firefox and never actually shows my app. The loading circle continues to animate as if its doing something.
Note: It worked yesterday, and I havent made very many changes to it since then.

I had this problem in browser, out of browser - even when debugging. Using Silverlight 4 beta.
I hit F5 to start debugging and it never even hit a breakpoint for the constructor of App.xaml.cs.
I knew I'd uninstalled an out of browser app and changed some out of browser settings recently but nothing would tell me the actual problem.
I found in the end if I ran in IE (normally I use Chrome) - then an error icon would be shown in the bottom left - as if it were a javascript error.
Webpage error details
Message: Unhandled Error in Silverlight Application
Code: 2020
Category: ParserError
Message: Invalid Property: OutOfBrowserSettings.
File:
Line: 47
Position: 27
Line: 54
Char: 13
Code: 0
URI: file:///R:/Project/Projece/Bin/Debug/TestPage.html
Well this didn't get me any further - except to tell me something was messed up with OutOfBrowserSettings.
What I ended up doing was creating a new AppManifest.xml. As of Silverlight 4 this is the default AppManifest.xml.
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>
I disabled 'create app manifest' and reenabled it. After toggling some of the settings back and forth - and even creating AppManifest2.xml I managed to get it working again.
I switched back to my original AppManifest.xml and it worked.
The point being check any message the browser gives you - and then change things that you don't think will make a difference.
Good luck!

I figured out the problem after looking at the XAML. On the height property of one of my buttons, there was a line break right before the ending quote. Expression blend didn't mark it as an error, and everything showed up fine in design mode.
When I removed the line break, the loading problem was fixed.

My other answer looks quite convoluted compared to this. This may or may not help in this situation but its worth a try:
In Visual Studio :
Click Debug > Exceptions
Click 'Find' and search for XAML
Click the 'Thrown' button next to System.Windows.Markup.XamlParseException
Start your project in debug mode. Any Xaml exceptions will be shown immediately. Check the inner exception sometimes for further information.
I wasted soooo much time before I finally figured this one out!

Here is the answer: http://www.cnblogs.com/101rico/archive/2012/11/14/2769781.html
You can add this: xmlns:Grid="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"

This also happens when the Silverlight app requires Silverlight 5, but the user has a lower version installed.

An infinite event loop can cause this problem:
private void myComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
myComboBox.SelectedIndex = 0;
}

If it is an elevated trust application, failing to have the necessary registry settings set to allow its launch can cause the dreaded "100% hang":
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Silverlight
AllowElevatedTrustAppsInBrowser DWORD:=1
AllowLaunchOfElevatedTrustApps DWORD:=1

Open Internet Explorer, go to Tools-> Internet Options->Advanced->click Reset on Reset Internet Explorer Settings-> choose Delete Personal Settings->Click reset

So my problem was, in a data grid, I had a duplicate column name binding to the same column name. So something in the xaml was crazy messed up. Apparently the control I am using had an "Internal Exception" that was not being thrown up on the screen as an error.

Related

Windows form has disappeared in Visual Studio form designer

Yesterday I edited a form in Visual Studio's form designer. When I returned to it today, the designer shows nothing. I can open the properties window, select all the different constituent components and edit their properties, but they do not show up. The application builds fine and the form can be run as usual.
I've tried a couple of different solutions, such as checking the .csproj file has the form.Designer.cs included, but nothing has worked.
Strangely, I did see this problem earlier in the week, but it fixed itself when I unlocked my computer after returning from a coffee break.
Any suggestions?
I face a similar problem in Visual Studio 2019.
To help others who may have this issue.
The problem is due to the class declaration in the Form1.cs file.
Please ensure public partial class Form1: Form class is the first-class declared in the file. No other class declaration should be on top of this.
As described in this answer: https://stackoverflow.com/a/40243490/8887398
Thanks,
Sankar
I had similar issues in VS2019. I resolved it by using:
Window > Reset Window Layout.
Then double clicked on the Form in the Solution Explorer.
Prior to this, double clicking the form was having no effect.
Weird, after trying for an hour I ended up solving the issue 30 seconds after posting this!
I edited the size property of an item on the form using the properties tab, saved the form, and then reverted the form.cs, form.designer.cs, and form.resx files to the latest source control version.
At this point the form jollily re-appeared.
Edit: FWIW, this didn't work with another form which was exhibiting the same problem.
Edit 2: That other form has now fixed itself after coming back from lunch and unlocking my PC... Might be something to do with how that affects the display - everything shifts over to my right hand monitor when I do that.
Edit 3: OK, now it seems that modifying my display DPI fixes it. On Windows 10 go to System Settings -> Display, and then move the "Change the size of text: 100%" option to say 200%. Once this changes on screen, move it back to 100%.
This seems quite foolproof, although you sometimes have to jimmy it around a lot before it finally works. I know it has worked when I get both a vertical and horizontal scrollbar; the form is then further down the page.
Just go to Form1.cs (Form1 is the name of your form), if you are able to see your source code then press Shift + F7. The form will show up.
I also had a similar issue in VS2019.
My form [Design] was listed in the solution explorer but the code was not listed as a sub-item of that form.
I could access the code by right-clicking on the form in the solution explorer and choosing view code.
What seemed to solve the problem was to close down VS2019 and simply re-open it up.
A Message appeared (with Errors and Warnings) for me which said that the first mentioned class in a cs code file must be the form class. I shifted my form class to the top of the files and everything was fine.
There are actually a few reasons that one might encounter this issue.
At times, it can be due a problem within the VS IDE and the way it incorrectly manages file types and subtypes. It normally does a great job with this "automagically", but it can also make painful and unexpected mistakes.
If you right-mouse-click (RMC) your Project, and unload it (not your solution) you will be able to RMC it again and choose "Edit Project File". Once there, search for your Form name. In my case, I will search for Form1.cs, note the incorrect icon I saw in the Solution Explorer View, and the code describing my form, within the project file:
<...>
<Compile Include="Form1.cs"/>
<...>
Change this declarative statement to the following, adding the "Form" subtype:
<...>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<...>
Save your project file, then RMC on your project name in the Solution Explorer, choose "Reload Project", and you will see the correct icon as expected, and once again be able to use the form in Design mode:
*Note: This issue shouldn't occur with default forms (named Form1, Form2, etc) and even in my case, it happened with a form I named other than the default form name. I used that name in this example, purely for illustrative purposes.
Hopefully, this helps someone.
Wishing you all the best!
I hadn't changed anything that would have broken my form, yet it still wouldn't load when I tried view designer. Restarted VS2019 and it worked after that. Give that a go before you try anything else!
I had the same problem.
My solution was to remove and add again the System.Windows.Forms reference.
Go to Tools > Options > Environment > Preview Features and select the Use the preview Windows Forms designer ...
Then restart

XAML pages acting different in release mode

I'm developing a WP7 app with a couple of pages. Everything looks fine in debug mode, but when changing to release mode, two bad things happen:
One page remains completely blank (black in dark theme) without throwing any error. However, in the WYSIWYG XAML editor it looks flawless. Also, the code behind is executed (seen using the debugger).
On another page, an ListBox element is still null after InitializeComponent() has finished. It's inside an initially hidden Popup.
What are the differences between release and debug build that could cause those issues? I have no idea.
Update
The first problem solved itself when I commented everything out and back in, step by step. At the end it worked without any actual changes, so I guess it was a caching problem of Visual Studio or so.
For the second problem, I found a work-around: Setting the container Popup to IsOpen="True" in XAML and closing it at the very end of the page's constructor (after InitializeComponent() has been called). But still I cannot see the reason for it.

VS 2010 XAML debugging got stuck on breakpoint

I am trying to debug into xaml in silverlight 5 project. When debugger hits a breakpoint it correctly stops, I can read binding properties, but I can`t continue.
When I hit the continue button, button turns to gray and nothing happens. All debugger buttons are inactive. The only way to stop is to close the solution. While closing solution many error messages pup up saying: "Source file XY does not belong to the project being debugged."
There is no problem with debugging in C# only in XAML.
Any help will be greatly accepted.
Thank you in advance.
Try deleting the .suo solution user file, which may have become corrupt. Back it up first ;-)

Visual Studio 2010 Designer Error on Run

I am using using VS2010 and if I have a form open in designer mode and run my application the designer tab will no longer show the form designer but instead an error will be displayed (and it is only fixed by restarting the IDE) saying:
"To prevent possible data loss before loading the designer, the
following errors must be resolved:"
1 Error:
"The designer could not be shown for this file because none of the
classes within it can be designed. The designer inspected the
following classes in the file: ##### --- The base class ##### could
not be loaded. Ensure the assembly has been referenced and that all
projects have been built"
I then shows the following call stack:
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
Any help is greatly appreciated this is really annoying.
Thanks,
Joel.
I get this visual studio bug too now and then, and I deeply ignore the error text, instead I do the following:
Close the Design-tab
Reopens the Design mode by double click in Solution Explorer, or by right clicking Source code tab and select View Designer
Suddenly everything works again!
If not helping, you may have to change bullet 2 into:
Close and restart Visual Studio.
Maybe this can help you out.
I usually close the visual form, rebuild the solution, right-click then select "view designer" in the form code.
Very, very annoying. I am thinking of dropping back to VS2008.
Close the form. Clean the solution. Rebuild the solution. Reopen the form. Worked for me when nothing else would.
I had this same issue and I was able to resolve this by creating new project and then compiled and run the project and then I imported all the files and ran the project again and automatically it was working again did nothing extra.
I'm able to avoid restarting VS by doing the following
Add a new user control
Drag and drop some of your custom user controls on to it (If it gives you an error, build the solution again).
Reopen your control.
In my case, I have a winforms project with several custom controls that are used by other custom controls. Whenever I open some of those custom controls, I get a the "The base class ..." error. Adding a new custom control, building the project and then adding some custom controls from my project to the new custom control allowed me to open the custom controls that were giving me the "The base class ..." error.
UPDATE: I think I found the problem. My controls were not 'added' properly to the csproj file. In the csproj file, the files for partial classes of UI controls/components need the 'DependentUpon' attribute.
E.x.:
before:
<Compile Include="Windows\Forms\DataGridView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Windows\Forms\DataGridView.Designer.cs" />
after:
<Compile Include="Windows\Forms\DataGridView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Windows\Forms\DataGridView.Designer.cs">
<DependentUpon>DataGridView.cs</DependentUpon>
</Compile>
I had a situation where a custom user control appeared to be creating the error (not sure why) so I removed references to the user control from the form and the error went away.
It seems that after installing SP1 the problem has gone away.
Thanks for your help everyone.
I had the same problem using A control With Generics
MvpUserControl<Presenter,IViewMode> : UserControl
what I do it's Remove the Reference and Add again, Clean and Rebuild the Solution I Hope this can be useful for anybody else
I had the same problem with VS2010 SP1. Finally using Windows Update I saw some updates for Visual Studio and .Net, I installed them and is not happening any more.
Old post, but for those whom may find this...
Just ran in to this error and for me it was relatively simple fix.
Found that it may have something to do with the names of your classes, and renaming the problematic class to a higher order. That is the alphabetical order it appears in the assembly (Where A is higher than Z).
MSDN Article
Good luck.
This error occur if the Form class is not a first class in the file, for example if there is some helper class at the beginning of the file.
To solve this issue, move all other classes except Form class to the bottom of the file.
Don't code in Form1.Designer.cs. Move your logic to Form1.cs (hit F7 on Form1.cs [Design] tab).
"In the project file (.vcxproj), locate the entry for the target
Framework version. For example, if your project is designed to use the
.NET Framework 4.5, locate
v4.5 in the
element of the element. "
(Microsoft)
In my case the "v4.5" didn't exist so I add it, and everything is good now.
I tried clean solution and re-build solution and worked for me.
Hope this help!
This solution works fine, please follow these steps below to solve your problem:
Check the reference if load correctly
Clean the solution and rebuild again
Clean the project and rebuild again
Clean your project and open it again
I was login as administrator in visual studio . I just close my visual studio and again open it without run as administrator and my problem is solved
I ran into this today after upgrading VS2019. I went to properties, configuration tab, and set the projects to Configuration = Debug, Platform = Any CPU. Then it worked.
I faced this issue.
To prevent possible data loss before loading the designer, the following errors must be resolved:
I found solution for this problem:
Close all open tabs, and refresh (sync active documents) the solution.
For more information, you can see this video : https://youtu.be/Q3x2HBd7BDs

Silverlight 4 OOB blank screen

I have a working web application which I want to use as OOB;
However, when I install it, all I get is a blank screen and nothing more...
I also tried without any javascript or HtmlPage.Methods invokes, but still the same
Please help
(A very late reply but the solution wasn't easily available so posting this to help anyone who needs help on this) I was having a problem with the white screen happening when launching OOB apps in debug mode. From lots of searching it appeared that the white screen occurs when an exception is thrown during the application start. Hence the app appearing to load correctly at first and then suddenly going to white screen. I found that the following line of code from the default business app template (from Application_Startup in App.xaml.cs) was causing the exception in OOB mode when using forms authentication:
WebContext.Current.Authentication.LoadUser(this.Application_UserLoaded, null);
Commenting out the line of code immediately made the white screen problem go away.
Make sure you are running the app in debug mode (set it to start in OOB from the project settings and set the project and not the website to be the startup project). If you do that, you should be able to step into where the problem occurs.
(https://forums.silverlight.net/forums/t/190044.aspx)
It's difficult to say what is wrong in your case because you haven't provided any sources, but you can use this article as a reference Building An Out-of-Browser Client With Silverlight 3
Maybe you're trying to interact with page right before InitializeComponent() call in constructor of your main UserControl. If some exception occured before InitializeComponent() then you'll receive blank screen.

Resources