microsoft / microsoft/AL

XmlDocument.SelectSingleNode sets GetLastErrorText() even if the return value is used and no runtime error occurs

Open
#6,159 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PowerShell
Stars
881
Forks
285
Avg merge
3d 36m
Merged PRs (30d)
1

Description

Describe the bug
I use XmlDocument.SelectSingleNode to select a XmlNode. I use the optional return value to check if the XmlNode was found.
If the node dosen't exists, no runtime error will be raised, but GetLastErrorText contains neverthless the Error Message.

To Reproduce
check := XmlDoc.SelectSingleNode('//test', XmlTableNode);

Expected behavior
There is no runtime error, if the node is not found.
GetLastErrorText is empty.

I expected, that if no runtime error will be raised, that also GetLastErrorText has no value.

5. Versions:

  • AL Language: 5.0.335750
  • Business Central: Version: DE Business Central 16.5 (Plattform 16.0.15884.15941 + Application 16.5.15953.0)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with XmlDocument.SelectSingleNode using the provided check snippet and an absent node. Verify that the optional return value indicates no node, no runtime error occurs, and GetLastErrorText remains empty; the issue does not name a source file or test to inspect.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.