Wpf Application Does not start at startup but run manually? - c#

I have created an app in WPF which is just polling app. Now I want to start that app on windows Startup (after user login). I also created an installer package using Wix Toolset which adds a registry key to Software\Microsoft\Windows\CurrentVersion\Run. Program actually tries to run but gives no error. I was able to get error from Windows Event Viewer and I cannot understand where this error is generated.
Stack Trace:
Application: icBlync.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.DirectoryNotFoundException
at System.IO.__Error.WinIOError(Int32, System.String)
at System.IO.FileStream.Init(System.String, System.IO.FileMode, System.IO.FileAccess, Int32, Boolean, System.IO.FileShare, Int32, System.IO.FileOptions, SECURITY_ATTRIBUTES, System.String, Boolean, Boolean, Boolean)
at System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare)
at System.Windows.Media.Imaging.BitmapDecoder.SetupDecoderFromUriOrStream(System.Uri, System.IO.Stream, System.Windows.Media.Imaging.BitmapCacheOption, System.Guid ByRef, Boolean ByRef, System.IO.Stream ByRef, System.IO.UnmanagedMemoryStream ByRef, Microsoft.Win32.SafeHandles.SafeFileHandle ByRef)
at System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream(System.Uri, System.Uri, System.IO.Stream, System.Windows.Media.Imaging.BitmapCreateOptions, System.Windows.Media.Imaging.BitmapCacheOption, System.Net.Cache.RequestCachePolicy, Boolean)
at System.Windows.Media.Imaging.BitmapFrame.CreateFromUriOrStream(System.Uri, System.Uri, System.IO.Stream, System.Windows.Media.Imaging.BitmapCreateOptions, System.Windows.Media.Imaging.BitmapCacheOption, System.Net.Cache.RequestCachePolicy)
at System.Windows.Media.Imaging.BitmapFrame.Create(System.Uri, System.Net.Cache.RequestCachePolicy)
at System.Windows.Media.Imaging.BitmapFrame.Create(System.Uri)
at icBlync.Windows.SettingWindow..ctor()
at icBlync.App..ctor()
at icBlync.App.Main()
Pls Help.

When App starts from Startup, working directory was not the installed directory. So when the app tries to load Icons, it gives System.IO.DirectoryNotFoundException.
I just changed the working directory to the Installed directory using:
Environment.CurrentDirectory = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);

Related

Opening SQL Server Connection causes: System.AccessViolationException Attempted to read or write protected memory

