Skip to content

TransasctionEvent req w/o meterValues fails to be FormationViolation#77

Open
KSR-Yasuda wants to merge 1 commit intodallmann-consulting:mainfrom
KSR-Yasuda:bugfix/NullRefInTransactionEventRes
Open

TransasctionEvent req w/o meterValues fails to be FormationViolation#77
KSR-Yasuda wants to merge 1 commit intodallmann-consulting:mainfrom
KSR-Yasuda:bugfix/NullRefInTransactionEventRes

Conversation

@KSR-Yasuda
Copy link

TransactionEvent request with no meterValues property fails to be replied FormationViolation.

// Request to OCPP.Core
// Has no `meterValues` prop.
[
    2,
    "OCPP_MSG_3735759508",
    "TransactionEvent",
    {
        "eventType": "Started",
        "timestamp": "2022-12-31T23:00:06",
        "triggerReason": "CablePluggedIn",
        "seqNo": 6270,
        "transactionInfo": {
            "transactionId": "test-id"
        }
    }
]

// Response from OCPP.Core
[
    4,
    "OCPP_MSG_3735759508",
    "FormationViolation",
    "",
    {}
]
// `OCPP.Core.Server.dll` Log

info: OCPPMiddleware.OCPP20[0]
      OCPPMiddleware.Receive20 => OCPP-Message: Type=2 / ID=OCPP_MSG_3735759508 / Action=TransactionEvent)

fail: OCPP.Core.Server.ControllerOCPP20[0]
      TransactionEvent => Exception: Object reference not set to an instance of an object.
      System.NullReferenceException: Object reference not set to an instance of an object.
         at OCPP.Core.Server.ControllerOCPP20.GetMeterValues(ICollection`1 meterValues, Double& meterKWH, Double& currentChargeKW, Double& stateOfCharge, Nullable`1& meterTime) in /xxxxxx/OCPP.Core/OCPP.Core.Server/ControllerOCPP20.TransactionEvent.cs:line 331
         at OCPP.Core.Server.ControllerOCPP20.HandleTransactionEvent(OCPPMessage msgIn, OCPPMessage msgOut) in /xxxxxx/OCPP.Core/OCPP.Core.Server/ControllerOCPP20.TransactionEvent.cs:line 60

meterValues prop of TransactionEvent req is optional, however, without it,
it fails in GetMeterValues() in foreach for meterValues of null-reference.

Besides, ahead of there, it can fail if ChargeTag ct is null, too.

At least, these two parts should be null-value considered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant