Message=NullReferenceException
StackTrace:
at Telerik.Windows.Controls.TiltInteractionInfo.Clear(Boolean animate)
at Telerik.Windows.Controls.TiltInteractionEffect.EndTilting(Boolean animate)
at Telerik.Windows.Controls.TiltInteractionEffect.OnElementManipulationCompleted(Object sender, RoutedEventArgs e)
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)
I get this error sometimes when executing a call.
8 Answers, 1 is accepted
<controls:PivotItem x:Name="SearchPivot" Header="Search" Margin="0,0,0,-2" KeyDown="SearchPivot_KeyDown"tc:InteractionEffectManager.IsInteractionEnabled="True"> <Grid x:Name="SearchGrid"> <TextBox x:Name="searchbox" TextWrapping="Wrap" VerticalAlignment="Top" Margin="0,8,96,0" Background="#5D000400"/> <tp:RadDataBoundListBox x:Name="searchlist" ItemsSource ="{Binding SearchCurrentForums}" IsSynchronizedWithCurrentItem="True" EmptyContent="No Forums to Display" ItemTemplate="{StaticResource ListBoxItemTemplate}" Margin="0,80,0,0" ItemTap="searchlist_ItemTap" IsAsyncBalanceEnabled="True" RealizedItemsBufferScale="4"> <tp:RadDataBoundListBox.VirtualizationStrategyDefinition> <tp:StackVirtualizationStrategyDefinition Orientation="Vertical"/> </tp:RadDataBoundListBox.VirtualizationStrategyDefinition> </tp:RadDataBoundListBox> <Controls:RoundButton Content="" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,17,20,0" Foreground="Black" BorderBrush="Black" ImageSource="appbar.feature.search.rest.png" Tap="SearchButton_Tap"/> </Grid>
Thank you for contacting us and sorry for the delayed reply. We've been experiencing some technical difficulties with our support system.
Now straight to the question at hand. I managed to reproduce the issue and can confirm that it occurs in our code. I've already implemented a fix which will be available with our next internal build. Give it a try and let me know if you still experience the same issue. I'd be glad to further assist you. In addition, I've updated your telerik points accordingly.
Kiril Stanoev
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Application_UnhandledException
Type: System.NullReferenceException
Message: NullReferenceException
at Telerik.Windows.Controls.TiltInteractionEffect.ApplyTilt(FrameworkElement element, FrameworkElement container, Point manipulationPoint)
at Telerik.Windows.Controls.TiltInteractionEffect.OnElementManipulationDelta(Object sender, RoutedEventArgs 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)
Thank you for reporting this issue. I've implemented a fix which will be available with the next internal build. Give it a try and let me know if it works for you. I'd be glad to further assist you. I've also updated your Telerik points accordingly.
Regards,Kiril Stanoev
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I am using build: 2012.2.724.2040. Does this build have your fix?
ExceptionMessage:NullReferenceException
StackTrace:
at
Telerik.Windows.Controls.TiltInteractionEffect.ApplyTilt(FrameworkElement
element, FrameworkElement container, Point manipulationPoint)
at
Telerik.Windows.Controls.TiltInteractionEffect.OnElementManipulationDelta(Object
sender, RoutedEventArgs 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)
The fix I implemented did reach the 2012.2.724.2040 version of our controls. As it turns out, this fix is not enough.
This is how initially, the ApplyTilt looked like:
private
void
ApplyTilt(FrameworkElement element, FrameworkElement container, Point manipulationPoint)
{
Point normalizedPoint =
new
Point(
Math.Min(Math.Max(manipulationPoint.X / element.ActualWidth, 0), 1),
Math.Min(Math.Max(manipulationPoint.Y / element.ActualHeight, 0), 1));
double
xMagnitude = Math.Abs(normalizedPoint.X - 0.5);
double
yMagnitude = Math.Abs(normalizedPoint.Y - 0.5);
double
xDirection = -Math.Sign(normalizedPoint.X - 0.5);
double
yDirection = Math.Sign(normalizedPoint.Y - 0.5);
double
angleMagnitude = xMagnitude + yMagnitude;
double
xAngleContribution = xMagnitude + yMagnitude > 0 ? xMagnitude / (xMagnitude + yMagnitude) : 0;
double
angle = angleMagnitude *
this
.MaxRotationAngle * 180 / Math.PI;
double
depression = (1 - angleMagnitude) *
this
.MaxZOffset;
PlaneProjection projection = element.Projection
as
PlaneProjection;
projection.RotationY = angle * xAngleContribution * xDirection;
projection.RotationX = angle * (1 - xAngleContribution) * yDirection;
projection.GlobalOffsetZ = -depression;
}
My first thought was that either element or container must be throwing the NullReference exception. Since, container is not used in the method, all was left was element:
private
void
ApplyTilt(FrameworkElement element, FrameworkElement container, Point manipulationPoint)
{
if
(element ==
null
)
{
return
;
}
Point normalizedPoint =
new
Point(
Math.Min(Math.Max(manipulationPoint.X / element.ActualWidth, 0), 1),
Math.Min(Math.Max(manipulationPoint.Y / element.ActualHeight, 0), 1));
double
xMagnitude = Math.Abs(normalizedPoint.X - 0.5);
double
yMagnitude = Math.Abs(normalizedPoint.Y - 0.5);
double
xDirection = -Math.Sign(normalizedPoint.X - 0.5);
double
yDirection = Math.Sign(normalizedPoint.Y - 0.5);
double
angleMagnitude = xMagnitude + yMagnitude;
double
xAngleContribution = xMagnitude + yMagnitude > 0 ? xMagnitude / (xMagnitude + yMagnitude) : 0;
double
angle = angleMagnitude *
this
.MaxRotationAngle * 180 / Math.PI;
double
depression = (1 - angleMagnitude) *
this
.MaxZOffset;
PlaneProjection projection = element.Projection
as
PlaneProjection;
projection.RotationY = angle * xAngleContribution * xDirection;
projection.RotationX = angle * (1 - xAngleContribution) * yDirection;
projection.GlobalOffsetZ = -depression;
}
Looking closer, one can see the other soft spot (
element.Projection
as
PlaneProjection
). I've applied one additional null reference check:private
void
ApplyTilt(FrameworkElement element, FrameworkElement container, Point manipulationPoint)
{
if
(element ==
null
)
{
return
;
}
Point normalizedPoint =
new
Point(
Math.Min(Math.Max(manipulationPoint.X / element.ActualWidth, 0), 1),
Math.Min(Math.Max(manipulationPoint.Y / element.ActualHeight, 0), 1));
double
xMagnitude = Math.Abs(normalizedPoint.X - 0.5);
double
yMagnitude = Math.Abs(normalizedPoint.Y - 0.5);
double
xDirection = -Math.Sign(normalizedPoint.X - 0.5);
double
yDirection = Math.Sign(normalizedPoint.Y - 0.5);
double
angleMagnitude = xMagnitude + yMagnitude;
double
xAngleContribution = xMagnitude + yMagnitude > 0 ? xMagnitude / (xMagnitude + yMagnitude) : 0;
double
angle = angleMagnitude *
this
.MaxRotationAngle * 180 / Math.PI;
double
depression = (1 - angleMagnitude) *
this
.MaxZOffset;
PlaneProjection projection = element.Projection
as
PlaneProjection;
if
(projection !=
null
)
{
projection.RotationY = angle * xAngleContribution * xDirection;
projection.RotationX = angle * (1 - xAngleContribution) * yDirection;
projection.GlobalOffsetZ = -depression;
}
}
The fix will be available with this week's internal build. Give it a try and let me know how it goes. I'd be glad to further assist you. Kind regards,
Kiril Stanoev
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I don't see this exception in a controled environment. Instead it gets reported by email and via flurry.com from users. Relative to the number of uses, it happens very rarely (about 1 in 10,000 runs). You would think the property would be null or it wouldn't. I am beginning to wonder if tilt is triggered on some UI element where I am not expecting it and the exception is triggered when users happen to tap that.
Thanks for your help! I am always working on updates to the app, and I will get your latest build into the next update.
Paul