YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Tag as favorite
Crash at startup : Error in markup file "MainWindow.xaml"
styx31 Offline
#1 Posted : Tuesday, January 06, 2009 4:08:34 AM

Rank: Newbie

Posts: 4

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Exception message :

Code:
Cannot create instance of 'MainWindow' defined in assembly 'code2plan, Version=1.0.1.578, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation.  Error in markup file 'MainWindow.xaml'.


StackTrace :
Code:
   at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)    at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)    at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)    at System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object& element, ReaderFlags& flags, Type& delayCreatedType, Int16& delayCreatedTypeId)    at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)    at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)    at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)    at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)    at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()    at System.Windows.Markup.TreeBuilder.Parse()    at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)    at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)    at System.Windows.Application.DoStartup()    at System.Windows.Application.<.ctor>b__0(Object unused)    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)    at System.Windows.Threading.DispatcherOperation.InvokeImpl()    at System.Threading.ExecutionContext.runTryCode(Object userData)    at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)    at System.Windows.Threading.DispatcherOperation.Invoke()    at System.Windows.Threading.Dispatcher.ProcessQueue()    at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)    at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)    at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)    at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)    at System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg)    at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)    at System.Windows.Application.RunInternal(Window window)    at code2plan.App.Main()


I could not find any additional relevant information...

My Configuration : VS 2008 SP1, .NET 3.5 SP1, Windows Server 2008 Std x64.
styx31 Offline
#2 Posted : Tuesday, January 06, 2009 4:22:55 AM

Rank: Newbie

Posts: 4

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Ok, I've installed the VS Addin version, and now the standalone run without crashes...
styx31 Offline
#3 Posted : Tuesday, January 06, 2009 4:28:37 AM

Rank: Newbie

Posts: 4

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
And now the standalone application crashes after login :

Message : "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

StackTrace :
Code:
   at System.Data.SqlServerCe.NativeMethods.DllAddRef()    at System.Data.SqlServerCe.SqlCeConnection..ctor()    at System.Data.SqlServerCe.SqlCeProviderFactory.CreateConnection()    at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Initialize(IDataServices dataServices, Object connection)    at System.Data.Linq.DataContext.Init(Object connection, MappingSource mapping)    at code2plan.DomainModel.DataModel..ctor(String connection)    at code2plan.DomainModel.QuerySourceConnection.Connect()    at code2plan.DomainModel.QuerySourceConnection.get_DataContext()    at code2plan.DomainModel.QuerySourceConnection.GetQuerySource[T]()    at IQuerySourceConnectionProxy.GetQuerySource[T]()    at code2plan.DomainModel.Registrar.<RegisterServices>b__6()


I think it's a problem related to my x64 os. He certainly tries to load a 32bit format dll. I'll try to fix PE Flags to force +32BIT. (corflags) and I'll report my progress.

Edit : I've watched flags with corflags, and the app is compiled with "Any CPU" flag. I've forced "x86" with "corflags code2plan.exe /32BIT+" and the application starts successfully. FYI, set the Compilation Mode of the .exe project to "x86" instead of "Any CPU" if one of your library references a 32bit dll.
jesse Offline
#4 Posted : Tuesday, January 06, 2009 10:09:10 AM

Rank: Administration

Posts: 69

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Thanks for the great detail! We have only one x64 tester here locally, and hadn't been able to get it running on 64-bit yet.

I'll try your steps and see if I can rebuild it to work for x64 later this week (we typically do weekly iterations, so look for an update Sunday night).

Cheers,
Jesse
Users browsing this topic
Guest
Tag as favorite
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.