WPF Map Control Throws NullReferenceException

This is a weird problem.  The exception only happens if I have a break point in my project that is hit before the project is fully loaded (before the window appears on the screen).  Not every break point causes the exception.  I have not been
able to pinpoint what particular break points do and do not cause it.  I think it might be break points that are hit before some event happens on the UserControl that is hosting the map control but if that is the case I am not sure what event that might
be.  If you remove the break point the application works fine.  Break points that are hit later in the application do not cause a problem.
Here is a copy of the exception:
System.NullReferenceException was unhandled
  HResult=-2147467261
  Message=Object reference not set to an instance of an object.
  Source=Microsoft.Maps.MapControl.WPF
  StackTrace:
       at Microsoft.Maps.MapControl.WPF.MapCore.AnimateViewUsingZoomAndPan(Double zoomLevel, Point centerNormalizedMercator)
       at Microsoft.Maps.MapControl.WPF.MapCore.SetViewInternal(Point centerNormalizedMercator, Double zoomLevel, Double heading)
       at Microsoft.Maps.MapControl.WPF.MapCore.SetView(LocationRect boundingRectangle)
       at GeoservicesControls.Views.GeofencingView.<>c__DisplayClass8.<ViewModelChangedCallback>b__0(LocationRect x) in d:\SoftwareDevelopment\AccessibleSolutions\GeoservicesControl\Source\GeoservicesControls\Views\GeofencingView.xaml.cs:line
121
       at System.Reactive.AnonymousSafeObserver`1.OnNext(T value)
       at System.Reactive.Concurrency.ObserveOn`1.ObserveOnSink.OnNextPosted(Object value)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       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, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       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.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run()
       at GeoservicesControl.Shell.Wpf.App.Main() in d:\SoftwareDevelopment\AccessibleSolutions\GeoservicesControl\Source\GeoservicesControl.Shell.Wpf\obj\Debug\App.g.cs:line 50
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

The error message indicates that the error was thrown from the GeofencingView.xaml.cs file around line 121. Can you provide the code that you have in that area and the values being used.
http://rbrundritt.wordpress.com