All,
Env:
Server OS: Windows Server 2012R2 (64bit)
Server hardware: Uses virtualization software
App build on .net framework: 4.6.1 (Compilation=Any CPU), WinForms application
I have an application that connections to SQL server. When the application tries to open SQL server connection I get System.AccessViolationException (stack trace below). This happens only on that server. The application runs fine on other servers/workstations. I've done the following tests - read below (after stack trace for more info).
Exception details:
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
Application: UpdateCenter.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at SNINativeMethodWrapper.SNIPacketAllocate(System.Runtime.InteropServices.SafeHandle, IOType, IntPtr ByRef)
at System.Data.SqlClient.SNIPacket..ctor(System.Runtime.InteropServices.SafeHandle)
at System.Data.SqlClient.TdsParserStateObject.GetResetWritePacket()
at System.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean)
at System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte, Boolean)
at System.Data.SqlClient.TdsParser.SendPreLoginHandshake(Byte[], Boolean)
at System.Data.SqlClient.TdsParser.Connect(System.Data.SqlClient.ServerInfo, System.Data.SqlClient.SqlInternalConnectionTds, Boolean, Int64, Boolean, Boolean, Boolean, Boolean, Boolean, System.Data.SqlClient.SqlAuthenticationMethod, Boolean, System.Data.SqlClient.SqlAuthenticationProviderManager)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(System.Data.SqlClient.ServerInfo, System.String, System.Security.SecureString, Boolean, System.Data.ProviderBase.TimeoutTimer, Boolean, Boolean, Boolean)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(System.Data.SqlClient.ServerInfo, System.String, System.Security.SecureString, Boolean, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SqlCredential, System.Data.ProviderBase.TimeoutTimer)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(System.Data.ProviderBase.TimeoutTimer, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SqlCredential, System.String, System.Security.SecureString, Boolean)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(System.Data.ProviderBase.DbConnectionPoolIdentity, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SqlCredential, System.Object, System.String, System.Security.SecureString, Boolean, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SessionData, System.Data.ProviderBase.DbConnectionPool, System.String, Boolean, System.Data.SqlClient.SqlAuthenticationProviderManager)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(System.Data.Common.DbConnectionOptions, System.Data.Common.DbConnectionPoolKey, System.Object, System.Data.ProviderBase.DbConnectionPool, System.Data.Common.DbConnection, System.Data.Common.DbConnectionOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(System.Data.ProviderBase.DbConnectionPool, System.Data.Common.DbConnection, System.Data.Common.DbConnectionOptions, System.Data.Common.DbConnectionPoolKey, System.Data.Common.DbConnectionOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(System.Data.Common.DbConnection, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(System.Data.Common.DbConnection, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(System.Data.Common.DbConnection, UInt32, Boolean, Boolean, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal ByRef)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(System.Data.Common.DbConnection, System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal ByRef)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(System.Data.Common.DbConnection, System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal, System.Data.ProviderBase.DbConnectionInternal ByRef)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory, System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>)
at System.Data.SqlClient.SqlConnection.TryOpen(System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>)
at System.Data.SqlClient.SqlConnection.Open()
at PrlSystems.ProductUpdateLibrary.Schema.Drivers.MsSql.SqlServerDataLayerDriver.OpenConnection(System.String)
at PrlSystems.ProductUpdateLibrary.Schema.DataLayerUpdater.TestConnection(PrlSystems.ProductUpdateLibrary.Schema.DataLayerSettings, System.String ByRef)
at PrlSystems.UpdateCenter.Forms.Wizard.DatabaseConnectionForm.ctlTestDatabaseConnectionWorker_DoWork(System.Object, System.ComponentModel.DoWorkEventArgs)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(System.Object)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr, System.Object[], System.Object, System.Object[] ByRef)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessageSink)
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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
The line that's causing this exception is:
connection.Open();
So I decided to attach remotely and debug the application to see what connection string is used (which was perfectly legal connection string). Next, I wrote a quick and dirty console app which creates a SQL connection with the same connection string/using same SQL connection object and ran it on the same server and it works.
The only differences between the console app and the app that's crashing are:
The crashing app is a winforms app vs console app
The crashing app executes the connection a worker thread (using background worker)
I am lost of words what's causing this exception and I can't even reproduce this with my console app.
Any help would be appreciated.
===================== UPDATE 1 (Results of Testing) =====================
I did create another winforms app, and ran the code that does the connection for SQL server and it works fine, ... then I did #2
I edited Program.cs of the app that's crashing and added the following few lines
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// connection that causes access violation exception
var conn = new SqlConnection();
conn.ConnectionString = #"Server=.\sqlexpress;Connection Timeout=5;Integrated Security=True";
conn.Open(); // <= Will get exception after this line executes!
conn.Close();
}
When the app runs, I still get the access violation exception. This appears like this program is cursed or black listed!
===================== UPDATE 2 (Results of Testing) =====================
All, I have stripped down the entire app to only Program.cs file with just the few lines for connecting to database in Main() function (and referenced only just the few standard assemblies). Still, when the app runs I see the same exception.
Then I re-compiled it to .net 2, 3.5 and it worked!
The minute I switch to .net 4 or later the exception is back. You would think something is installed incorrectly on the server but then why the other .net 4 apps work running the exact same code?
All,
I found the root cause of the problem:
For any app targeting .net 4.5 and up there's a setting in VS under Build/Platform target:
"Prefer 32 bit"
By default when you create the app, it is checked. Our application had this setting unchecked causing access violation exception on our server. Checking that setting resolved the problem.
Although, I resolved the issue... it worries me what if I needed to build the app using this target framework:
.net 4.5 > my app >= .net 4.0
Since this setting is disabled for anything below .net 4.5 I could never get around this problem unless I try to fix my server and determine what is missing or is not correctly installed from software perspective. It is this box only because we ran our software on other servers/workstations and it worked fine.

Application is not getting opened after installing it with the installer created by "Visual studio installer"

