This exception has been popping up for my windows phone game on my main screen when navigating to a level select screen.
As far as i can tell this can happen if there's a Dispatch timer that isn't stopped before navigating OR the page is trying to navigate to itself. I fairly certain it's not the later as there's only one path for it to go.
I don't have any specific Dispatch timers on the page, but i do have a storyboard / animation going. Could this possibly be the cause?
Dispatcher Timer:
http://mobileworld.appamundi.com/blogs/petevickers/archive/2011/03/22/windows-phone-7-no-fragment-support-right-now.aspx
Stack Trace:
Exception caught. Message: No Fragment support right now
Trace: at System.Windows.Navigation.NavigationService.Navigate(Uri source)
at AppleBin.MainPage.btnLevelSelect_Click(Object sender, RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
Related
We've got a Xamarin.Forms Android app in which we're displaying progress on a loading page, the progress value being sent by an event from another class.
We're using FreshMvvm which has ViewIsAppearing and ViewIsDisappearing overrides available in the PageModel.
So we're subscribing on ViewIsAppearing, and unsubscribing in ViewIsDisappearing - we're also unsubscribing in a PrepareForDispose method which is intended to ensure the PageModel has cleaned up so that it can be disposed.
Code is below. ProgressManager is supplied by IoC
protected override void ViewIsAppearing (object sender, EventArgs e)
{
base.ViewIsAppearing (sender, e);
ProgressManager.ProgressEvent += ProgressManager_ProgressEvent;
}
protected override void ViewIsDisappearing (object sender, EventArgs e)
{
base.ViewIsDisappearing (sender, e);
RemoveEventHandlers();
}
public override void PrepareForDispose()
{
RemoveEventHandlers();
base.PrepareForDispose();
}
private void RemoveEventHandlers()
{
ProgressManager.ProgressEvent -= ProgressManager_ProgressEvent;
}
The problem is that, when examining object in Profiler, we can see the LoadingPageModel is still in memory, because of the EventArgs created in the ViewIsAppearing (examining the "Paths To Root" in Profiler tells us this).
When I log/debug the app, I can see that RemoveEventHandlers has been called.
So is _ProgressManager.ProgressEvent -= ProgressManager_ProgressEvent;_ failing to remove the handler, or is there another reason that we've still got a reference to the PageModel from the EventArgs?
Edit One possibility is that we're subscribing more than once, but unsubscribing only once. I've checked with debug/logging, and I don't think this is the case. We're subscribing/unsubscribing symmetrically.
It turns out that we were subscribing twice (due to the lifecyle of the page in question at the start of the app lifecycle). Therefore the single unsubscribe was leaving a subscription behind.
Fixing this fixed the problem.
I am getting the exception ArgumentException was Unhandled(The Parameter is incorrect) in wp7 app when i touches the screen. I have already put all break points, but not getting why this exception is coming?Following i am putting the stack trace of that exception. Please help me?
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.UIElement_HitTestPoint(UIElement element, Point ptHit)
at System.Windows.Media.VisualTreeHelper.FindElementsInHostCoordinates(Point intersectingPoint, UIElement subtree)
at Microsoft.Phone.Controls.GestureListener.TouchStart()
at Microsoft.Phone.Controls.GestureListener.OnTouchFrameReported(Object sender, TouchFrameEventArgs e)
at System.Windows.Input.Touch.OnTouch(Object sender, TouchFrameEventArgs e)
at MS.Internal.JoltHelper.RaiseEvent(IntPtr target, UInt32 eventId, IntPtr coreEventArgs, UInt32 eventArgsTypeIndex)
This is the problem with Microshoft.Phone.Controls.Toolkit. This is a kind of bug in this library. When I removed all the code of gesture from xaml file then the above exception is not coming. I don't know what's the actual reason behind this.
The thing is, I got a weird exception from Windows Phone app I am developing:
System.Exception was unhandled
Message=Unspecified error
StackTrace:
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.Collection_AddValue[T](PresentationFrameworkCollection`1 collection, CValue value)
at MS.Internal.XcpImports.Collection_AddDependencyObject[T](PresentationFrameworkCollection`1 collection, DependencyObject value)
at System.Windows.PresentationFrameworkCollection`1.AddDependencyObject(DependencyObject value)
at System.Windows.Controls.UIElementCollection.AddInternal(UIElement value)
at System.Windows.PresentationFrameworkCollection`1.Add(UIElement value)
at System.Windows.Controls.ItemsControl.AddVisualChild(Int32 index, DependencyObject container, Boolean needPrepareContainer)
at System.Windows.Controls.ItemsControl.AddContainerForPosition(GeneratorPosition position)
at System.Windows.Controls.ItemsControl.OnItemsChangedHandler(Object sender, ItemsChangedEventArgs args)
at System.Windows.Controls.ItemContainerGenerator.OnItemAdded(Object item, Int32 index)
at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.ICollectionChangedListener.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at System.Windows.Controls.WeakCollectionChangedListener.SourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
at System.Windows.Controls.ItemCollection.NotifyCollectionChanged(NotifyCollectionChangedEventArgs e)
at System.Windows.Controls.ItemCollection.System.Windows.Controls.ICollectionChangedListener.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
at System.Windows.Controls.WeakCollectionChangedListener.SourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, FormItem item)
at System.Collections.ObjectModel.Collection`1.Add(FormItem item)
at //My Code
What my code tried to do is add a item to an ObservableCollection.
I want to step into System.Windows code so I can see what that "Unspecified error" is.
I already do the following in my Visual Studio:
Enable .NET Framework source stepping
Enable source server support
Enable Microsoft Symbol Servers
Despite that, I can't step in (double clicking) into any of System.Windows methods in the call stack.
Any help is appreciated. Let me know if any of you need more clarification.
I have an app that I'm upgrading from some beta bits - and my map screen is crashing. So to try to get to the bottom of it - I started a brand new - blank "Win Phone Application".
Referenced Caliburn.Micro (just built from new code last night) Version: caliburnmicro_1296ea635677 (from codeplex)
referenced Microsoft.phone.controls.map.dll
and in the MainPage I added
<Grid>
<Maps:Map />
</Grid>
and I add a bootstrapper to app.xaml
<WP7:PhoneBootStrapper x:Name="bootstrapper" />
when the page runs in the phone emulator - the main page renders and I see a map of the world. if I click anywhere on the page - I get an unhandled exception of "The parameter is incorrect"
if I remove the
from the app.xaml - the map works correctly.
What do you think?
Thanks for any advice?
I have found the answer.
The key here - is that I had this setup and wroking with the Beta Templates - and it stopped working when I moved to the WinPhone RTM Templates in VS2010.
Caliburn does some work on my behalf, that was "ADDED" to the RTM templates - which were conflicting with each other. In the end This problem has/had nothing to do with the Bing Maps control - it just so happens that - that was my first screen - so that's where I was trying to solve the problem.
This was the ever so Not-Helpful exception:
The parameter is incorrect
Which, I'm pretty sure would happen on any screen - if you went to the upgrade path of templates, like I did. So here is what I had to remove - to get everything back to normal. In the new App.Xaml.cs - I removed (by commenting) in the App Ctor ...
// Phone-specific initialization
// InitializePhoneApplication();
// Global handler for uncaught exceptions.
// UnhandledException += Application_UnhandledException;
And then I removed these method bodies, because it's just dead code after removing the InitializePhoneApplication() call from ctor ...
// Code to execute when the application is launching (eg, from Start)
// This code will not execute when the application is reactivated
private void Application_Launching(object sender, LaunchingEventArgs e)
{
}
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
}
// Code to execute when the application is deactivated (sent to background)
// This code will not execute when the application is closing
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{
}
// Code to execute when the application is closing (eg, user hit Back)
// This code will not execute when the application is deactivated
private void Application_Closing(object sender, ClosingEventArgs e)
{
}
// Code to execute if a navigation fails
private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// A navigation has failed; break into the debugger
System.Diagnostics.Debugger.Break();
}
}
// Code to execute on Unhandled Exceptions
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
System.Diagnostics.Debugger.Break();
}
}
#region Phone application initialization
// Avoid double-initialization
private bool phoneApplicationInitialized = false;
// Do not add any additional code to this method
private void InitializePhoneApplication()
{
if (phoneApplicationInitialized)
return;
// Create the frame but don't set it as RootVisual yet; this allows the splash
// screen to remain active until the application is ready to render.
RootFrame = new PhoneApplicationFrame();
RootFrame.Navigated += CompleteInitializePhoneApplication;
// Handle navigation failures
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
// Ensure we don't initialize again
phoneApplicationInitialized = true;
}
// Do not add any additional code to this method
private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
{
// Set the root visual to allow the application to render
if (RootVisual != RootFrame)
RootVisual = RootFrame;
// Remove this handler since it is no longer needed
RootFrame.Navigated -= CompleteInitializePhoneApplication;
}
#endregion
Special Thanks to Rob for his help solving this mystery!
I'm trying to combine multiple js file references using Telerik's script manager. Here is the code I have on page load:
System.Web.UI.ScriptReference jsFile1 = new System.Web.UI.ScriptReference('/virtual_folder/jsfile1.js');
System.Web.UI.ScriptReference jsFile2 = new System.Web.UI.ScriptReference('/virtual_folder/jsfile2.js');
this.Master.ScriptManager.CompositeScript.Scripts.Add(jsFile1);
this.Master.ScriptManager.CompositeScript.Scripts.Add(jsFile2);
I'm getting an error:
[NullReferenceException: Object reference not set to an instance of an object.]
System.Collections.ObjectModel.Collection`1.Add(T item) +18
Telerik.Web.UI.RadScriptManager.Page_PreRenderComplete(Object sender, EventArgs e) +95
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +8695102
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1029
What am I doing wrong?
I think that the script combining only works for embedded resources currently so you would have to embed your js Files inside a dll.
On a side note you know you can use
this.Master.ScriptManager.
tried using
RadScriptManager.GetCurrent(this)
I am assuming you are calling this from an aspx page and not an ascx control, otherwise you have to use this.Page.