Similar Messages

  • Can I use the new Bing Maps control released in Feb 2015 in my windows store app?

    Can I use the new Bing Maps control released in Feb 2015 in my windows store app?  If not, will there be a release of the store app version that has all or most of the updates that are in the new map control for WPF/Silverlight?

    The FEB 2015 release was for the WPF map control which is for desktop only. There is an existing Bing Maps SDK for Windows Store apps which has a lot more functionality than the WPF map control already. You can find this SDK here:
    https://visualstudiogallery.msdn.microsoft.com/224eb93a-ebc4-46ba-9be7-90ee777ad9e1
    You can find documentation this SDK here:
    https://msdn.microsoft.com/en-us/library/hh846481.aspx
    Also, I have written a free ebook on this SDK here:
    https://rbrundritt.wordpress.com/my-book/
    You can also find lots of code samples here:
    https://code.msdn.microsoft.com/site/search?f%5B0%5D.Type=Topic&f%5B0%5D.Value=Bing%20Maps&f%5B1%5D.Type=Platform&f%5B1%5D.Value=Windows%20RT&f%5B1%5D.Text=Windows%20Store%20apps
    You can also find a bunch of blog posts on this control on the Bing Maps blog. Here is a filtered list of blogs for Windows Store Apps:
    http://blogs.bing.com/maps/tag/windows-store-app/
    http://rbrundritt.wordpress.com

  • Street numbers in WPF Bing map control

    Hello.
    I have a problem with map control. I can`t find information about how to display street (building) numbers like in Bing maps on the off site (
    http://bing.com/maps)
    Can you help me?

    The Bing Maps consumer site (bing.com/maps) has a number of features which are not available in the development API yet. A lot of newer features get testd on the consumer site before being rolled out to the API. If you monitor the traffic from the consumer
    site you will notice that it is calling a completely different tile set than the API's. At the moment street numbers are not in the API, but they may be in a future release.
    http://rbrundritt.wordpress.com

  • WPF report viewer throws exception when print button clicked when hosted on winform

    When hosted in a winform app the wpf report viewer control throws an exception when the print button is clicked.
    All the other buttons appear to work, any ideas on a work round?
    I have created a sample VS 2013 solution that shows this issue
    As I can't even attach a renamed zip file it can be downloaded directly from here: http://1drv.ms/QxUrZo
    The reason I am attempting to use this control is that the standard reportviewer causes occasional errors in citrix enviroments causing the citrix session to lock up.  This appears to be a relatively common issue and the usual issue of both sides (citrix & crystal) blaming the other for the cause and me the developer needs to find a work round.
    I've 'bodged' in an additional button on our app to export a loaded report to file as pdf then print it but this should not be the permanent resolution.
    BTW glad to see the x64 dynamic parameter issue has been fixed at last, think I reported this over two years ago and again ended up having to work round it.

    Hi Ludek
    A sample project that loads a simple report is available from here: http://1drv.ms/QxUrZo
    The project is called WPFReportHost
    This loads a simple report when run then you can test the basic functionality of the viewer and all will work until you press the print button and then you get the application crash.
    Have to improve my search technique when I googled for other people having this issue I didnt' find the link.
    We've noticed the WPF viewer loads considerably faster and has better functionality than the winform viewer and hope that it might solve the citrix preview issue (yet to be tested).
    So as a work round we've hidden the default print button added our own and call the report print directly as per below:
    using (PrintDialog dialog = new PrintDialog())           
         dialog.AllowCurrentPage = true;
         dialog.AllowSelection = true;    
         dialog.AllowSomePages = true;
         dialog.AllowPrintToFile = true;
         if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)                     {
              reportDocument.PrintToPrinter(                         
                   dialog.PrinterSettings,                         
                   new System.Drawing.Printing.PageSettings(dialog.PrinterSettings);
                    false);                   
    Would be nice to have a fix

  • WP8 Map control with custom tiles

    I'm trying to display a map control in my app targeting Windows Phone 8 but I want to use custom tiles from open street map.
    I'm using this line :
    mapControl.TileSources.Add(new TileSource("http://a.tile.openstreetmap.org/{zoomLevel}/{x}/{y}.png"));
    When I launch the app the custom tiles are properly displayed, but there's still the default map tiles underneath them.
    I tried to hide them, but I counld'nt even find where they exist in the map control and what is displaying them exactly.
    I would like to know how I can remove those default tiles when loading custom tiles.
    I tried to hide them, but I counld'nt even find where they exist in the map control and what is displaying them exactly.

    Hi MakanWG,
    You have solved your question in here:
    http://stackoverflow.com/questions/27948331/wp8-map-control-with-custom-tiles .
    Good!
    Vote if help you

  • Not able to clear session of web application running inside wpf browser control

    Hi,
    I have used below code to clear session of web application running inside wpf browser control .   
    [DllImport("wininet.dll", SetLastError = true)]
       private static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength);
     InternetSetOption(IntPtr.Zero, INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0);
    This code is working in Windows 8 but it is not working in windows 7 and windows 8.1.
    I want to know why it is not working and how to make it work in windows 7 and windows 8.1
    Please help.
    Thanks & Regards,
    Pritesh

    Hi,
    I have used below code to clear session of web application running inside wpf browser control .   
    [DllImport("wininet.dll", SetLastError = true)]
       private static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength);
    InternetSetOption(IntPtr.Zero, INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0);
    This code is working in Windows 8 but it is not working in windows 7 and windows 8.1.
    I want to know why it is not working and how to make it work in windows 7 and windows 8.1
    Please help.
    Thanks & Regards,
    Pritesh

  • Map Control Problem

    Hello all,
    I'm working on a project where maps in windows 8 store app is involved. Here's what happens with me:
    on app start after the main page is loaded I add a map control. After that I get some data from a server using HTTPClient and put the retrieved data in a list. Then I project the list data on the map as markers.
    The thing that happens is that I'm setting the zoom level & the map center values when doing so but, the map doesn't zoom or center as needed. I think that this operation is interrupted resulting to this unwanted behavior. So, any idea ??
    Thanks in advance

    Hi Motasim,
    Which map control are you using, Bing map or some third party map controls? If you are using Bing maps I can help move to the correct forum for you otherwise you probably need ask at the map forum for a better support :)
    Thanks for your understanding,
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Mapping Control record?

    Hi all,
    iam doing File to idoc Senario and i need to map control record,How to map the control record.
    regards,
    phani

    Hi Venkatraman,
    if you want to control sender (and receiver) of an IDoc message by mapping, check "Take sender from payload" (and "Take receiver from payload") on. Map the fields of EDI_DC40:
    for the sender:
    SNDPRN (Sender Partner Name)
    SNDPRT (Sender Partner Type)
    and the receiver:
    RCVPRN (Receiver Partner Name)
    RCVPRT  (Receiver Partner Type)
    RCVPOR (Receiver Port)
    <a href="http://help.sap.com/saphelp_nw70/helpdata/en/96/791c42375d5033e10000000a155106/frameset.htm">Configuring the Receiver IDoc Adapter</a>
    Regards,
    Udo

  • How to copy FDM setting (import format, dimension mapping, control table)

    Dear All,
    How to copy FDM setting (import format, dimension mapping, control table) from application to another application.
    I found that only dimension mapping can be imported. Is there any way to copy FDM application quickly?
    Thanks your help

    If you get a chance try the following script, it's so simple and easy to extract all the map data to XML and will help in to import back through Import script.
    Sub MapExtractor()
    'UpStream WebLink Custom Script:
    'Created By:      SatyaK
    'Date Created:      12/08/09
    'Purpose: This Script will produce a Account Map File for
    '                         the current location.
    'Execute the export
    strFilePath = API.IntBlockMgr.InterfaceMgr.fExportMapToXML("File Path", PPOVPeriod)
    End Sub
    -------------

  • WPF Crystal report throws an exception when user tries to replace a file which is open during export of report.

    I am using the latest version of crystal report CRforVS_13_0_10 with Visual Studio 2013.
    I am working a WPF application and using the WPF crystalreportviewer control.
    The steps to reproduce the exception is ,
    1) Create a report.
    2) Export report with sample.xls  as file name
    3) Now open the sample.xls file in Excel
    4) Again export the report with sample.xls  as file name
    5) There is dialog which asks "Do you want to replace existing file sample.xls"
    6)Click "Yes"
    7) Now the exception will be thrown.
    This is System.IO.IOException which is thrown by crystal report  when user tries to save the file which is already opened by user. Also there is no event provided to handle Export_click for WPF CrystalReportViewer where I can handle this.

    I can replicate the issue. Not sure how we can hook into the System.IO process to capture the exception. I have not played with that part yet...
    I created my own export button and wrapped it in a try/catch and this is what I get:
    Which is what you would expect rather than a Null Exception error:
    We'll have to do more testing to see how or if System IO errors can caught outside of CR.
    Don

  • Design a WPF Tab control similar to the Wpf Ribbon

    Hi,
      I have a requirement to show the list of tools similar to that of a Microsoft word's Ribbon, but then i find some limitations in the Wpf Ribbon i..e it can not be completely customised, for example- The Ribbon tab header's height has to be increased
    when selected as shown in the figure, but I couldn't  find any relevant solution to accomplish it, so I have decided to use the native Tab Control and make it look like a Ribbon bar as suggested by  Andy
    ONeill  
    Expected Ribbon Tab header Style(Done using native Tab Control)
       But the issue here is I'm not able to handle the resize behaviour of the Wpf tab control.. when the tab control is resized it has to arrange all the elements in the same way that the ribbon bar does
    on  Dynamic Resizing.. 
    can you help me building a Tab control with this feature...
    Thanks,
    Sai Kiran Reddy

    Thanks for your valuable reply Mr. Andy ONeill can you please tell me how to mimic the Dynamic
    Resizing behaviour of Ribbon bar using the WPF Tab Control.. 
    There is an awful lot of functionality in a ribbon.
    And it's pretty tricky to use.
    Personally, I usually go with a tabcontrol and then add functionality I need from there.
    Often two tabitems with horizontally arranged listviews are sufficient.
    You can see that approach in use in my article:
    http://social.technet.microsoft.com/wiki/contents/articles/28209.wpf-entity-framework-mvvm-walk-through-1.aspx
    <TabControl HorizontalAlignment="Left" x:Name="CommandTab">
    <TabItem Header="Navigate" FontSize="10">
    <ListView ItemsSource="{Binding Views}" BorderBrush="Transparent" FontSize="12" FontWeight="Bold"
    ScrollViewer.CanContentScroll="False"
    >
    <ListView.ItemsPanel>
    <ItemsPanelTemplate>
    <StackPanel Orientation="Horizontal"></StackPanel>
    </ItemsPanelTemplate>
    </ListView.ItemsPanel>
    <ListView.ItemTemplate>
    <DataTemplate>
    <Button Command="{Binding Navigate}"
    BorderThickness="0" Height="32" Width="100"
    Background="{StaticResource LightBrightGradientBrush}"
    Foreground="{StaticResource DarkDullBrush}"
    >
    <TextBlock Text="{Binding ViewDisplay}"
    TextAlignment="Center"
    />
    </Button>
    </DataTemplate>
    </ListView.ItemTemplate>
    </ListView>
    </TabItem>
    <TabItem Header="Edit" x:Name="EditTabItem" FontSize="10">
    <ListView ItemsSource="{Binding Commands}" BorderBrush="Transparent" FontSize="12" FontWeight="Bold"
    ScrollViewer.CanContentScroll="False"
    >
    <ListView.ItemsPanel>
    <ItemsPanelTemplate>
    <StackPanel Orientation="Horizontal"/>
    </ItemsPanelTemplate>
    </ListView.ItemsPanel>
    <ListView.ItemTemplate>
    <DataTemplate>
    <Button Command="{Binding Send}"
    BorderThickness="0"
    Margin="0" Padding="0"
    >
    <Path Data="{Binding IconGeometry}" Stretch="Uniform"
    Style="{StaticResource PathOpacityStyle}"
    Fill="{StaticResource MidDullBrush}" Width="32" Height="32"/>
    <Button.ToolTip>
    <TextBlock Text="{Binding CommandDisplay}"/>
    </Button.ToolTip>
    </Button>
    </DataTemplate>
    </ListView.ItemTemplate>
    </ListView>
    </TabItem>
    </TabControl>
    By the way.
    I think if you really work at it you can customise the ribbon by re templating the thing.
    On one project I ran  that work and wrangling the riibbon generally turned out to pretty much eat up all the time of one of my guys though. 
    Hope that helps.
    Recent Technet articles:
    Property List Editing ;  
    Dynamic XAML

  • WPF Reader control

    Is there a WPF (Windows Presentation Foundation) control that i can use to display PDFs in my application, i read that Adobe ActiveX can't be legally used with other application than Internet Explorer.
    Greetings.

    if you are using .Net framework 3.5 + SP1, you can use the WPF WebBrowser control and set the pdf file as the url

  • ActiveX for Microsoft MAPI Control

    I want to use Microsoft MAPI Control to send mail.

    You need 2 controls :
    - MAPISession1
    - MAPIMessages1
    Call:
    - MAPISession1.SignOn
    - MAPIMessages1
    .MsgIndex = -1
    .RecipDisplayName = "SendTo"
    .MsgSubject = "Subject"
    .MsgNoteText = "Message"
    .SessionID = MAPISession1.SessionID
    .Send
    - MAPISession1.SignOff
    Hope this helps

  • Thank you to the WPF Bing Maps Control developers and Ricky

    I just want to say thank you for the effort that the Bing Maps Team has put into updating the WPF Control.  It is greatly appreciated.  Those of us doing desktop development sometimes feel left out, and the recent updates go a long ways
    to helping us do our jobs.
     I look forward to bigger and better things in the future once the Microsoft direction for the desktop is made clear.
    pmont

    Glad to hear your happy with the updated control. All the credit goes to the developers. I only posted info on the forums, they did all the work.
    http://rbrundritt.wordpress.com

  • XSLT mapping sometimes throw ArrayOutOfBoundsException

    Hi
    I have a simple XSLT mapping that is supposed to group elements based on an identificator (number).
    My issue is that when testing message through PI, it sometimes throw ArrayOutOfBoundsException and sometimes not, with the same records involved..!!
    I have tested it all in XML Spy and there it always works.
    The XSLT looks like this:
         <xsl:for-each select="Invoice_KA49">
              <xsl:variable name="Ident">
                   <xsl:value-of select="Identificator"/>
              </xsl:variable>
              <GroupElement>
                   <xsl:copy-of select="../[Identificator=$Ident]"/><!--../-->
              </GroupElement>
         </xsl:for-each>
    Anyone knows why this happens? Any help would be appreciated!
    Thanks.
    regards Ole

    Hi Ole, looks like you produce a document with duplicate entries which have to be removed in a next step. Maybe the duplicate entries blow up the document. When you want to group Invoice_KA49 elements based on the key Identifikator, as Udo already suggest you should only select distinct values in the for-each loop, e.g.
    <xsl:for-each select="//Invoice_KA49[Identifikator=not(./Identifikator=preceding-sibling::Invoice_KA49/Identifikator)]">
    In this way you do not produce duplicate entries.
    Unfortunately we cannot use the function
    distinct-value(..)
    here since it's only available in xslt 2.0.
    Best regards, Martin

Maybe you are looking for