I have created setup file using visual studio 2017. When I installed it in my system it was installed properly and worked properly. But I am trying to install in some other system than set up gets installed properly but when user tries to open it then it does not opened.
When I checked it in event viewer it gives following error.
I got following error in event viewer(.Net runtime)
Application: FaultyStatus.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException at System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean) at System.Reflection.RuntimeAssembly.nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean) at System.Reflection.RuntimeAssembly.InternalLoad(System.String, System.Security.Policy.Evidence, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean) at System.Reflection.RuntimeAssembly.InternalLoad(System.String, System.Security.Policy.Evidence, System.Threading.StackCrawlMark ByRef, Boolean) at System.Reflection.Assembly.Load(System.String) at DevExpress.Utils.AssemblyHelper.GetAssembly(System.String) at DevExpress.Xpf.Core.Theme.GetAssembly() at DevExpress.Xpf.Core.Theme.get_Assembly() at DevExpress.Xpf.Core.ThemedElementsDictionary.GetThemeAssembly(System.String) at DevExpress.Xpf.Core.ThemedElementsDictionary.ForceThemeKeysLoading(System.String) at DevExpress.Xpf.Core.ThemeManager.ChangeTheme(System.Windows.DependencyObject, System.String, Boolean, Boolean, System.String) at DevExpress.Xpf.Core.ThemeManager.ThemeNamePropertyChanged(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs) at System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs) at System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs) at System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs) at System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Windows.OperationType) at System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, System.Object, System.Windows.PropertyMetadata, Boolean, Boolean, System.Windows.OperationType, Boolean) at System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty, System.Object) at DevExpress.Xpf.Core.DXMessageBox.ShowCore(DevExpress.Xpf.Core.DXMessageBoxCreator, System.Windows.FrameworkElement, System.String, System.String, System.Windows.MessageBoxButton, System.Windows.MessageBoxImage, System.Windows.MessageBoxResult, System.Windows.MessageBoxOptions, DevExpress.Xpf.Core.FloatingMode, Boolean, Double) at DevExpress.Xpf.Core.DXMessageBox.Show(System.String) at FaultyStatus.MainWindow..ctor() Exception Info: System.Windows.Markup.XamlParseException 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.LoadBamlStreamWithSyncInfo(System.IO.Stream, System.Windows.Markup.ParserContext) at System.Windows.Application.LoadComponent(System.Uri, Boolean) at System.Windows.Application.DoStartup() at System.Windows.Application.<.ctor>b__1_0(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.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) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) at System.Windows.Application.RunDispatcher(System.Object) at System.Windows.Application.RunInternal(System.Windows.Window) at System.Windows.Application.Run(System.Windows.Window) at System.Windows.Application.Run() at FaultyStatus.App.Main()
Log Name: Application
Source: Application Error
Date: 4/04/2019 6:25:57 AM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
Description:
Faulting application name: FaultyStatus.exe, version: 1.0.0.0, time stamp: 0x5ca3b1ee
Faulting module name: KERNELBASE.dll, version: 10.0.17134.556, time stamp: 0xadca2670
Exception code: 0xe0434352
Fault offset: 0x001118a2
Faulting process id: 0x1ea8
Faulting application start time: 0x01d4ea424abf8640
Faulting application path: C:\Program Files (x86)\Vesta\FaultyProduct\FaultyStatus.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: d303086d-4bbf-4497-9c98-a71963842a88
Faulting package full name:
Faulting package-relative application ID:
Event Xml:
1000
2
100
0x80000000000000
16288
Application
LAPTOP-GIILLVJT
FaultyStatus.exe
1.0.0.0
5ca3b1ee
KERNELBASE.dll
10.0.17134.556
adca2670
e0434352
001118a2
1ea8
01d4ea424abf8640
C:\Program Files (x86)\Vesta\FaultyProduct\FaultyStatus.exe
C:\WINDOWS\System32\KERNELBASE.dll
d303086d-4bbf-4497-9c98-a71963842a88
I resolved issue by looking the error log in Event viewer log file with the extension .Net Runtime. issue was some of the dev express supporitng file were missing. Need to deploy all Dls using devexpress deploy tool.
UPDATE: just some pointers:
Please be aware of several limitations of Visual Studio Installer Projects.
Maybe consider alternative tools.
And a link to show the prerequisites view of VS Installer Projects.
Very common query that comes up all the time. Usually a lacking runtime or you have a bad configuration setting somewhere in your configuration files or registry settings. Here is one comment of late on similar issues.
Please check for the above mention issues first, then maybe have a look at the below checklists (linked, and some inlined keywords). Verify very basic runtime requirements such as .NET runtime, Visual C++ Runtimes and Java runtime requirements and similar, simple and fundamental runtimes first of all.
Just to inline the gist of it from the linked comment above:
Debug common application launch problems (please do skim)
Older version of the check list
Tools for debugging (Visual Studio, ProcMon.exe (rudimentary sample), etc...).
Keywords: Missing Dependencies / Runtimes? (Java, .NET, etc...). Configuration Error? (pointing to UAT-server, etc...). Encoding? Licensing? Drivers? Bitness? Permissions? Privileges? Registry Registration? Authentication / Authorization? Lockdown? (security software, etc...)
Some Links:
Visual Studio 2017 Installer Project - include VC++ 2015 Redistributable
Additional Setup in Visual Studio Installer Projects

