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.
Related
I am trying to build MSIX setup for my WinForms application built on .net6. I want to give auto-update feature when the user clicks the "Update" button. I think originally developer didn't have control over updating MSIX and there was only way it was updated automatically when the application is restarted.
But there is a recent article on taking full control over MSIX updates I tried to follow it but I am facing the exception 'System.InvalidOperationException' while running the below line of code.
Package package = Package.Current;
I am using visual studio 2022 & WinForms application running on .net 6. I have kept other configurations as described in the above article but it is not working as expected. (I have tried in .net core 3.1 and it is working with it)
Package.Current only works in a packaged context, so you need to make sure to actually debug/launch the packaging project. An InvalidOperationException indicates that you are running your project unpackaged.
Make sure to select "Set as Startup Project" on the packaging project, likely named "MyApp (Packaging)" in the Solution Explorer. Then you can launch/debug your project as you normally do.
I've been using Inspect.exe from the Windows SDK to examine the properties of a WinForms application but noticed that I didn't see any of the properties (for example, the AutomationId) whilst running the application from Visual Studio (F5 to run.) However, if I ran the .exe from the bin\debug folder I could see the properties fine.
The source I was using was example code downloaded from UI Automation Custom Provider Samples - Part 3.
I'm wondering why this happened since I'm sure another machine that I had tried this on worked fine and I wasted time poking around in debug mode wondering why my UI Automation properties weren't visible. Obviously there's a workaround but I'd like to understand why this was happening and have a record of the problem for other people to find!
I've struck upon the answer - because I had launched Visual Studio as Administrator but the Inspect.exe tool as standard user then the properties being reported back were a sub-set of what I should have seen. As soon as I launched Inspect.exe as Administrator it worked!
every time we open a *.xaml file in our project - we see not working designer and a lot of messages 'type not found' 'assembly not found' etc.
After a couple of experiments, i found out a root of a problem :
create new WPF application, create a folder in project root, add some value converter to folder, try to use it on your 'MainWindow.xaml'
you will probably write something like this :
xmlns:Folder="clr-namespace:WpfApp.Folder"
and then
<Window.Resources>
<Folder:SomeValueConverter x:Key="someKey"/>
</Window.Resources>
You know...
And, now the most interesting thing!
when you build your project for x86 or 'any CPU' - everything will be just fine, designer will be available, all namespaces will be imported perfectly!BUT, just change you project configuration to x64...Rebuild solution and open design view... You'll be amazed...errors, types not found, etc...
How the hell to use VS xaml designer in x64 applications?
Windows 7 enterprise x64, Visual Studio 2010 Ultimate
Others have reported the same problem. One of the workarounds suggested was to do the design work with a 32-bit target, and then switch to 64-bit only when you're ready to compile and deploy.
In my case, I was using an obfuscator (ConfuserEx to be exact) as a post-build step in Release configuration that was causing this behavior. Switching back to Debug configuration fixed the problem. Alternately, removing the post-build step will also fix the problem.
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.
I have a problem with ClickOnce publishing of a WPF application.
If the application is built (debug or release), it is running correctly.
Application published by ClickOnce crashes.
I tried to change Target Platform. Sometimes this change helps to solve problems, but not every time (1 of 20 cases).
I have Visual Studio 2008 and the project has been upgraded from Visual Studio 2005.
Any ideas?
Thank you in advance!
On the machine where the application is installed, drill down in the user profile to the ClickOnce cache, and look for the cached application files. The folder will have the exe and all of the assemblies, etc., in it. Our winform app creates two folders, xxxx_tion is the one the application runs from.
Find the exe file and double-click on it to run it. This essentially runs the application without the ClickOnce-ness of it all. If it crashes, then it is not a ClickOnce problem per se, it is a problem with your application.
I would check and make sure you are deploying all of the files you need, you don't have references to multiple versions of the same dll, you don't have circular references, etc.
Good luck,
RobinDotNet
There is a long discussion on http://social.msdn.microsoft.com/forums/en-US/wpf/thread/3e6909ef-2ab1-4b77-8bc2-796c065a6219/
Solution that worked for me (send by pindurav on page above):
I rebuild whole solution
close visual studio
open visual studio, open project and directly publish without building.
= no app.xaml exception