This is a migrated thread and some comments may be shown as answers.

RadWindow does not work in an application that does not contain a single panel

16 Answers 161 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
emi
Top achievements
Rank 1
emi asked on 22 Aug 2011, 08:11 PM
Hi,

for a xap file dotfuscated with Preemtive Dotfuscator for WP7, I keep getting exception "RadWindow does not work in an application that does not contain a single panel". It's a simple xaml with a RadWindow and a grid, nothing special.

Exception in Preemtive is:

Exception 0: System.InvalidOperationException

Message: RadWindow does not work in an application that does not contain a single panel.

at Telerik.Windows.Controls.RadWindow.as()
at Telerik.Windows.Controls.RadWindow.ax()
at Telerik.Windows.Controls.RadWindow.ab()
at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& sta
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Delegate.DynamicInvokeOne(Object[] args)
at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority)
at System.Windows.Threading.Dispatcher.OnInvoke(Object context)
at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args)
at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)

Any ideas?
Thanks

16 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 23 Aug 2011, 08:05 AM
Hello Emi,

 Thank you for writing.
Is it possible for you to send your application so that I may inspect this behavior. I have a feeling that the obfuscation is not working. Does the project run without obfuscation?
I am looking forward to your reply.

All the best,
Victor
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
George
Top achievements
Rank 1
answered on 05 Oct 2011, 01:45 PM
Did you solved this?
I use no obfuscation and I get this message on the following simple page...

<phone:PhoneApplicationPage
    x:Class="{namespace}.MainPage"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:gauges="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.DataVisualization"   
    xmlns:telerikPrimitives="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"
    xmlns:telerikCore="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Core"
    xmlns:local="clr-namespace:{namespace}"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="Black"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    telerikCore:InteractionEffectManager.IsInteractionEnabled="False"   
    >
 
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="ucLayout" Background="Transparent">
 
 
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>     
         
        <telerikPrimitives:RadModalWindow x:Name="alertWindow" Background="{StaticResource myTrans50}" Placement="CenterCenter">
            <Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="{StaticResource PhoneBorderThickness}">
                <Grid Background="{StaticResource myTrans75}">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
 
                    <TextBlock Grid.Row="0" x:Name="alertWindowText" Grid.ColumnSpan="2" TextWrapping="Wrap" VerticalAlignment="Bottom" Margin="{StaticResource PhoneMargin}" Style="{StaticResource PhoneTextBlock_Small}" Foreground="{StaticResource PhoneAccentBrush}" Width="400" Text="{Binding Path=Localizedresources.MainPage_MicrophoneNotCalibrated, Source={StaticResource LocalizedStrings}}"/>
 
                    <Button Grid.Row="1" Grid.Column="0" Content="{Binding Path=Localizedresources.Global_No, Source={StaticResource LocalizedStrings}}" Click="ButtonNo_Click" Foreground="{StaticResource PhoneAccentBrush}" Background="{StaticResource myTrans50}" BorderBrush="Transparent" />
                    <Button Grid.Row="1" Grid.Column="1" Content="{Binding Path=Localizedresources.Global_Yes, Source={StaticResource LocalizedStrings}}" Click="ButtonYes_Click" Foreground="{StaticResource PhoneAccentBrush}"  BorderBrush="{StaticResource PhoneAccentBrush}" Background="Transparent"  />
                </Grid>
            </Border>
 
            <telerikPrimitives:RadModalWindow.OpenAnimation>
                <telerikCore:RadPlaneProjectionAnimation CenterY="0.5" CenterX="0" StartAngleX="-90" EndAngleX="0" Axes="X">
                    <telerikCore:RadPlaneProjectionAnimation.Easing>
                        <CubicEase EasingMode="EaseInOut"/>
                    </telerikCore:RadPlaneProjectionAnimation.Easing>
                </telerikCore:RadPlaneProjectionAnimation>
            </telerikPrimitives:RadModalWindow.OpenAnimation>
 
        </telerikPrimitives:RadModalWindow>
    </Grid>
 
</phone:PhoneApplicationPage>

0
Victor
Telerik team
answered on 10 Oct 2011, 04:21 PM
Hi George,

 Thank you for writing.
I could not reproduce the exception with the XAML you provided. I removed the references to static resources that did not exist in my application an just ran it. The window opened as expected.
I tested with the Q2 2011 SP release. Please upgrade to the service pack and if you are still experiencing the issue, please post a support ticket with a sample application that demonstrates the issue so that I may debug it.

I am looking forward to your reply.

Regards,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
emi
Top achievements
Rank 1
answered on 10 Oct 2011, 07:16 PM
Hi,
in my case, my windows are having visibility binded in View Models and that could be a reason.
I'm trying to wrap a project which reproduce it. It happens even with latest builds.

Regards
Emi
0
Victor
Telerik team
answered on 14 Oct 2011, 04:03 PM
Hi Emi,

 Thank you for your effort. We are continuing our efforts to reproduce it on our side but it seems we are missing some application state and the exception does no occur. We are standing by to diagnose the problem as soon as we have enough information to reproduce it.

Best wishes,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Robert
Top achievements
Rank 1
answered on 15 Oct 2011, 07:08 AM
I am having the exact same issue, but it occurs randomly. But it only occurs when binding textblock text values to app resources

