System.ArgumentNullException when creating a new Silverlight Project - silverlight

I'm getting the exception listed below when looking at the MainPage.xaml of a newly created Silverlight application. By newly created I mean nothing, at all, has been modified; I just create the solution in VS and get the error as soon as it loads the xaml in the designer.
I'm using Visual Studio 2010 Professional on Windows XP.
Building the entire solution succeeds and appears to run without error. I say "appears" though because it's a blank screen; no controls have been added.
I've recreated the solution multiple times, restarted VS, rebooted, etc.
I've tried running the repair/reinstall twice.
I've applied all updates available via Windows Update.
I've tried creating both Silverlight 3 and 4 solutions.
I've searched the Internet to no avail.
What's wrong?
System.ArgumentNullException
Value cannot be null.
Parameter name: parentContext
at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext..ctor(IMetadataContext parentContext)
at MS.Internal.Host.ProjectMetadataContext..ctor(IMetadataContext platformMetadata, AssemblyReferenceProvider referenceProvider)
at MS.Internal.Host.ProjectMetadataContext.FromReferences(AssemblyReferenceProvider referenceProvider)
at MS.Internal.Designer.VSDesigner.GetMetadataForDesignerContext(DesignerContext designerContext)
at MS.Internal.Host.PersistenceSubsystem.Load()
at MS.Internal.Host.Designer.Load()
at MS.Internal.Designer.VSDesigner.Load()
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load()
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.Load()
at MS.Internal.Designer.DesignerPane.LoadDesignerView()

Do you have the Silverlight Developer runtime installed ?
http://go.microsoft.com/fwlink/?LinkId=146060

Ended up having to reinstall Windows, unfortunate, but it works now.

If anyone is getting this error when making a new Windows Phone project (which uses Silverlight), if you install the Windows Phone SDK 7.1 (or probably any SDK after that), it should fix this problem.
http://www.microsoft.com/download/en/details.aspx?id=27570
I didn't have to uninstall anything before this install. Just download the vm_web2.exe, and run it. Reopen VS, make a brand new Windows Phone project, everything should be OK.

Just uninstall all the silverlight SDK and toolkit, and reinstall silverlight 4 toolkit. Do not have to install Silverlight 3 again. It fix my problem.

Related

Why do i get Null Reference Error's suddenly even when the same code worked perfectly before

I have an WPF application using MVVM with PRISM. I'm also using DevExpress for this project.
The application has 10 modules. And everything worked well. The application is in production.
After opening the source in Visual Studio 2019 yesterday i'm getting all kinds of NullReferenceExceptions on the SelectedItem of the DevExpress GridControl. The application uses the SelectedItem to publish events using EventAggregator (PRISM). so i get errors here.
I have done nothing to explain this behaviour.
The only thing i can think of is that i had a power failure and after reopening the solution i started getting these errors.
Does this have to do with an update i don't know of?
I'm using .NET Framework 4.7.2. Prism 6, DevExpress 20
Can anyone help?
You can try to delete bin and obj folders from your project folder, it usually does the trick, if that doesn't work, you can try to Restore the Nugget Packages.
1 - Enable package restore by choosing Tools > Options > NuGet Package
Manager. Under Package Restore options, select Allow NuGet to download
missing packages.
2 - In Solution Explorer, right click the solution and select Restore
NuGet Packages.

Silverlight not loading

