BindingFailure on assembly PresentationFramework.Aero2 - c#

My WPF application, named Odyssey, throws an exception while starting, more specific: when creating a new window.
Additional Information: The assembly with display name 'PresentationFramework.Aero2' failed >to load in the 'Load' binding context of the AppDomain with ID 1. The cause of the failure >was: System.IO.FileNotFoundException: Could not load file or assembly >'PresentationFramework.Aero2, Version=4.0.0.0, Culture=neutral, >PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file >specified.
The strange thing is that when I run the application with the "Enable the Visual Studio hosting process" unchecked - this exception is thrown. When running it while the "Enable the Visual Studio hosting process" is checked - it works like expected since it loads 'PresentationFramework.Aero'.
Since the application is trying to load the 'PresentationFramework.Aero2', the application itself fails with not showing any images.
I tried to create a new solution and then it worked, but only if I have a different name on the solution! I backed up Odyssey and then deleted it, removed .Net 4.5 and Visual Studio 2012. I re-installed .Net 4.5 and Visual Studio 2012, but when I create a new solution named Odyssey, it still tries to load 'PresentationFramework.Aero2', but not for the other solutions I have made.
Anybody now a fix for this?

I managed to solve this myself. I ended up with deleting all the references to Odyssey in the windows registry in pure frustration and it ended up working!

After move application from one PC to another, I also got error message: Additional Information: The assembly with display name 'PresentationUI.Aero2' failed to load in the 'Load' binding context of the AppDomain with ID 1.
I resolve this problem by deleting .suo file and it works.

Related

Viewer lines in License.licx breaking build process

I've recently been tasked with adding a report to an older WPF application. Part of the process involved adding ActiveReports to the solution in question.
After getting the report implemented and tested on my local machine, it came time to commit it up to our Dev/Test build environments. Everything went fine, until I attempted to run the application on a machine that did not have ActiveReports installed and licensed on it - I got the "Viewer needs to be licensed error window."
Here's where things get confusing, though. It should be working.
For starters, I'm running ActiveReports 8.0.133.0.
The contents of my licenses.licx file are:
GrapeCity.ActiveReports.SectionReport, GrapeCity.ActiveReports.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff
I've generated a satellite licensing DLL for the WPF project's executable, and ensured that it's referenced and set to Copy Local = true. (I've already dealt with this in the past.)
Even though it's not a web project, for safety's sake, I used the WebKey Generator and added an Active Report 8 Developer key to the app.config file.
It gets more interesting, though. When I add the following lines to my licenses.licx file, as the error window I get above suggests I should do:
GrapeCity.ActiveReports.Viewer.Win.Viewer, GrapeCity.ActiveReports.Viewer.Win.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff
GrapeCity.ActiveReports.Viewer.Wpf.Viewer, GrapeCity.ActiveReports.Viewer.Wpf.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff
When I try to simply build the project in Dev, the build fails with the following message:
[10:29:34] [exec] (CompileLicxFiles target) ->
[10:29:34] [exec] Properties\licenses.licx(2): error LC0004: Exception occurred creating type 'GrapeCity.ActiveReports.Viewer.Win.Viewer, GrapeCity.ActiveReports.Viewer.Win.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff' System.ComponentModel.LicenseException: License cannot be confirmed. Error code: 01-001 [C:\CheckoutDirectory\Project\[(0) BUILD]\UI\UI.csproj]
[10:29:34] [exec] Properties\licenses.licx(3): error LC0004: Exception occurred creating type 'GrapeCity.ActiveReports.Viewer.Wpf.Viewer, GrapeCity.ActiveReports.Viewer.Wpf.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff' System.ComponentModel.LicenseException: License cannot be confirmed. Error code: 01-001 [C:\CheckoutDirectory\Project\[(0) BUILD]\UI\UI.csproj]
For those who don't want to scroll:
System.ComponentModel.LicenseException: License cannot be confirmed. Error code: 01-001
The end result is a sort of Morton's Fork of badness. Either I can build the app, but I can't run the report (which, is sort of the point of me making these changes), or I simply can't build the app at all.
Question: What can I do to get the report viewer to run without a license exception and keep the application building? I should also note, I'm on a short deadline with this!
I was correct to add the Win and WPF viewer lines; it turns out the answer was to upgrade the Build server with Active Reports 8. From there, everything went swimmingly.
TL;DR - Upgrade everything that needs to be upgraded!

Trouble when redeploying WP8.1 app

I met a problem, every time I want to deploy my app again, I will encounter error:
"An exception of type 'System.IO.FileNotFoundException' occurred in DropNetRT.ni.DLL but was not handled in user code
Additional information: Could not load file or assembly 'System.Net.Http.Phone, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified."
I have to uninstall the app, and then deploy. But next deployment same error again.
I'm also seeing this error - it only shows in Release mode, running the same app in Debug mode it doesn't repro.
The WP8.1 Silverlight solution builds without issue in both configurations.
Workaround for me is to remove all System.Net references solution-wide, clean the solution, then add them back in (using NuGet with Microsoft.Net.Http). Takes time and is annoying, but it works.
There seems no logic that the System.Net references removed and added back in are exactly the same assemblies and work fine on first deployment but fail on redeployment. It is even possible to redeploy exactly the same build and see this error.

Re-named assembly, application won't build

