Development troubleshooting

From Maria GDK Wiki
Revision as of 16:22, 25 July 2019 by Mbu (talk | contribs) (Created page with "== MariaUserControl not found. == * Check projects ''Target framework'', Properties→Application. See Development Requirements =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

MariaUserControl not found.

Map info not displayed

  • Check that expected map services are available.
  • Check endpoint definitions in app.config.

FileLoadException unhandled

Appears when available version of an assembly to be loaded does not match the expected version.

Example:

Trs fileloadexept.png
Trs fileexplorer.png

The version of the loaded protobuf-net assembly (in binary folder) is higher than the version expected by the Maira2012 NuGet assemblies.

This is fixed by adding a redirection statement for the assembly in the app.config file.

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="protobuf-net"
                publicKeyToken="257b51d87d2e4d67"
                culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-2.0.0.666"
                newVersion="2.0.0.666" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>

Memory leaks in MariaUserControl.

Memory leaks are quite common in WPF applications. Maria GDK is tested for memory problems before every release, but many of the problems can be caused by WPF usage outside of Maria GDK. Below are some pointers to common mistakes.

* Timers in own view model has to be disposed/stopped.
* Events that has been subscribed in your own view models needs to be unsubscribed.
* The suggestion here is to implement IDisposable on your own view models and stop any timers and unsubscribe from events.

Sample Dispose method for code behind of XAML that contains the MariaUserControl:

public void Dispose()
{
   BindingOperations.ClearAllBindings(this);
   //MariaCtrl is the name given to the MariaUserControl instance in XAML
   MariaCtrl.Dispose();
   MariaCtrl = null;

   //Setting DataContext to null avoids many problems that occur
   //with bindings to parts of Maria.
   DataContext = null;

   //_myViewModels is a list of all your own view models.
   foreach(var vm in _myViewModels)
   {
      IDisposable disposableVm = vm as IDisposable.
      if(disposableVm != null)
         disposableVm.Dispose();
   }
}