WPF problem

Mar 25, 2010 at 2:43 PM

Hello Radioman,

Right now, I have a problem with inserting the GMap in the WPF. It says that is build successfully but then it shows this window "Application has stopped working" and when I try the demo, it gives me the same error and then closes.

Here is the output:

 

Build project: Google Maps.sln, Targets: Build__________________________________________________Project "C:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps.sln" (Build target(s)):__________________________________________________Project "C:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps.sln" is building "C:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps\Google Maps.csproj" (default targets):C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"..\..\..\..\..\..\Desktop\Graduation Project\wpf\GMap.NET.Core.dll" /reference:"..\..\..\..\..\..\Desktop\Graduation Project\wpf\GMap.NET.WindowsPresentation.dll" /reference:"C:\Program Files (x86)\MySQL\MySQL Connector Net 6.1.3\Assemblies\MySql.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\PresentationCore.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll" /reference:"c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:"..\..\..\..\..\..\Desktop\Graduation Project\project_vs\mapping2\System.Data.SQLite.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\WindowsFormsIntegration.dll" /debug+ /debug:full /filealign:512 /optimize- /out:"obj\Debug\Google Maps.exe" /resource:"obj\Debug\Google Maps.g.resources" /target:winexe /win32icon:Application.ico App.xaml.cs Properties\AssemblyInfo.cs MainWindow.xaml.cs "C:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps\obj\Debug\MainWindow.g.cs" "C:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps\obj\Debug\App.g.cs"Google Maps -> C:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps\bin\Debug\Google Maps.exeThe build has successfully completed.Unhandled Exception: System.Windows.Markup.XamlParseException:  Could not load file or assembly 'GMap.NET.WindowsPresentation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b85b9027b614afef' or one of its dependencies. An attempt was made to load a program with an incorrect format.  Error in markup file 'Google Maps;component/mainwindow.xaml' Line 2 Position 2. ---> System.BadImageFormatException: Could not load file or assembly 'GMap.NET.WindowsPresentation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b85b9027b614afef' or one of its dependencies. An attempt was made to load a program with an incorrect format.File name: 'GMap.NET.WindowsPresentation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b85b9027b614afef'   at Google_Maps.MainWindow.System.Windows.Markup.IComponentConnector.Connect(Int32 connectionId, Object target)   at System.Windows.Markup.BamlRecordReader.ElementInitialize(Object element, String name)   at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)   at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)   at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)WRN: Assembly binding logging is turned OFF.To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.Note: There is some performance penalty associated with assembly bind failure logging.To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].   --- End of inner exception stack trace ---   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 Google_Maps.App.Main() in c:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps\obj\Debug\App.g.cs:line 0
Build project: Google Maps.sln, Targets: Build

__________________________________________________

Project "C:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps.sln" (Build target(s)):

__________________________________________________

Project "C:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps.sln" is building "C:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps\Google Maps.csproj" (default targets):



C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"..\..\..\..\..\..\Desktop\Graduation Project\wpf\GMap.NET.Core.dll" /reference:"..\..\..\..\..\..\Desktop\Graduation Project\wpf\GMap.NET.WindowsPresentation.dll" /reference:"C:\Program Files (x86)\MySQL\MySQL Connector Net 6.1.3\Assemblies\MySql.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\PresentationCore.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll" /reference:"c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:"..\..\..\..\..\..\Desktop\Graduation Project\project_vs\mapping2\System.Data.SQLite.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\WindowsFormsIntegration.dll" /debug+ /debug:full /filealign:512 /optimize- /out:"obj\Debug\Google Maps.exe" /resource:"obj\Debug\Google Maps.g.resources" /target:winexe /win32icon:Application.ico App.xaml.cs Properties\AssemblyInfo.cs MainWindow.xaml.cs "C:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps\obj\Debug\MainWindow.g.cs" "C:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps\obj\Debug\App.g.cs"

Google Maps -> C:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps\bin\Debug\Google Maps.exe

The build has successfully completed.

Unhandled Exception: System.Windows.Markup.XamlParseException:  Could not load file or assembly 'GMap.NET.WindowsPresentation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b85b9027b614afef' or one of its dependencies. An attempt was made to load a program with an incorrect format.  Error in markup file 'Google Maps;component/mainwindow.xaml' Line 2 Position 2. ---> System.BadImageFormatException: Could not load file or assembly 'GMap.NET.WindowsPresentation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b85b9027b614afef' or one of its dependencies. An attempt was made to load a program with an incorrect format.

File name: 'GMap.NET.WindowsPresentation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b85b9027b614afef'

   at Google_Maps.MainWindow.System.Windows.Markup.IComponentConnector.Connect(Int32 connectionId, Object target)

   at System.Windows.Markup.BamlRecordReader.ElementInitialize(Object element, String name)

   at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)

   at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)

   at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)

WRN: Assembly binding logging is turned OFF.

To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

Note: There is some performance penalty associated with assembly bind failure logging.

To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

   --- End of inner exception stack trace ---

   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 Google_Maps.App.Main() in c:\Users\Khaled Raed\Documents\Expression\Blend 3\Projects\Google Maps\Google Maps\obj\Debug\App.g.cs:line 0


so what should I do??

 

 

Coordinator
Mar 25, 2010 at 6:39 PM

o.O very strange, how did you achieved this?

Mar 25, 2010 at 7:42 PM

Do you have any clue or not?? Because this very urgent...

Coordinator
Mar 25, 2010 at 7:49 PM

i'm asking you, how do you do it? The solution depends on your answers ;}

Mar 25, 2010 at 8:01 PM

well, I just add the GMap.NET.Core, GMap.NET.WindowsPresentation and then add the GMap.WindowsPresentation Control. There I get two new items that I can choose from (GMapControlNew and GMapControl).

When I choose one of them to add it gives me this error. Also note the demo program that you have made also give me an error!! (I am running on 64-bit)

In, the end sorry, I didn't understand you by say how did I achieve it.

Coordinator
Mar 25, 2010 at 8:17 PM
Edited Mar 25, 2010 at 8:18 PM

so set target to x86, or change sqlite reference to x64 bits, check http://greatmaps.codeplex.com/Thread/View.aspx?ThreadId=207238

p.s. GMapControlNew is just for testing

Mar 25, 2010 at 8:25 PM

Thanks a lot Radioman, I did set the processor to x86 and it works super thanks big time!! I owe you one :D

Coordinator
Mar 25, 2010 at 8:32 PM

Engage! ;}