Error while editing layout files - monodevelop

Since updating to version 3.0.1 of MonoDevelop, I've been unable to work with layout files. When I create a new layout file and then try to edit it from the "Source" tab, I get the following error:
System.InvalidOperationException: Layout not yet loaded
at Xamarin.AndroidDesigner.DesignerSession.SetLayoutXml (System.String xml, Boolean allowUndo) [0x000bf] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/md-addins/MonoDevelop.MonoDroid/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/DesignerSession.cs:353
at MonoDevelop.MonoDroid.Gui.LayoutSourceEditorView.SaveContent () [0x00025] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/md-addins/MonoDevelop.MonoDroid/MonoDevelop.MonoDroid/Gui/AndroidDesignerView.cs:641
at MonoDevelop.MonoDroid.Gui.LayoutSourceEditorView.Deselected () [0x00000] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/md-addins/MonoDevelop.MonoDroid/MonoDevelop.MonoDroid/Gui/AndroidDesignerView.cs:670
at MonoDevelop.Ide.Gui.SdiWorkspaceWindow.SetCurrentView (Int32 newIndex) [0x00032] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs:571
at MonoDevelop.Ide.Gui.SdiWorkspaceWindow+<AddButton>c__AnonStoreyB0.<>m__169 (System.Object sender, System.EventArgs e) [0x00033] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs:488
at MonoDevelop.Components.Tab.OnActivated (System.EventArgs e) [0x0000d] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Tabstrip.cs:396
at MonoDevelop.Components.Tab.Activate () [0x00000] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Tabstrip.cs:244
at MonoDevelop.Ide.Gui.SdiWorkspaceWindow.ActiveDocumentChanged (System.Object sender, System.EventArgs e) [0x0000b] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs:501
at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)
at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)
at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)
at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)
at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)
at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)
at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)
at MonoDevelop.Ide.Gui.Workbench.OnDocumentChanged (System.Object s, System.EventArgs a) [0x0000b] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs:606
at MonoDevelop.Ide.Gui.DefaultWorkbench.OnActiveWindowChanged (System.Object sender, System.EventArgs e) [0x00075] in /Users/builder/data/lanes/monodevelop-mac-3.0.1/6642975f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs:749
at Gtk.Notebook.SwitchPageSignalCallback (IntPtr arg0, IntPtr arg1, UInt32 arg2, IntPtr gch) [0x00000] in <filename unknown>:0
I haven't found a bug indicating others are experiencing this. Could it be a configuration issue of some sort in my environment? I'm using Mono for Android 4.2.1.196198126.

This issue was addressed in version 3.0.2 of MonoDevelop.
http://monodevelop.com/Download/Release_Notes/Release_Notes_for_MonoDevelop_3.0.2

Related

SciChart 3.1 exception

