locked
Parameter is incorrect exception when moving mouse wheel up and down

    Question

  • I get an exception when I scroll the mouse wheel up and down.  Any idea how to prevent this?  The exact error is: "The parameter is incorrect.\r\n\r\nThe parameter is incorrect.\r\n"

    Wednesday, December 17, 2014 5:32 PM

All replies

  • Can you add a code sample please?

    Any events you have attached to scrolling behaviour or anything similar would be a good starting point.

    Wednesday, December 17, 2014 6:11 PM
  • Thats the problem, I haven't added any events for scrolling or mouse handling.  The exception stack doesn't show much either, no stack trace.

    I was able to pin it down to a usercontrol that has an empty FlipView.  If I move the mouse wheel over the empty FlipView, then it crashes.  If the FlipView has content, then all is good.

    Here is where I use my usercontrol, called GameBoardCollection.

           <Grid Grid.Column="0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
    
                <AppBarButton Grid.Row="0" x:Name="GBC_BTN_Flip" Label="Flip" Click="GBC_BTN_Flip_Click"/>
                <Border BorderBrush="Yellow" BorderThickness="10" Grid.Row="1" Width="200">
                    <Controls:GameBoardCollection x:Name="GBC_GameBoards" Margin="40"/>
                </Border>
            </Grid>

    Here is my GameBoardCollection xaml, very simple and I've not defined any event handling in the xaml or in the code-behind.  I programmatically add or remove different usercontrols into the FlipView as needed.

    <UserControl
        x:Class="Schaak.Controls.GameBoardCollection"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:Schaak.Controls"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        d:DesignHeight="300"
        d:DesignWidth="400">
    
        <FlipView x:Name="FPV_Boards">
        </FlipView>
    </UserControl>


    Thursday, December 18, 2014 3:59 PM
  • To add to this, the problem is completely reproducible.  I was able to reproduce this by creating a blank app.  Do the following in visual studio 2013

    1. Select New Project
    2. Choose C# -> Store Apps -> Windows Apps -> Blank App (Windows)
    3. Add an empty FlipView to the default Grid in MainPage.xaml.
    4. Run under debugger
    5. Scroll the mousewheel

    Here is the MainPage.xaml

    <Page
        x:Class="BrokenMouseWheel.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:BrokenMouseWheel"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">
    
        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
            <FlipView BorderBrush="Wheat" BorderThickness="10">
                
            </FlipView>
    
        </Grid>
    </Page>
    

    Thursday, December 18, 2014 4:06 PM
  • Are you getting a first chance exception handled in the framework or an actual crash? If the former then you should be able to just ignore it. The cause is probably trying to flip to the next page but failing since there aren't any pages.

    I wasn't able to reproduce any problem on Windows 10 Technical Preview with your empty FlipView Xaml. I don't have a Windows 8.1 system handy at the moment to test on.

    --Rob

    Friday, December 19, 2014 1:24 AM
    Owner
  • Sorry, I'm not familiar with the term "first chance exception", but I think I can guess.  Looks like this is an unhandled exception in the framework itself.  The debugger breaks in App.g.i.cs here:

    #if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
                UnhandledException += (sender, e) =>
                {
                    if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
                };
    #endif

    For the time being, I've found a way to workaround this which works for me, but maybe not for others.  I set the FlipView to disabled until I add something to it.  This works out okay for now.

    Friday, December 19, 2014 4:58 PM
  • I am getting the same issue with a plain old textbox but typing in chinese characters with the normal windows 8.1 chinese input method. This is a windows 8.1 metro app. 
    Tuesday, March 31, 2015 4:00 AM