WPF applications running with debugger, but not without

So I have 3 WPF applications that are fully functional and run fine with the debugger in Visual Studio. However 2 of the three will not run at all without the debugger (aka the .exe does nothing). It doesn't crash or give me errors it just gives me a second of loading wheel and then nothing. I don't understand why it would work fine running with the debugger and not run at all when it is run without it. I have tried both the debug and release versions and it didn't make a difference. I have tried restarting both visual studio and my computer and cleaning and rebuilding the solution. I mention the application that works fine because it leads me to believe my visual studio is working fine. I'm using Visual Studio 2013.
I don't know what code snippets to show because I have no idea what could be causing the issue. If you would like to see certain functions/files let me know in the comments and I will add them to the post if I can.
Do you have any idea what could be causing this to happen and what steps I need to take to get my .exe files running the way the .vshost.exe runs with the debugger?
EDIT: The application is indeed throwing an error which I found in eventlogs. Though I am still unsure what is causing the error
This is the error:
Application: OrderFinderTool.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 SupportWizard.App.InitializeComponent()
at SupportWizard.App.Main()
EDIT 2:
My coworker ran the .exe and got a more verbose error message:
Application: OrderFinderTool.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
at System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
at System.Reflection.RuntimeAssembly.nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
at System.Reflection.Assembly.Load(System.Reflection.AssemblyName)
at System.Windows.Navigation.BaseUriHelper.GetLoadedAssembly(System.String, System.String, System.String)
at MS.Internal.AppModel.ResourceContainer.GetResourceManagerWrapper(System.Uri, System.String ByRef, Boolean ByRef)
at MS.Internal.AppModel.ResourceContainer.GetPartCore(System.Uri)
at System.IO.Packaging.Package.GetPartHelper(System.Uri)
at System.IO.Packaging.Package.GetPart(System.Uri)
at System.IO.Packaging.PackWebResponse+CachedResponse.GetResponseStream()
at System.IO.Packaging.PackWebResponse.GetResponseStream()
at System.IO.Packaging.PackWebResponse.get_ContentType()
at MS.Internal.WpfWebRequestHelper.GetContentType(System.Net.WebResponse)
at MS.Internal.WpfWebRequestHelper.GetResponseStream(System.Net.WebRequest, MS.Internal.ContentType ByRef)
at System.Windows.ResourceDictionary.set_Source(System.Uri)
at System.Windows.Baml2006.WpfSharedBamlSchemaContext+<>c.<Create_BamlProperty_ResourceDictionary_Source>b__342_0(System.Object, System.Object)
at System.Windows.Baml2006.WpfKnownMemberInvoker.SetValue(System.Object, System.Object)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(System.Xaml.XamlMember, System.Object, System.Object)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(System.Object, System.Xaml.XamlMember, System.Object)
Exception Info: System.Windows.Markup.XamlParseException
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 OrderFinderTool.App.InitializeComponent()
at OrderFinderTool.App.Main()
EDIT 3:
Thanks to help from user Jay T, I discovered that the aero assembly was being loaded when running with the debugger, but not without it since I am running on an windows 8 machine and they switched over to a new aero2 assembly. Removing the assembly and references to it allowed the .exe to run without crashing
To start to narrow down the cause of your issue, you could put in an application level exception handler and popup a MessageBox with the exception info or write it out to a file. In your App.xaml file add a handler for DispatcherUnhandledExceptption:
<Application x:Class="YourApp"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml"
DispatcherUnhandledException="Application_DispatcherUnhandledException">
</Application>
Then in App.xaml.cs you can handle the event and get access to the unhandled exception:
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
var exception = e.Exception;
}
In that function, you could show the exception message in a MessageBox, write it out and the stack trace to a text file using StreamWriter, etc. You won't have to run the application in Debug mode, so you'll be able to see what's causing the problem in that environment. Feel free to post the exception information if you need more help solving the problem.
In my case i referenced PresentationFramework.Aero . so to fix the error i made Copy Local true for PresentationFramework.Aero and PresentationFramework. it works after that.