I renamed my WPF application's assembly from DBce_TEST2 to AMS, then attempted to build it to see what would happen. I ran it, and it wouldn't build for obvious reasons but now after renaming it back to DBce_TEST2 I get the following error:
Managed Debugging Assistant 'BindingFailure' has detected a problem in 'G:\C# Projects\Asset Management System\DBce_TEST2\bin\Debug\DBce_TEST2.vshost.exe'.
Additional Information: The assembly with display name 'AMS' failed to load in the 'Load' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'AMS' or one of its dependencies. The system cannot find the file specified.
The error can be fishy. Use Fusion log viewer to understand what has gone wrong.
How to enable assembly bind failure logging (Fusion) in .NET
Figured it out. Renamed the assembly again to some random text, attempted to run it, then renamed back to original assembly name and the error disappeared. Guess some generated files were messed up by visual studio a little bit, and this fixed it.

File not found exception for my MyWebservice.XmlSerializers when using PrincipalSearcher.FindAll()

I have a web service added by service reference (called "MyServiceReferences") in my ASP .NET MVC 4 solution. Also I have an Active Directory service in another project in the same solution. I am trying to display user name (First name and Last name) in my web page using active directory users information. The problem is when I call
PrincipalSearcher.FindAll(), it works sometimes. The exception I am getting is
Could not load file or assembly 'MyServiceReferences.XmlSerializers'
or one of its dependencies. The system cannot find the file specified.
In my project build setting I have tried to set Generate serialization assembly "On". But it did not solve my problem.
Following command from visual studio command line solves the problem
Sgen.exe (locationOfTheDllFile)\MyServiceReferences.dll
But there is another following error occurs rarely (when attempting to load the page very very often)
[System.AppDomainUnloadedException] = {"Attempted to access an unloaded appdomain. (Exception from HRESULT: 0x80131014)"}

Problem with error messages in solution

I have a solution with around 10 projects, I have not written any of this myself, but I'm going to take over a project here. The project that is the main project is based on WPF. When I try to run this project, I get the following compiler error:
The tag 'RoutingManagerView' does not exist in XML namespace 'clr-namespace:RoutingManager.Views;assembly=RoutingManager'. Line 29 Position 14. C:\Source\WSA\WsaClient\Views\MainView.xaml 29 14 WsaClient
Then, if I double click this error message, so that the xaml is opened, and the designer is loaded, the designer does not load, and I get 3 more error messages:
Unable to load the metadata for assembly 'WsaClient'. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered during load: Could not load file or assembly 'WsaClient' or one of its dependencies. The system cannot find the file specified. C:\Source\WSA\WsaClient\Views\MainView.xaml 1 1 WsaClient
Unable to load the metadata for assembly 'RoutingManager'. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered during load: Could not load file or assembly 'RoutingManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. C:\Steria\Forsvaret\P6088\Source\WSA\WsaClient\Views\MainView.xaml 1 1 WsaClient
The type 'Views:RoutingManagerView' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Source\WSA\WsaClient\Views\MainView.xaml 29 14 WsaClient
I googled it, and many have suggested that this is because a DLL is locked since it originates from the internet. However in my condition, I do not have a DLL. It's complaining on two projects that are a part of the solution, WsaManager and RoutingManager. I got all the source code on a zip file on an usb pen, and I have extracted it to somewhere on my c drive, so there is no remote access of the code.
If anyone have had the same or similar problem earlier, I would highly appreciate any pointers here on how to resolve this.
EDIT
The last error message is given on this line in the XAML file:
<Views:RoutingManagerView DataContext="{Binding Dependency}"/>
And on the top of the XAML file, this is the import for the assembly:
xmlns:Views="clr-namespace:RoutingManager.Views;assembly=RoutingManager"
Resolve this by right clicking on the solution and choosing 'Rebuild Solution'
An additional point for other readers: if your projects builds successfully, but you get this error message while trying to load your view in the designer, make sure your assembly is x86 or Any CPU, because Visual Studio 2010 is a 32bit process and cannot load x64 assemblies in the designer.
To resolve this problem, I had to compile the projects one by one, starting from the project with no dependencies on other projects, and then working my way "up".
It seems that the Build all did not manage to do this properly automatically.
Try this, this was the only advice that worked for me:
Unable to load the metadata for assembly ''. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545.  The following error was encountered during load: Could not load file or assembly '' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
In WPF project to allow the project to load from remote source we have to enable it in the configuration file devenv.exe.config.
Step 1: Search the configuration file devenv.exe.config in your system. Usually it is located at
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config
Step 2: Edit the configuration file. Add following line in the tag
<loadFromRemoteSources enabled="true" />
Step3: Restart your visual studio.
http://exacthelp.blogspot.cz/2012/02/unable-to-load-metadata-for-assembly.html
Unable to load the metadata for assembly 'WsaClient'. This assembly
may have been downloaded from the web. See
http://go.microsoft.com/fwlink/?LinkId=179545. The following error was
encountered during load: Could not load file or assembly 'WsaClient'
or one of its dependencies. The system cannot find the file specified.
C:\Source\WSA\WsaClient\Views\MainView.xaml 1 1 WsaClient
I run into same error: I can build and run my project, but I can not design XAML. I realized that it was local configuration issue because it's not replicable on my other machine (using same repository revision).
I started digging more and figured out that VS 2010 does not like # symbol in path. So error shows up when I have my sources in
C:\#projects\<my project>
After I moved them to
C:\projects\<my project>
Problem is gone.
I hope this will help to someone else.
I suspect the ..
The tag 'RoutingManagerView' does not exist in XML namespace 'clr-namespace:RoutingManager.Views;assembly=RoutingManager'. Line 29 Position 14. C:\Source\WSA\WsaClient\Views\MainView.xaml 29 14 WsaClient
.. error is causing a cascade of other errors. It looks like you're trying to create a RoutingManagerView from the namespace RoutingManager.Views in the assembly RoutingManager. However, it is not there. Make sure the class is visible to the outside world. Or try to clean and rebuild the solution and see on which project the first error occurs. Because if the projects are interdependent, an error in one project might cause reference errors in others.

Categories