I tried installing silverlight 5 developer runtime but sadly things ended up being a big mess leaving my vs2010 having "catastrophic error" everytime i'm in design view.
I removed everything silverlight related (or think i did. There are no other silverlight toolkits or runtimes installed on the uninstall list).
Now I browsed to a silverligt app and the "get silverlight" link appears and I downloaded and installed the runtime but the silverlight won't load now (no loading icon and the page is just blank). I checked the app on a different pc and it loads fine.
I've tried both 32 and 64 bit runtime (silverlight 5 is the latest afaik) and tried both versions of IE and chrome. I'm on a 64bit win 7 ultimate and vs2010 ultimate. What am i missing?
Fixed. What I did was:
uninstall every silverlight related programs installed (blend, silverlight toolkits, developer and user runtime)
ran CCleaner to get rid of unnecessary entries in the registry.
repaired/reinstalled Visual Studio (don't need to uninstall this).
then re-install the necessary silverlight sdks and runtimes.

Always see NullReference exception in designer with all silverlight business applications in visual studio 2010

Starting with the most simple case.
If I press "File->new project->silverlight business application" it opens up to MainPage.xaml saying the message attached at the bottom of this post.
It also does the same thing to any silverlight business application that exists in sourcesafe - this is the first time I've personally needed to work on this technology.
Any advice would be very much appreciated I really need to get started on a project and I feel quite disabled to not have the designer.
Thanks in advance.
An Unhandled Exception has occured
Click here to reload the designer
Details:
System.NullReferenceException Object reference not set to an instance
of an object. at
Microsoft.Windows.Design.Platform.SilverlightMetadataContext.SilverlightXamlExtensionImplementations.d__8.MoveNext()
at
MS.Internal.Design.Metadata.ReflectionProjectNode.BuildSubsumption()
at
MS.Internal.Design.Metadata.ReflectionProjectNode.SubsumingNamespace(Identifier
identifier) at
MS.Internal.Design.Markup.XmlElement.BuildScope(PrefixScope
parentScope, IParseContext context) at
MS.Internal.Design.Markup.XmlElement.ConvertToXaml(XamlElement parent,
PrefixScope parentScope, IParseContext context, IMarkupSourceProvider
provider) at
MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.FullParse(Boolean
convertToXamlWithErrors) at
MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.get_RootItem()
at
Microsoft.Windows.Design.DocumentModel.Trees.ModifiableDocumentTree.get_ModifiableRootItem()
at
Microsoft.Windows.Design.DocumentModel.MarkupDocumentManagerBase.get_LoadState()
at MS.Internal.Host.PersistenceSubsystem.Load() at
MS.Internal.Host.Designer.Load() at
MS.Internal.Designer.VSDesigner.Load() at
MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load() at
MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView
view) at
MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory
factory, IsolatedView view) at
MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory
factory, IsolatedView view) at
MS.Internal.Host.Isolation.IsolatedDesigner.Load() at
MS.Internal.Designer.DesignerPane.LoadDesignerView()
If you run into this issue, a possible cause is due to you having Microsoft SilverLight version 5.0 installed on your pc versus that of 4.0 (Version: 4.0.50826.0). Remove the copy of SilverLight 5.0. Install the version located at the following link - http://go.microsoft.com/fwlink/?LinkId=146060
DO NOT INSTALL version 5.0 IF YOU HAVE SDK 3 AND 4. INSTALL MICROSOFT SILVERLIGHT 4.0
This happens if you have installed visual studio 2011 developer preview on your pc.
To resolve the error close visual studio and your browsers. Uninstall silverlight (no need to uninstall the sdk just silverlight itself).
Then re-open your project. Follow the instructions and it'll be working just fine.
it might be because of your application is developed on Silverlight 5 and you are opening it with the machine having silverlight 4. i am just giving example of 5 and 4. or might be you have not installed the SDK pack of it.

compile error when creating a new SL4 navigation app

I created a new Silverlight Navigation Application using Visual Studio 2010. I didn't make any changes to the code. Just Pressed F5 to run. I get the following error message:
The type 'System.Windows.Navigation.NavigationEventArgs' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.Windows.Controls.Navigation.dll' and 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.Windows.dll'
I right clicked the Silverlight Navigation Application folder in the solution explorer and changed its "Target Silverlight Version" from Silverlight 4 to Silverlight 3 and then ran the application (by pressing F5) and it works fine.
I've already spent a lot of time trying to fine a solution. I want to develop application using Silverlight 4.
Would really appreciate any help with this.
Regards,
Vivek
It sounds like you have Silverlight 4's runtime, but an older set of VS tools or an older SDK, or your project is somehow referencing the older SDK.
Basically, that type moved from the System.Windows.Controls.Navigation DLL (where it was in SL3) to System.Windows.dll (where it is in SL4). CLR type-forwarding should take care of this.
Since Silverlight version numbers on assemblies didn't change between SL3 and SL4 it can be somewhat hard to tell if you're in the situation where you have outdated tools/SDK. Check the last modified date on System.Windows.Controls.Navigation.dll and see if it looks like about the time SL4 was released, or check if the Frame control has a property called ContentLoader - if so, you have the updated bits (and my answer is thus not helping). If not, however, then try reinstalling the SL4 Tools and/or SDK and check that your project is referencing the v4 Navigation assembly.

Blend 4 breaks VS2010 for Silverlight

I had VS2010 running fine with Silverlight development. Then I installed Expression Blend 4. Now when I run VS2010 and try to debug a silverlight app I get an error saying "Unable to start debugging. The silverlight developer runtime is not installed. Please install a matching version." I've tried uninstalling silverlight tools, and reinstalling them from scratch (the latest april version). But I still get the same message. So basically I'm now unable to do VS2010 SL development. I'm on the verge of just rolling back to my last system restore point and giving up on Blend. But if I do that I'd be worried that Product Activation would never allow me to reinstall it in the future, since the MSDN download page implies I'm only ever allowed to install it on a single machine. Any help appreciated.
Thanks
I had the same problem after installing Expression Studio 4. I installed the Developer version of Silverlight at: http://go.microsoft.com/fwlink/?LinkID=188039
and the problem seems to be resolved.
Hope that helps.
Try reinstalling or reparing the Silverlight_Tools for Silverlight 4.
You tried that.
The product activation system isn't that draconian it has to allow for things like hardware failures etc which would require re-installs.
Thanks for the suggestions. I solved it this way: Since I'm running under parallels, I rolled back to a snapshot taken before I'd installed Blend. Then I rebooted Windows. Then I reinstalled Blend (happily with no draconian activation problems!), and everything worked.
So why did it work the second time and not the first time? The first time I installed Blend, I'd shut down VS2010, explorer etc, but not rebooted. Perhaps some hidden VS-related process was still running. Installing Blend in that situation screwed everything up, and removing and reinstalling stuff didn't fix it. Obviously the Blend installer should have spotted the dangerous process and taken remedial action, but it didn't. Perhaps MS recommends you reboot before installing new software? That would be a bit of a nuisance, and I've never needed to before. My real lesson from this is to work in a VM and take regular snapshots.
Thanks again.

Resources