5

I've written an application that runs fine on my development device and my Win 7/8/10 VM's but crashes on every single other computer (win 7/8/10) I have tried it on. When starting the application it's almost as if nothing happened.

In the Event Viewer, the exception is XamlParseException.

  • I am building this with VS 2013 Update 5
  • The application targets .NET 4.5
  • I have verified .NET 4.5 on other devices

Event Viewer caught this (I get v4.0.30319 on my device and all devices even though they have .NET 4.5+):

Application: HelpScoutMetrics.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Windows.Markup.XamlParseException
Stack:
   at System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri)
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(System.Xaml.XamlReader, Boolean, System.Object, System.Xaml.Permissions.XamlAccessLevel, System.Uri)
   at System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream, System.Windows.Markup.ParserContext, System.Object, Boolean)
   at System.Windows.Application.LoadComponent(System.Object, System.Uri)
   at HelpScoutMetrics.MainWindow.InitializeComponent()
   at HelpScoutMetrics.MainWindow..ctor()
   at HelpScoutMetrics.App.OnStartup(System.Windows.StartupEventArgs)
   at System.Windows.Application.<.ctor>b__1(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)

I have tried the solutions here: .NET application cannot start and receive XamlParseException

I have tried commented out my starting code, in App.xaml.cs the OnStartup() override has base.OnStartup() commented out and the only code is to pop-up a messagebox. The application still crashes.

I have verified to the best of my ability that all my dependencies exist in the output folder.

What could be causing this? What can I do to get more info on the exception? What code runs before OnStartup() that I can try and wrap with a handler?

riQQ
  • 9,878
  • 7
  • 49
  • 66
Douglas Gaskell
  • 9,017
  • 9
  • 71
  • 128
  • What version of Visual Studio with which update are you using? I remember a horrible scenario like this where, in VS 2013 with a particular update, if you were developing a WPF application and referenced another project in the solution with a name like `MySolution.MyProject.Core` it would ALWAYS blow up. It was the dots in the name that caused it to blow up. One wild guess, as it happened to me. – Will Custode Sep 04 '15 at 19:00
  • VS 2013 Update 5. I do have another project in the solution, however it's name does not have any dots. – Douglas Gaskell Sep 04 '15 at 19:05
  • Confirm that both the debug and release are set to 4.5. As far as the entry point, it's in your App.g.cs. In my time developing in WPF an VS2013 I've come across some frustrations as well... for no reason something says something is missing or similar nonsense, while everything where it's supposed to be. Good luck. :/ – B.K. Sep 04 '15 at 19:36
  • Thanks for the reply @B.K. , both are set to 4.5. I shouldn't be able to build otherwise since I am using .NET 4.5 features. – Douglas Gaskell Sep 04 '15 at 19:40
  • You're including all the needed dependencies right? I'm not sure if you're using some custom control libraries, but if they fail to load you'll get xaml parse exception. Then again... if something is wrong in the code behind/viewmodel, same thing will occur. Try doing a try catch around the entry point as a catch-all and see if that helps you find the issue. – B.K. Sep 04 '15 at 19:42
  • @B.K. to the best of my ability I have verified all dependencies. I am using several 3rd party libraries like MahApps, NLog, and my updated version of HelpScoutNet. I have verified this with dependency walker. – Douglas Gaskell Sep 04 '15 at 19:47
  • Confirm that you're targeting compatible CPU type (x86, 64, all). Also confirm that your dependencies are supported on the target machine. For example, you wouldn't want to run SQLite's 64-bit dll's on a 32-bit machine. Also confirm that your application is compiled in the same compatibility mode as your dependencies, regardless of target machines being 64-bit. – B.K. Sep 04 '15 at 19:51
  • @B.K. I am targeting x86, however I cannot verify the rest since I am not at home for another 9 hours. Though, windows should throw a comparability error when you try and launch a x64 application on an x86 system. – Douglas Gaskell Sep 04 '15 at 19:55
  • Well, it's a should versus does sort of deal. When I was new, I was tearing my hair out because I was getting some odd exception on my first deployed application upon startup. Long story short... it was not compatible with Windows XP. Nothing about any sort of compatibility was being set off. So... just something to check. The reason I mentioned SQLite is because I had some issues where my target machines were 64-bit and my dev machine was 64-bit, I was targeting x86 for safety (in case a target is x86), but I had to include SQLite libraries for both or app crashed. Go figure. – B.K. Sep 04 '15 at 19:57
  • If nothing works, see if you can get Fusion Log Viewer to help you out: http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx You'll basically need to start getting familiar with these sort of tools to figure out what's going on. There are a few free ones from Microsoft as well. – B.K. Sep 04 '15 at 20:00
  • @B.K. Will Do, I'll give that a shot when I get home. Hopefully it can yield favorable results. – Douglas Gaskell Sep 05 '15 at 01:30
  • Is your app.config file missing on the machines where it crashes? – StillLearnin Sep 05 '15 at 04:13

0 Answers0