A bit of a long-shot given that I'm using such an old version (3.1.0.4759). Users have recently started reporting the exception below when zooming on one of my application's charts. It's a bit of a pain as it can't be handled, so the whole app crashes.
It's very, very intermittent, and I've not been able to repro. The chart series does get cleared down and repopulated once a second, so the intermittent nature could be explained by (say) zooming at that specific moment in time. Having said this, I have a lot of charts throughout my app, many of which are continuously plotting, and all using the same chart modifiers, but have never noticed this problem before.
Just wondering if any of the ABT guys can shed any light on this! TIA.
System.NullReferenceException: Object reference not set to an instance of an object.
at Abt.Controls.SciChart.RangeFactory.NewWithMinMax(IRange originalRange, IComparable min, IComparable max)
at Abt.Controls.SciChart.Wpf.PcitureHelper.Zoom(IRange initialRange, Double fromCoord, Double toCoord)
at Abt.Controls.SciChart.ChartModifiers.RubberBandXyZoomModifier.UpdateOutline(IAxis firstFont, Double currentValues, Double currentId)
at Abt.Controls.SciChart.ChartModifiers.RubberBandXyZoomModifier.UpdateOutline(IAxis firstFont, Rect currentValues)
at Abt.Controls.SciChart.ChartModifiers.RubberBandXyZoomModifier.OpenDatabase(Point firstFont, Point currentValues)
at Abt.Controls.SciChart.ChartModifiers.RubberBandXyZoomModifier.OnModifierMouseUp(ModifierMouseArgs e)
at Abt.Controls.SciChart.ChartModifiers.ModifierGroup.UpdateOutline(Action2 firstFont, ModifierEventArgsBase currentValues)
at Abt.Controls.SciChart.Common.Extensions.EnumerableExtensions.CopyBuilder[firstFont](IEnumerable`1 firstFont, Action1 currentValues)
at Abt.Controls.SciChart.Utility.Mouse.MouseManager.QueueInvoker.JoinControl(Object firstFont, MouseButtonEventArgs currentValues)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, 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.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
It looks like you got a NullReferenceException inside RangeFactory.NewWithMinMax
and also looks like you've customised the source-code, as the methods
at Abt.Controls.SciChart.Wpf.PcitureHelper.Zoom(IRange initialRange, Double fromCoord, Double toCoord)
at Abt.Controls.SciChart.ChartModifiers.RubberBandXyZoomModifier.UpdateOutline(IAxis firstFont, Double currentValues, Double currentId)
at Abt.Controls.SciChart.ChartModifiers.RubberBandXyZoomModifier.UpdateOutline(IAxis firstFont, Rect currentValues).
at Abt.Controls.SciChart.ChartModifiers.RubberBandXyZoomModifier.OpenDatabase
are not part of the SciChart codebase.
So I'd guess that the problem lies in those methods passing invalid values to RangeFactory.
BTW the SciChart team would also tell you that v3 is pretty out of date and to ensure stability, to get up to date. That and if you get problems like this in an old version, especially in customised source-code, they can't help!

Google map Geocoder And MoveToRegion not working

I' have a very strange issue with Xamarin.Forms.Maps.
I'm trying to implement a page with a map that get current location and move to region at page start.
All is working fine in IOS, but in Android, Geocoder & MoveToRegion are not working at all. Only the map is displayed.
I retrieve the location correctly (Long & Lat ) in the emulators & device.
MoveToRegion do nothing & GetAddressesForPositionAsync retrive nothing.
Here the information in my manifest :
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="mykey" />
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Here the code :
map.MoveToRegion(MapSpan.FromCenterAndRadius(
new Xamarin.Forms.Maps.Position(coordinates.Lat.Value, coordinates.Lng.Value), Distance.FromMiles(1))
);
var possibleAddresses = await locator.GetAddressesForPositionAsync(position);
I tried in Genymotion, Emulator from AVD.
I'm not able to test in real device ( The deployment fail in my tablet )
Edit :
global::Xamarin.Forms.Forms.Init(this, bundle);
Was correctly set but still not working.
I force geocoder usage and it thrown this error :
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Java.IO.IOException: grpc failed
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <6cd960837cc24c26bab2a0a29b597627>:0
[MonoDroid] at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00014] in <6cd960837cc24c26bab2a0a29b597627>:0
[MonoDroid] at Android.Locations.Geocoder.GetFromLocationName (System.String locationName, System.Int32 maxResults) [0x0003c] in <d278c06ad5684d6882c743a94a93ebc2>:0
[MonoDroid] at Android.Locations.Geocoder+<>c__DisplayClass17_0.<GetFromLocationNameAsync>b__0 () [0x00000] in <d278c06ad5684d6882c743a94a93ebc2>:0
[MonoDroid] at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at System.Threading.Tasks.Task.Execute () [0x00010] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] --- End of stack trace from previous location where exception was thrown ---
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at Xamarin.Forms.Maps.Android.GeocoderBackend+<GetPositionsForAddressAsync>d__1.MoveNext () [0x0006b] in <39c694c022be4f7b8a39897d372b2d00>:0
[MonoDroid] --- End of stack trace from previous location where exception was thrown ---
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at Picaplant.Views.GeolocationPage+<HandleAdressCompleted>d__8.MoveNext () [0x00047] in /Users/OrcusZ/Documents/AutoEntrepreneur/Picaplant/Source/Picaplant/Views/GeolocationPage.xaml.cs:158
[MonoDroid] --- End of stack trace from previous location where exception was thrown ---
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
[MonoDroid] at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <d278c06ad5684d6882c743a94a93ebc2>:0
[MonoDroid] at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <d278c06ad5684d6882c743a94a93ebc2>:0
[MonoDroid] at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <d278c06ad5684d6882c743a94a93ebc2>:0
[MonoDroid] at (wrapper dynamic-method) System.Object:6621ff63-14b8-4291-a222-45bff630bddc (intptr,intptr)
[MonoDroid] --- End of managed Java.IO.IOException stack trace ---
[MonoDroid] java.io.IOException: grpc failed
[MonoDroid] at android.location.Geocoder.getFromLocationName(Geocoder.java:178)
[MonoDroid]
EDIT 2 :
Same error with Xamarin Form Working with maps sample
Any idea ?
Here's a working cross-platform sample app. It runs in a KitKat 4.4 API Level 19 emulator and also in a Samsung Android device.
We also present a custom Geocoder implementation using HTTP requests given that the standard one works fine for an actual Android device but returns an empty response for the emulator.
XAML:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:Maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps.dll"
xmlns:local="clr-namespace:App20"
x:Class="App20.MainPage">
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="8*"></RowDefinition>
<RowDefinition Height="4*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Maps:Map x:Name="map1" Grid.Row="0"></Maps:Map>
<ListView ItemsSource="{Binding AddressList}" Grid.Row="1" />
<Button Text="Move To Region" Grid.Row="2" Clicked="Button_Clicked_Move"></Button>
<Button Text="Get Address" Grid.Row="3" Clicked="Button_Clicked_Address"></Button>
</Grid>
</ContentPage.Content>
</ContentPage>
CS:
public partial class MainPage : ContentPage
{
MyViewModel vm;
public MainPage()
{
InitializeComponent();
vm = new MyViewModel();
BindingContext = vm;
}
private void Button_Clicked_Move(object sender, EventArgs e)
{
map1.MoveToRegion(MapSpan.FromCenterAndRadius(
new Position(vm.Lat, vm.Lon), Distance.FromMiles(vm.Distance)));
}
private async void Button_Clicked_Address(object sender, EventArgs e)
{
Geocoder gc = new Geocoder();
var list = await gc.GetAddressesForPositionAsync(new Position(vm.Lat, vm.Lon));
if (list.Count() > 0)
{
foreach (string s in list)
vm.AddressList.Add(s);
}
else
{
MyGeocoder mgc = new MyGeocoder();
var mylist = await mgc.GetAddressesForPositionAsync(vm.Lat, vm.Lon, vm.Key);
foreach (string s in mylist)
vm.AddressList.Add(s);
}
}
}
View Model:
public class MyViewModel
{
public string Key { get; }
public double Lat { get; set; }
public double Lon { get; set; }
public double Distance { get; set; }
public ObservableCollection<string> AddressList { get; set; }
public MyViewModel()
{
Lat = 40.706501;
Lon = -74.011340;
Distance = 0.5;
Key = "YOUR_API_KEY";
AddressList = new ObservableCollection<string>();
}
}
Custom Geocoder:
public class MyGeocoder
{
public async Task<IEnumerable<string>> GetAddressesForPositionAsync(double lat, double lon, string key)
{
HttpClient client = new HttpClient();
var request = string.Format(#"https://maps.googleapis.com/maps/api/geocode/json?latlng={0},{1}&key={2}", lat, lon, key);
var json = await client.GetStringAsync(request);
var result = JObject.Parse(json)["results"];
List<string> list = new List<string>();
foreach (JToken jt in result)
list.Add((string)jt["formatted_address"]);
return list.AsEnumerable<string>();
}
}

How to handle the AmazonServiceException thrown when disconnected with network

I'm using AWS mobile SDK for Xamarin (http://aws.amazon.com/about-aws/whats-new/2014/10/09/aws-mobile-sdk-for-xamarin-available-on-awslabs/) and i got a problem when i use GetObjectAsync() method to get files from my S3 Bucket. My code:
private async Task<string> GetObjectFromAmazonS3(S3Object s3Object, string fileContent, string bucketName)
{
AWSCredentials credential = new BasicAWSCredentials(Constants.S3AccessKey, Constants.S3SecretKey);
_amazonS3Client = new AmazonS3Client(credential, Amazon.RegionEndpoint.EUCentral1);
_amazonS3Client.ExceptionEvent += ClientExceptionHandler;
GetObjectRequest getObjectRequest = new GetObjectRequest
{
BucketName = bucketName,
Key = s3Object.Key
};
GetObjectResponse getObjectResponse = await _amazonS3Client.GetObjectAsync(getObjectRequest);
using (Stream responseStream = getObjectResponse.ResponseStream)
using (StreamReader reader = new StreamReader(responseStream))
{
fileContent = reader.ReadToEnd();
}
Logger.Log(Logger.Category.Debugging, "Download S3 Objects to the phone", "Get object " + s3Object.Key + " successfully");
return fileContent;
}
The problem is that when the application waiting for the response from GetObjectAsync() method, the phone is disconnected with the network then i got an exception:
2015-03-03T07:23:27.582Z,Debugging,UnhandledException(Android),Amazon.Runtime.AmazonServiceException: A WebException with status NameResolutionFailure was thrown.
---> System.Net.WebException: Error: NameResolutionFailure
==> at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
==> at System.Threading.Tasks.TaskFactory`1[System.Net.WebResponse].InnerInvoke (System.Threading.Tasks.TaskCompletionSource`1 tcs, System.Func`2 endMethod, IAsyncResult l) [0x00000] in <filename unknown>:0
==> --- End of stack trace from previous location where exception was thrown ---
==> at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 ==> at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[System.Net.WebResponse].GetResult () [0x00000] in <filename unknown>:0
And my application is crashed. I tried to handle the application by using ExceptionEvent but i still cannot catch this exception.
Is there any suggestion to solve this problem? (It's very terrible that the application crashes each time the wifi disconnected).

Windows Phone NullReferenceException while navigating mystery

During page navigatin within my app I display a message in the system tray to the user along with the progress bar to indicate something is going on.
The problem I'm having is during debug I am randomly getting the following error:
{System.NullReferenceException: Object reference not set to an instance of an object.
at ContosoSocial.SetProgressIndicator.<>c__DisplayClass1.<runSystrayMessage>b__0(Object sender, EventArgs args)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)} System.Exception {System.NullReferenceException}
Stacktrace:
StackTrace " at ContosoSocial.SetProgressIndicator.<>c__DisplayClass1.<runSystrayMessage>b__0(Object sender, EventArgs args)\r\n at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)\r\n at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)" string
I'm still new to VS2013 and Windows Phone programming so really need a little help here figuring out how to trace and fix this problem?
The error seems to be random, here is an example of the class displaying the system tray message and calling method:
class SetProgressIndicator
{
public void runSystrayMessage(bool isVisible, string text, int length)
{
try
{
SystemTray.ProgressIndicator = new ProgressIndicator();
SystemTray.ProgressIndicator.IsVisible = true;
SystemTray.ProgressIndicator.Text = text;
SystemTray.ProgressIndicator.IsIndeterminate = isVisible;
}
catch (System.InvalidOperationException e)
{
Debug.WriteLine("Exception caught in runSystrayMessage(): \r\n" + e);
}
DispatcherTimer timer = new DispatcherTimer();
try
{
timer.Interval = TimeSpan.FromMilliseconds(length);
}
catch(ArgumentOutOfRangeException e)
{
Debug.WriteLine("Exception caught in runSystrayMessage(): \r\n" + e);
}
timer.Tick += (sender, args) =>
{
try
{
SystemTray.ProgressIndicator.IsVisible = false;
}
catch(System.InvalidOperationException e)
{
Debug.WriteLine("Exception caught in runSystrayMessage(): \r\n" + e);
}
timer.Stop();
};
timer.Start();
}
}
}
Example of a calling method:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
SetProgressIndicator progInd = new SetProgressIndicator();
// Check for full licnece before removing ad's
if (TrialExperienceHelper.LicenseMode == TrialExperienceHelper.LicenseModes.Full)
{
GOTPubCenter10.Visibility = Visibility.Collapsed;
}
// Dispaly message in system tray
if (hasBeenVisited)
{
progInd.runSystrayMessage(true, "Entering house selection menu...", 2500);
}
else
{
progInd.runSystrayMessage(true, "Select house library to enter...", 8000);
hasBeenVisited = true;
}
}
Ideas and suggestions on how to solve the problem appreciated.

Unity WP8 sample not working

I am trying to develop a unity plugin for WP8. I followed the following guide: http://docs.unity3d.com/Manual/wp8-plugins-guide-csharp.html
Then copied the fake dll to assets/plugin and real dll to assets/plugin/WP8.
I created the following script:
using UnityEngine;
using System.Collections;
public class AdDemo : MonoBehaviour {
void Start () {
string t = UnityPluginForWindowsPhone.Class1.GetDeviceName;
}
}
When compiling in Unity 4.5 I get the following error:
Internal compiler error. See the console log for more information. output was:
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
Did anybody get this to work?
Thanks
Finally i found solution after struggling 2 days. The solution in the tutorials it self.
You should use Plugins folder under Assets folder.
Here you missed 's' in Plugin folder assets/plugin/WP8
This should like this Assets/Plugins/WP8