c# - 空引用异常未处理 C#

标签 c# unhandled-exception

private void StartReadInlay2()
    {
        byte[] cSN = new byte[8];           
        byte[] sw12 = new byte[2];
        string strsw12 = "", errdes = "", result = "";

        test1_2 = new Initialisation();

        test1_2.logmode = Convert.ToInt32(ConfigurationSettings.AppSettings["LogMode"]);
        test1_2.iChipType = GetChipType(lblChipType.Text.Trim());

        //--initialise test
        result = test1_2.Initialise(1, **configXML.fnSamSlot**, configXML, ref cSN, ref sProgress1_2, ref lProcess1_2, ref sw12, ref errdes);
        scSN1_2 = Hex.ToHexString(test1_2.chipID);
        strsw12 = Hex.ToHexString(sw12);

        if (strsw12.Equals("0000"))
            errInlay1_2 = result.ToString();
        else
            errInlay1_2 = result.ToString() + strsw12;

        lProcess1_2 = 2;

        if(!errInlay1_2.Equals(""))
            StatusInlay1_2 = false;
        else
            StatusInlay1_2 = true;
    }

最佳答案

对于初学者来说,您的整个代码示例都是用 C# 编写的,如果您尝试编写 VB.NET 应用程序,肯定会失败。

关于c# - 空引用异常未处理 C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3349674/

相关文章:

c# - InvokeOnMainThread 不适用于 `method group`

c# - 系统.UriFormatException

c++ - 未处理的异常,来源未知

javascript - 未处理的拒绝错误 Bluebird

c# - 如果你使用 async-await 而你的机器只有 1 个处理器会怎样?

c# - 在 ComboBox 中绘制图像和文本

c# - 如何使用 Twitterizer 在 C# 中获取 Twitter 用户时间线

wpf - 在 Microsoft 显示错误消息之前在 Word 加载项中捕获 C# WPF 未处理的异常

Flutter - 格式异常 : Unexpected end of input (at character 1)

.net - DispatcherUnhandledException 和 AppDomain.UnhandledException 何时不足(WPF 应用程序)?