This code will refer from toradex side from GPIO access..so always ELSE codition executed

using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Gpio_Demo_Csharp
{
public partial class Form1 : Form
{
IntPtr hGPIO; ///< handle to the GPIO library
bool success;
gpio.uIo pin; ///< define pins to be used as gpio

    public Form1()
    {
        InitializeComponent();
        ///< GUI button and timer code 
        btnOutput.Enabled = false;
        btnInput.Enabled = false;
        btnOn.Enabled = false;
        btnOff.Enabled = false;
        btnDeinit.Enabled = false;
        tmrBtnLevel.Enabled = false;
    }
    /// <summary>
    /// Button event will set respective sodimm number pin as alternate function to GPIO
    /// </summary>
    private void btnSetGpio_Click(object sender, EventArgs e)
    {
        hGPIO = gpio.Gpio_Init(null); ///< Initialize GPIO library.
        if (hGPIO == null)
        {
            MessageBox.Show("Unable to Init gpio");
        }
        success = gpio.Gpio_Open(hGPIO); ///< Initialize gpio library
        if (success == false)
        {
            MessageBox.Show("Unable to Open Gpio \n Check if handle is valid");
        }
        else
        {
            if (txtPin.TextLength == 0)
            {
                MessageBox.Show("Please enter Valid sodimm Number");
                return;
            }
          //  pin.type = (ushort)gpio.tIoType.ioColibriPin;
            pin.type = (ushort)gpio.tIoType.ioApalisPin;

            pin.number = ushort.Parse(txtPin.Text);
            gpio.Gpio_ConfigureAsGpio(hGPIO, pin); ///<configure provided sodimm pin as gpio

            ///< UI funtion Enabled all button
            btnOutput.Enabled = true;
            btnInput.Enabled = true;
            btnDeinit.Enabled = true;
            btnSetGpio.Enabled = false;
        }
    }
    /// <summary>
    /// setting pin direction as output
    /// </summary>
    private void btnOutput_Click(object sender, EventArgs e)
    {
        gpio.Gpio_SetDir(hGPIO, pin, gpio.tIoDirection.ioOutput); 

        ///< GUI code
        btnInput.Enabled = false;
        btnOn.Enabled = true;
        btnOff.Enabled = true;
    }
    /// <summary>
    /// setting pin direction as output
    /// </summary>
    private void btnInput_Click(object sender, EventArgs e)
    {
        gpio.Gpio_SetDir(hGPIO, pin, gpio.tIoDirection.ioInput);

        ///< GUI code
        btnOutput.Enabled = false;
        btnOn.Enabled = false;
        btnOff.Enabled = false;
        tmrBtnLevel.Enabled = true;
    }
    /// <summary>
    /// set gpio logic level to high
    /// </summary>
    private void btnOn_Click(object sender, EventArgs e)
    {
        if (hGPIO == null)
        {
            MessageBox.Show("Configure Pin As GPIO");
        }
        else
        {
            gpio.Gpio_SetLevel(hGPIO, pin, gpio.tIoLevel.ioHigh);
        }
    }
    /// <summary>
    /// Set gpio logic level to low
    /// </summary>
    private void btnOff_Click(object sender, EventArgs e)
    {
        if (hGPIO == null)
        {
            MessageBox.Show("Configure Pin As GPIO");
        }
        else
        {
            gpio.Gpio_SetLevel(hGPIO, pin, gpio.tIoLevel.ioLow);
        }
        
    }
    /// <summary>
    /// DeInit GPIO library
    /// </summary>
    private void btnDeinit_Click(object sender, EventArgs e)
    {
        if (false == gpio.Gpio_Close(hGPIO))
        {
            MessageBox.Show("Error:- Gpio Close");
            return;
        }
        else
        {
            if (false == gpio.Gpio_Deinit(hGPIO))
            {
                MessageBox.Show("Error Deinit GPIO handle");
                return;
            }
        }
        /// GUI code
        btnDeinit.Enabled = false;
        btnOutput.Enabled = false;
        btnInput.Enabled = false;
        btnOn.Enabled = false;
        btnOff.Enabled = false;
        btnSetGpio.Enabled = true;
        tmrBtnLevel.Enabled = false;
        lblPinLevl.Text = "".ToString();
    }

    /// <summary>
    /// Get gpio level loop
    /// </summary>
    private void tmrBtnLevel_Tick(object sender, EventArgs e)
    {
        if (hGPIO == null)
        {
            MessageBox.Show("Configure Pin As GPIO");
            tmrBtnLevel.Enabled = false;
            return;
        }
        else
        {
            lblPinLevl.Text = gpio.Gpio_GetLevel(hGPIO, pin).ToString();
        }
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

}

}

What specific “ELSE” is executed?
That call to GPIO library fails?

line no 25 always check or execute

There is no if in line 25, at least on this listing.
Is the call to Gpio_Init or the one to GPio_Open that fails?
What version of the module are you using?
What release of the libraries?