visual studio 2013 crash on opening xsl

Every time I open a .xsl file with Visual Studio 2013 Update 4 it crashes. I get the error message below. Pretty useless. Any suggestions?
I am running VS in the administrator security context (run as). I do this so I can open and debug on my local IIS 7.5 (instead of the VS debugger / port).
I did install the Azure and SSDT extensions recently (VWDOrVs2013AzurePack.exe and SSDTSetup.exe). The latter failed to install correctly.
Error below. Thanks!
Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Security.SecurityException
Stack:
at System.Security.CodeAccessSecurityEngine.Check(System.Object, System.Threading.StackCrawlMark ByRef, Boolean)
at System.Security.CodeAccessSecurityEngine.Check(System.Security.CodeAccessPermission, System.Threading.StackCrawlMark ByRef)
at System.Security.CodeAccessPermission.Demand()
at System.Reflection.RuntimeAssembly.VerifyCodeBaseDiscovery(System.String)
at System.Reflection.RuntimeAssembly.GetName(Boolean)
at System.Reflection.Assembly.GetName()
at Microsoft.VisualStudio.Design.Toolbox.AutoToolboxManagerService.OnAssemblyLoadWorker(System.Reflection.Assembly)
at Microsoft.VisualStudio.Design.Toolbox.AutoToolboxManagerService+<>c__DisplayClass2.b__0()
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)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(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.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
Faulting application name: devenv.exe, version: 12.0.31101.0, time stamp: 0x54548724
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18839, time stamp: 0x553e88ab
Exception code: 0xe0434352
Fault offset: 0x0000c42d
Faulting process id: 0x2260
Faulting application start time: 0x01d09ec4b4de9874
Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe
Faulting module path: C:\Windows\syswow64\KERNELBASE.dll
Report Id: dc09e38b-0ab8-11e5-9e99-10bf48466a8d
I worked around this issue. I renamed the xsl extension to xml. I worked on the file. Then I would rename it back to xsl before testing. I did that for several weeks, maybe a month.
One day I accidentally opened the xsl file before renaming it. I thought, "oh no! Its going to crash", but it didn't and I haven't experienced the problem since.
If I had to guess, I'd say VS cached something bad. Overtime, my editing cleared the cache and everything was pink fluffy unicorns dancing on rainbows again.

.NET application cannot start and receive XamlParseException

I wrote an app that can install and work on my development PC (a Window 7).
Development Environment: Window 7, VS2010 WPF C# with both .NET 4 and .NET 3.5 installed
On other client computer (XP SP3, 2 and 1), it install with no error, but can not start. In task manager, I can see the application takes up memory briefly before closing by itself.
I had made sure .NET 3.5 consistency across my develop PC and various client XP machines by following:
The application targets .NET 3.5 (or 3.5 Client Profile)
Use VS2010 Installer for deployment: targets .NET 3.5 in Launch Condition
No error whatsoever about .NET compatibility during debug of application and installer project
eventvwr caught the following warning:
 ¬º˛¿‡–Õ: ¥ÌŒÛ
 ¬º˛¿¥‘¥: .NET Runtime
 ¬º˛÷÷¿‡: Œfi
 ¬º˛ ID: 1026
»’∆⁄: 2011-10-18
 ¬º˛: 15:18:32
”√ªß: N/A
º∆À„ª˙: WWW-9DB69D5A3AF
√Ë ˆ:
Application: Foo.exe
Framework Version: v4.0.30319
Description: ”…”⁄Œ¥æ≠¥¶¿Ìµƒ“Ï≥££¨Ω¯≥Ã÷’÷π°£
“Ï≥£–≈œ¢: System.Windows.Markup.XamlParseException
∂—’ª:
‘⁄ System.Windows.Markup.XamlReader.RewrapException(System.Exception, System.Xaml.IXamlLineInfo, System.Uri)
‘⁄ System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri)
‘⁄ System.Windows.Markup.WpfXamlLoader.LoadBaml(System.Xaml.XamlReader, Boolean, System.Object, System.Xaml.Permissions.XamlAccessLevel, System.Uri)
‘⁄ System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream, System.Windows.Markup.ParserContext, System.Object, Boolean)
‘⁄ System.Windows.Application.LoadBamlStreamWithSyncInfo(System.IO.Stream, System.Windows.Markup.ParserContext)
‘⁄ System.Windows.Application.LoadComponent(System.Uri, Boolean)
‘⁄ System.Windows.Application.DoStartup()
‘⁄ System.Windows.Application.<.ctor>b__1(System.Object)
‘⁄ System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
‘⁄ MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
‘⁄ System.Windows.Threading.DispatcherOperation.InvokeImpl()
‘⁄ System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
‘⁄ System.Threading.ExecutionContext.runTryCode(System.Object)
‘⁄ System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
‘⁄ System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
‘⁄ System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
‘⁄ System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
‘⁄ System.Windows.Threading.DispatcherOperation.Invoke()
‘⁄ System.Windows.Threading.Dispatcher.ProcessQueue()
‘⁄ System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
‘⁄ MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
‘⁄ MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
‘⁄ System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
‘⁄ MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
‘⁄ System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
‘⁄ MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
‘⁄ MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
‘⁄ System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
‘⁄ System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
‘⁄ System.Windows.Threading.Dispatcher.Run()
‘⁄ System.Windows.Application.RunDispatcher(System.Object)
‘⁄ System.Windows.Application.RunInternal(System.Windows.Window)
‘⁄ System.Windows.Application.Run(System.Windows.Window)
‘⁄ System.Windows.Application.Run()
‘⁄ FooSoftware.App.Main()
”–πÿ∏¸∂‡–≈œ¢£¨«Î≤Œ‘ƒ‘⁄ http://go.microsoft.com/fwlink/events.asp µƒ∞Ô÷˙∫Õ÷ß≥÷÷––ƒ°£
there was this XamlParseException causing my app to not start on XP Window Machine. What is going on?
XamlParseException is the generic error that happens when there is a problem at application start. I suggest you modify you application startup code to trace what's really going on and get, not only the XamlParseException, but also the inner exception(s) which should help you determine the root of the problem. Here is an example:
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
// hook on error before app really starts
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
base.OnStartup(e);
}
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
// put your tracing or logging code here (I put a message box as an example)
MessageBox.Show(e.ExceptionObject.ToString());
}
}
}
For starters, you'd actually have better luck if you built on VS2010 .. but actually targeted for a lower version of .Net (3.5, or even 2.0).
It would definitely be helpful if you post a bit of code.
Make sure you've copied all the necessary files for your application (app.config, etc).
This link sounds similar:
.NET 4 Program written/compiled on Windows 7 machine won't run on XP
And it points to these excellent troubleshooting tips:
Using Fusion Log Viewer
You can remote debug. Basically this is done by installing the remote debug server on the target machine, then attach to it from your visual studio when you start the application. Some more info can be found here : http://msdn.microsoft.com/en-us/library/bt727f1t.aspx
and there's a somewhat elderly tutorial here : http://www.cprogramming.com/tutorial/visual_studio_remote_debugging.html
Please note that you must deploy with debug symbols (pdbs) and the software debugged must be in the same version that your code is in.
Although you were targetting .NET 3.5 your client hat .NET 4 installed and used it. The string
Framework Version: v4.0.30319
does tell me this.
To force your client to actually use .NET 3.5 you should add an App.config to your application and add:
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
It could be that you are getting an exception because .NET 4 treats your XAML in a different way. Did you try to let your application run under .NET 4? If you have no App.config supplied you did test your application with .NET Framework 4 anyway although you did target .NET Framework 3.5.
If your client is nice enough you can let him create a dump file so you have an easy way to debug it directly.
Download Procdump from the SysInternals tool suite and send it along with your application to your client. The let him execute
procdump -ma -e -t -x foo.exe %temp%\dump.dmp
This will generate a full process dump for every unhandled exception and another one when the process terminates into the %TEMP% directory. Visual Studio 2010 has gotten much better dump analysis support so you should be able to analyze it within Visual Studio 2010.
If that does not help you can download Windbg (32 bit here), load the dump and type
!analyze -v
to see what the last exception was. That should do the trick. There may be issues with the managed extensions to load the right debugging dll (sos.dll for .NET 2,3,3.5, and clr.dll for .NET 4) but there are plenty of tutorials online how to do it. Besides this I would recommend to add exception handlers into your application so you get a nice log file when your application does terminate in an unexpected way.
If the output did not lead to the right stack you shold use
!ClrStack
and
!Threads
to find out which threads have exceptions on their stack.
Usually what I do is put log files in between processes so I know the flow of my program.
If this is a console application, put Console.WriteLine(some string) and then you can put Console.ReadLine() at the end to pause the execution of your program.
Came across a similar problem recently. The problem I had is on windows 7, I was using .ico (icon files). But there is no support for these on XP. In your application, if you are using any icon files, try removing them.. see if this solves the issuse.
Start commenting out lines of code and entire classes/methods from your code until you get it working (Or start by commenting out everything). Then slowly start introducing lines of code and method calls etc. Until it breaks. This should give you an idea of any particular code/class or reference that is causing the problem. This is admittedly a tedious method, but at the same time, fairly mechanical and within an hour or so you should have a fairly good idea of culprit.
I heard that some commented codes affected on execute output file to behavior something like that happened for your app.(specially in VS 2010 not other earlier version)
but in other side,last year i was working on a program that in it i used the Dev Component suite. as you know its crack just work in .Net Framework 3.5 and my program platform was .Net Framework 4.same thing happen for your app, happened fro my app.i had to downgrade my platform to 3.5 and its work good.maybe this personal experience help you dude.
i want to say some thing else,this some errors are not depend on CPU architecture.Dot worry about it.
good luck. Ali Foroughi
The "TryCathcWhen"-related line makes me think about some unhandled exception on startup, or an exception is being thrown in a catch block on startup.
Seeing your startup code would be helpful.
I've seen this happen on machines where the installation of .NET 3.5/4 had failed/not successfully completed. However, this is also highly unlikely.
You should try to install remote debugging on the machine (fairly easy process) and then setting the remote machine as the target in Visual Studio, run the program in debug mode. The program will then launch on the remote machine and you will get the full error within Visual Studio.
I had a .Net 2.0 app that worked with debugging on But not in a release build(after install).
I wasn't getting any logging from my Application directly, my Errors came straight from .NET. The issue was I had created my Own Program class with a static void MAIN() inside the main I had a try...catch..finally block. For some reason .NET was choking on the finally. Do you have anything like that in your program?
This is really a generic error. In my case freshly installed application failed to create its own event source due to insufficient permissions. Resolved (ugly one) by running the app one time in "as admin" mode. Make sure that all inner exceptions are handled. Events is also a good source of information.
In my case, the problem solved when the user installed the same .Net FW version that I was developing for. (I has FW 4.5.1 and user had FW 4.0).
So, check the FW version:
http://msdn.microsoft.com/library/hh925568(v=vs.110).aspx
And install exactly the same before trying again to execute
Please note that I had a similar exception:
Application: Foo.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
at CommonServiceLocator.ServiceLocator.get_Current()
at Prism.Regions.RegionManager.CreateRegion(System.Windows.DependencyObject)
at Prism.Regions.RegionManager.OnSetRegionNameCallback(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)
at System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Windows.OperationType)
at System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, System.Object, System.Windows.PropertyMetadata, Boolean, Boolean, System.Windows.OperationType, Boolean)
at System.Windows.Baml2006.WpfMemberInvoker.SetValue(System.Object, System.Object)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(System.Xaml.XamlMember, System.Object, System.Object)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(System.Object, System.Xaml.XamlMember, System.Object)
Exception Info: System.Windows.Markup.XamlParseException
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.LoadBamlStreamWithSyncInfo(System.IO.Stream, System.Windows.Markup.ParserContext)
at System.Windows.Application.LoadComponent(System.Uri, Boolean)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__1_0(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.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 MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(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 MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, 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)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at System.Windows.Application.Run(System.Windows.Window)
at System.Windows.Application.Run()
at Foo.App.Main()
The key part in my case above was the CommonServiceLocator.ServiceLocator.get_Current(). My application did not use ServiceLocator anywhere; however, it appears that it was being used by a NuGet package I had installed.
I solved the problem by performing this in the NuGet Package Manage console for my main app project:
PM> Install-Package CommonServiceLocator -Version 2.0.5

Categories

Resources