WPF - My application installer is crashing - wpf

Its a .NET 3.5, x86 application that I built. It works. But when I try to install it using a custom installer, it fails with this error The App has stopped working. In the dialog box, it shows path to two files. In one of the files, I found this.
<ProblemSignatures>
<EventType>CLR20r3</EventType>
<Parameter0>app.installer.exe</Parameter0>
<Parameter1>1.0.0.0</Parameter1>
<Parameter2>5321e224</Parameter2>
<Parameter3>App.Installer</Parameter3>
<Parameter4>1.0.0.0</Parameter4>
<Parameter5>5321e224</Parameter5>
<Parameter6>4</Parameter6>
<Parameter7>e</Parameter7>
<Parameter8>System.IO.FileNotFoundException</Parameter8>
</ProblemSignatures>
Is there a way I can find what file was not found for Parameter8 above?
In the other file, I found this Exception Code: 0xe0434f4d but that didn't help much either.
Update:
I'm installing by adding a separate project that is pointing to the .application file of the actual app like below.
try
{
Uri deploymentUri = new Uri(deployManifestUriStr);
iphm = new InPlaceHostingManager(deploymentUri, false);
}

It was missing a dll. I tried copying that dll to the folder where exe was being run from and it works. But I couldn't still figure out how to find the NAME of the missing file. I just found out it was missing a dll by trial and error.
Unless I get a better answer, this is the answer, I guess. Make sure you have all dlls the exe is expecting in the exe directory.

Related

Getting Errors Trying to Load SqlServerSpatial140.dll

I am using SqlGeography in a project that was working but now is not. The only thing that has changed that I can think of is that Windows 10 did an update to my PC but I am unsure that that is the source of the problem.
I used NuGet to remove and then re-add the reference to SqlServer140.dll and got this message:
Errors were detected when processing \packages\microsoft.sqlserver.types. 14.0.1016.290\nativebinaries\x64\SQLSERVERPARTIAL140.dll. Please make sure that the file eis accesible, and that it is a valid assembly or COM component.
I used this SO thread to work on this problem. I downloaded Dependency Walker and ran it against SqlServerSpastial140.dll and got this error message:
Errors were detected when processing that . See the log window for details.
Unfortunately, the help file for Dependency Walker is not included in the download (I downloaded both form its home page and also a link at Microsoft - the help was missing from both) so I do not know how to read the result. Here is an image of the result:
Assuming the "log window" is the one at the very bottom, it is not helpful. What do I have to do to restore the SqlGeography functionality. I've also tried other suggestions from the link mentioned above but nothing has worked.
What worked for me was to go to this file location below and copy the SqlServerSpatial140.dll to my project bin folder.
C:\Users<user>.nuget\packages\microsoft.sqlserver.types\14.0.1016.290\nativeBinaries\x64

gstreamer-sharp C# application deployment

Can anyone tell me the proper way to deploy a C# WinForms application that uses gstreamer-sharp? The only way I can get it to work is to work is by setting the gstreamer bin directory as my Application's working directory.
I have seen examples trying to temporarily set the application's path to the various gstreamer directories, but this still does not work for me and I get errors that DLL's are missing.
Environment.GetEnvironmentVariable("PATH") + ";C:\\gstreamer\\1.0\\x86\\bin\\");
Environment.SetEnvironmentVariable("PATH",
Environment.GetEnvironmentVariable("PATH") + ";C:\\gstreamer\\1.0\\");
Environment.SetEnvironmentVariable("PATH",
Environment.GetEnvironmentVariable("PATH") + ";C:\\gstreamer\\1.0\\x86\\lib\\");
Environment.SetEnvironmentVariable("PATH",
Environment.GetEnvironmentVariable("PATH") + ";C:\\gstreamer\\1.0\\x86\\");
Should I just deploy all of the gstreamer DLLs inside my application's bin driectory? I was hoping to have them run the installer and then my application could could reference it.
Any help on this would be greatly appreciated.
Adding the bin directory only should be enough. You can look at https://github.com/Vocaluxe/Vocaluxe/blob/develop/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudio.cs to see how initialization is done in Vocaluxe.
Probably the easiest solution I can come up with is manually putting the gstreamer bin directory in the system's PATH.

MEF Parts not found for deployed app, but found in Debug mode