<telerikPrimitives:RadWindow Name="GreetingWindow"
WindowSizeMode="FitToPlacementTarget">
<Border Margin="10,5,5,10"
BorderBrush="White"
BorderThickness="5"
Background="#FFA2C139">
<Grid Margin="12,12,12,0">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="72"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<TextBlock Name="TextBlock4" Text="{Binding Source={StaticResource LocalizedStrings}, Path=Localizedresources.IntroGreetingText1, Mode=OneWay}" TextWrapping="Wrap" Foreground="White" Margin="0,10" FontSize="{StaticResource PhoneFontSizeMediumLarge}" />
<TextBlock Name="TextBlock5" Text="{Binding Source={StaticResource LocalizedStrings}, Path=Localizedresources.IntroGreetingText2, Mode=OneWay}" TextWrapping="Wrap" Foreground="White" Margin="0,10" FontSize="{StaticResource PhoneFontSizeMediumLarge}" />
</StackPanel>
<Button Grid.Row="1" Name="CloseGreetingWindow" Content="close" Foreground="White" HorizontalAlignment="Right" BorderBrush="White" Click="CloseGreetingWindow_Click" />
</Grid>
</Border>
</telerikPrimitives:RadWindow>
0
George
Top achievements
Rank 1
answered on 17 Oct 2011, 12:58 PM
I now have a demo solution that reproduces the problem SOMETIMES!

It's strange but it only happens once every 5-6 "Restarts" (CTRL+SHIFT+F5 in studio)...

How can I send you the solution? I can only attach images...
Do you want a URL to download it?

0
Victor
Telerik team
answered on 18 Oct 2011, 02:57 PM
Hello George,

 We already have a sample application that was sent by another user. We are working on finding the issue.
Thank you for your feedback.

Regards,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Victor
Telerik team
answered on 19 Oct 2011, 09:13 AM
Hello George,

 Please try opening the window at a later stage of the application lifecycle, for example in the Loaded event handler of the page. It is guaranteed that the window will find its panel when the visual tree is fully loaded. We will see what can be done so that the window opens correctly regardless of the time IsOpen is set to true.

Please write again if you need further assistance.

All the best,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
George
Top achievements
Rank 1
answered on 19 Oct 2011, 10:02 AM
Problem solved!
Thank you...
0
Martin
Top achievements
Rank 1
answered on 02 Jun 2012, 03:52 PM
Can we get more details on why and when that exception would occur? I am facing the exact same issue where the exception described above is thrown randomly when my app start.

Below is the exception I am getting:

   at Telerik.Windows.Controls.RadWindow.TryOpen()
   at Telerik.Windows.Controls.RadWindow.Open()
   at Telerik.Windows.Controls.RadWindow.<>c__DisplayClass5.<TryOpen>b__4(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)

0
Victor
Telerik team
answered on 04 Jun 2012, 07:11 AM
Hello Martin,

Thanks for writing.
This exception is thrown when RadWindw tries to open but fails to find a Panel instance in the page's element tree. RadWindow needs this panel in order to work properly and in the very early stages of the app startup, the visual tree is not loaded yet so the search fails.

The stack trace you provided does tell during which event you are opening the window. Is it possible to explain in a little more detail how you are using RadWindow? During page loaded you should be able to open it without problems.

Also, please note that in the latest version of the controls, which will be released this Wednesday, RadWindow no longer throws this exception, but fires an OpenFailed event instead.

Please write again if you need further assistance.

Regards,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Martin
Top achievements
Rank 1
answered on 04 Jun 2012, 12:27 PM
Hello Victor, 

I am not using explicitly the RadWindow control in my code (i.e. if I do a search across all the file for RadWindow, there's no occurences found). That's why I am a bit puzzeled by that error. I am using RadPhoneApplicationFrame, RadHubTile, RadCustomHubTile, RadToggleSwitch, InteractionEffectManager, and RadRateApplicationReminder. That's all... 

Martin
0
Victor
Telerik team
answered on 05 Jun 2012, 07:03 AM
Hello Martin,

In this case, RadRateApplicationReminder is using RadWindow internally. Please post more details about your usage of RadRateApplicationReminder. A sample application which crashes with the exception would be best. This way I will be able to advise you what you can tweak in order to avoid it.
I am looking forward to your reply.

All the best,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Martin
Top achievements
Rank 1
answered on 05 Jun 2012, 01:00 PM
I am instantiating the RadRateApplicationReminder inside the constructor of my first/main page of my app (see code below). Should I move it to the Loaded event? I'll try to get you a sample app that has the same behavior, but it might be complex since I am getting that exception approximately once every 10/15 application startup.

public partial class MainPage : PhoneApplicationPage
{
    static MainPage()
    {
        InteractionEffectManager.AllowedTypes.Add(typeof(RadHubTile));
        InteractionEffectManager.AllowedTypes.Add(typeof(RadCustomHubTile));
    }
 
    public MainPage()
    {
        this.InitializeComponent();
 
        RadRateApplicationReminder rateReminder = new RadRateApplicationReminder();
        rateReminder.RecurrencePerUsageCount = 5;
        rateReminder.Notify();
    }
 
    private void PhoneApplicationPage_Loaded(object sender, System.Windows.RoutedEventArgs e)
    {
    // ...
    }
}
0
Victor
Telerik team
answered on 06 Jun 2012, 06:35 AM
Hi Emanuel,

Yes, try in the Loaded event, it should work ok then.
Should you need further assistance, we're ready to provide it.

Kind regards,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Window
Asked by
emi
Top achievements
Rank 1
Answers by
Victor
Telerik team
George
Top achievements
Rank 1
emi
Top achievements
Rank 1
Robert
Top achievements
Rank 1
Martin
Top achievements
Rank 1
Share this question
or