user4954249
user4954249

Reputation:

Win32 Exception in Bin Folder

Do you have to have something special to run the .exe that gets outputted in the Bin folder? When trying to run the .exe as Admin it just crashes and with an unhandled win32 exception.

Upvotes: 2

Views: 119

Answers (1)

Xie Steven
Xie Steven

Reputation: 8611

When I attempt to run the code it stretches the group box that makes the GUI look terrible. What in the .XAML could cause something like this?

You used Margin property to control your XAML control's position, it will lead to the messy layout you see.

Please see Layout document to learn how to make a good layouts with XAML in UWP.

For example, you could simply use a Grid control to put these controls on different row and column.

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition></ColumnDefinition>
        <ColumnDefinition></ColumnDefinition>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"></RowDefinition>
        <RowDefinition Height="4*"></RowDefinition>
        <RowDefinition Height="4*"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
    </Grid.RowDefinitions>
    <ComboBox HorizontalAlignment="Center" Grid.Row="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Height="42" Width="232"/>
    <ListView x:Name="DatabaseInfo" Grid.Row="1" Grid.Column="0" Header="Database Info." BorderThickness="2" BorderBrush="Black" SelectionMode="None" FontFamily="Tahoma" >
        <ListView.HeaderTemplate>
            <DataTemplate>
                <ListViewHeaderItem Content="{Binding}" Height="40" />
            </DataTemplate>
        </ListView.HeaderTemplate>

        <StackPanel Width="230" Height="30" Orientation="Horizontal" >
            <TextBlock Name="ServerNameDisplay" HorizontalAlignment="Left" Text="Server" Width="115" Height="25" />
            <TextBox Name="Server" HorizontalAlignment="Right" Text="" Height="25" Width="115" />
        </StackPanel>

        <StackPanel Width="230" Height="30" Orientation="Horizontal" >
            <TextBlock Name="DatabaseNameDisplay" HorizontalAlignment="Left" Text="Database" Width="115" Height="25" />
            <TextBox Name="Database" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
        </StackPanel>
        <StackPanel Width="230" Height="30" Orientation="Horizontal" >
            <TextBlock Name="UserNameDisplay" HorizontalAlignment="Left" Text="UserName" Width="115" Height="25" />
            <TextBox Name="UserName" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
        </StackPanel>
        <StackPanel Width="230" Height="30" Orientation="Horizontal" >
            <TextBlock Name="PasswordDisplay" HorizontalAlignment="Left" Text="Password" Width="115" Height="25" />
            <TextBox Name="Password" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
        </StackPanel>
    </ListView>
    <ListView x:Name="RabbitMQInfo" Grid.Row="1" Grid.Column="1" Header="Rabbit MQ Info." BorderThickness="2" BorderBrush="Black" SelectionMode="None" FontFamily="Tahoma" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
        <ListView.HeaderTemplate>
            <DataTemplate>
                <ListViewHeaderItem Content="{Binding}" Height="40" />
            </DataTemplate>
        </ListView.HeaderTemplate>
        <StackPanel Width="230" Height="30" Orientation="Horizontal" >
            <TextBlock Name="RabbitMQUserDisplay" HorizontalAlignment="Left" Text="UserName" Width="115" Height="25" />
            <TextBox Name="RabbitMQUser" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
        </StackPanel>
        <StackPanel Width="230" Height="30" Orientation="Horizontal" >
            <TextBlock Name="RabbitMQPassDisplay" HorizontalAlignment="Left" Text="Password" Width="115" Height="25" />
            <TextBox Name="RabbitMQPass" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
        </StackPanel>
    </ListView>
    <ListView x:Name="MachineInfo" Grid.Row="2" Grid.Column="0" Header="Name Info." BorderThickness="2" BorderBrush="Black" SelectionMode="None" FontFamily="Tahoma" >
        <ListView.HeaderTemplate>
            <DataTemplate>
                <ListViewHeaderItem Content="{Binding}" Height="40" />
            </DataTemplate>
        </ListView.HeaderTemplate>
        <StackPanel Width="230" Height="30" Orientation="Horizontal" >
            <TextBlock Name="NameDisplay" HorizontalAlignment="Left" Text="Name" Width="115" Height="25" />
            <TextBox Name="Name" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
        </StackPanel>
    </ListView>
    <ListView x:Name="IPAddressInfo" Grid.Row="2" Grid.Column="1" Header="IP Address Info." BorderThickness="2" BorderBrush="Black" SelectionMode="None" FontFamily="Tahoma" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
        <ListView.HeaderTemplate>
            <DataTemplate>
                <ListViewHeaderItem Content="{Binding}" Height="40" />
            </DataTemplate>
        </ListView.HeaderTemplate>
        <StackPanel Width="230" Height="30" Orientation="Horizontal" >
            <TextBlock Name="IPAddressDisplay" HorizontalAlignment="Left" Text="IPAddress" Width="115" Height="25" />
            <TextBox Name="IPAddress" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
        </StackPanel>
        <StackPanel Width="230" Height="30" Orientation="Horizontal">
            <TextBlock Name="PortDisplay" HorizontalAlignment="Left" Text="Port" Width="115" Height="25" />
            <TextBox Name="Port" HorizontalAlignment="Right" Text="" Height="25" Width="115"/>
        </StackPanel>
    </ListView>
    <Button x:Name="btnSave" Content="Save"  Grid.Row="3" Grid.ColumnSpan="2"  HorizontalAlignment="Center"  VerticalAlignment="Center" Width="100" Height="50"/>
</Grid>

Another question I have about UWP applications is do you have to have something special to run the .exe that gets outputted in the Bin folder? When trying to run the .exe as Admin it just crashes and with an unhandled win32 exception.

UWP runs in sandbox, it's different from the classic desktop application. You cannot directly double click the '.exe' file to start it. When you're coding in visual studio, you could press F5 to start it and debug it. If it has been deployed, you could start it from windows 'Start' menu.

Tips: Please do not post multiple question in one post next time.

Upvotes: 0

Related Questions