I checked a lot of MEF questions here but I can't imagine what my problem is. Here's what's happening:
I have a desktop WPF app that I'm deploying with AdvancedInstaller. I use .NET 4.0 and MEF to compose parts. Some parts are in the main project, so they are inside the app.exe file. Other parts are inside class libraries that reference the main project, so they are inside somename.dll files.
The problem:
While running the app from VS, both in Debug and in Release, everything is fine. Once I deploy the app, some of the dlls say that they have no parts (zero) to export.
I checked the following:
all dlls are available in the deployment and the catalog is finding the files
the export types and names are correct, after all, everything is working while in Visual Studio
when I try to add the parts from the dlls, I get that the number of parts is zero ONLY IN DEPLOYMENT.
This is the code that's not findind parts in the deployed app:
var catalog = new AggregateCatalog();
string path = Environment.CurrentDirectory.ToString();
DirectoryCatalog qualitycontrol = new DirectoryCatalog(".", "QualityControl.exe"); //this is my main assembly
DirectoryCatalog qualitymix;
catalog.Catalogs.Add(qualitycontrol); //this finds the parts and always works fine
if (File.Exists(path + #"\QualityMix.dll"))
{
qualitymix = new DirectoryCatalog(".", "QualityMix.dll"); //the file exists in the deployment
catalog.Catalogs.Add(qualitymix); //the "qualitymix" catalog shows more than 20 parts if run with VS, but 0 parts in deployment
}
The only thing that works (but it's very slow to start the app) is the following:
var catalog = new DirectoryCatalog(".", "*");
This has the problem that it needs to check more than 100 files present in the working directory, and I cannot deploy my plugin dlls in a different dir.
Why is it that a DirectoryCatalog looking at all files finds the parts, but a DirectoryCatalog looking at a single part does not? How can I debug this issue if it only happens in the deployed app?
---Edit: this problem is only happening with certain dlls, the files are found and for other dlls the parts are also found. I'm using the same Export/Import procedure in all dlls, but somehow some of them show no parts in deployment
Anything you can suggest will be helpfull, thank you guys!
NEW INFO!
I tried loading my dll with an AssemblyCatalog. It works in Visual Studio (Debug and Release) but when deployed I get the following errors:
1st try:
if (File.Exists(path + #"\QualityMix.dll"))
{
qualitymix = new AssemblyCatalog(Assembly.LoadFile(path + #"\QualityMix.dll")); //file is loaded and parts found in VS
catalog.Catalogs.Add(qualitymix);
}
Error: The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018).
Second try:
if (File.Exists(path + #"\QualityMix.dll"))
{
var name = AssemblyName.GetAssemblyName(path + #"\QualityMix.dll");
qualitymix = new AssemblyCatalog(Assembly.Load(name));
catalog.Catalogs.Add(qualitymix);
}
Error: Could not load file or assembly 'QualityMix.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I've looked for questions about these errors but nothing has been helpful so far. All projects are built for All CPUs, and the references look ok (this dll uses the same references as other projects that are loading ok).
Edit 2:
I tried the suggestion by #SuryaBhaskar to use LoadFrom instead of Load
if (File.Exists(path + #"\QualityMix.dll"))
{
qualitymix = new AssemblyCatalog(Assembly.LoadFrom(path + #"\QualityMix.dll"));
catalog.Catalogs.Add(qualitymix);
}
But I get the same error: Could not load file or assembly 'QualityMix.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I managed to solve this issue by moving the code of the problematic dll to a new project. This solved the issue, somehow... though the reason remains a mistery to me.
Use LoadFrom instead of LoadFile or Load.If you use Load it will have conflicts with other assemblies on current AppDomain

AppManifest.xml not getting updated by SL build

I'm starting an SL project in VS2010, and I'm finding that the AppManifest.xml file isn't being updated by the build. This causes the xap to fail to load in the browser, throwing an InitializationException. Doesn't VS maintain this file for you?
I noted that the Build Action listed for the AppManifest.xml file is currently "None", but I'm not sure what I should change that to, if anything.
The problem turned out to be that I didn't have any Application class in my project, nor the required App.xaml. (I had somehow deleted these files when attempting to customize the solution.) This caused the xap to fail to load, and the error message led me to believe that the root cause was the AppManifest.xml, which generates the AppManifest.xaml file.
This was a mistake. Fixing the Application class and the App.xaml solved the problem.

jTwitter, oAuth, and Google App Engine. NoClassDefFoundError

I'm trying to use jTwitter to get an oauth instance to twitter with my consumer key/secret and access token/secret. This is well documented in the javadoc here. I have downloaded signpost, signpost-jetty, and the jtwitter library, but after deploying and running the servlet, I get a error java.lang.NoClassDefFoundError: winterwell/jtwitter/OAuthSignpostClient Eclipse isn't complaining about the class not being there, because it is there-- I can see it in the JAR file itself, which is in my project. So, I said forget it, I'll try out OAuthScribeClient instead, but this generated a VERY SIMILAR ERROR java.lang.NoClassDefFoundError: org/scribe/oauth/Token This one confuses me even further because I have the following code in my java file, and it compiles without error or warning:
import org.scribe.oauth.Token;
Token token = new Token("myaccesstokeninfo", "accesstokensecret");
Clearly, I'm missing something very fundamental, but I am at an absolute loss as to what it may be. Thanks.
Usually "NoClassDefFoundError" happens when you forget to copy all jar-files to your "/war/WEB-INF/lib" directory, so those libs will be unavailable from server-side.
Xo4yHaMope is probably right.
If you're working from Eclipse but running using a web container, then your runtime classpath might be different from your project classpath - which can cause this error.
In order to complete Ben Winters answer what I actually did and worked is add the jar in
the libs folder within the project
see also here about folder hierarchy.
When you do this eclipse will normally add the jar to the android dependencies before launching the application. What I realise is that adding a jar in the build path will make classes available only during the build

Resources