以下代码在 vb.net 中生成了这两个故障排除提示,代码构建没有错误。本地窗口将 OrderContext 下的所有内容列为“Nothing”、0.0 或“False”,当它停止在尝试设置 address1 的行上时。
“使用 new 关键字创建对象实例。”
“在调用方法之前检查确定对象是否为空。”
Imports TPETest.com.nicusa.cdc.tpe2_ks
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim PEService As New PaymentEngineService
Dim OrderContext() As com.nicusa.cdc.tpe2_ks.WSOrderContext
OrderContext.customer.address.address1 = "1233 Test Dr."
OrderContext.customer.address.city = "City"
OrderContext.customer.address.state = "KS"
OrderContext.customer.address.zip = "66099"
OrderContext.attributes.SetValue("John Smith", 1)
OrderContext.attributes.SetValue("1233 Test Dr", 2)