Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException when calling Dbosoft.YaNco.Table.GetTypeDescription() method #260

Closed
prodehghan opened this issue Oct 27, 2023 · 1 comment · Fixed by #261
Closed
Labels
bug Something isn't working

Comments

@prodehghan
Copy link
Contributor

Call stack:

at Dbosoft.YaNco.Internal.Api.GetTypeDescription(IDataContainerHandle dataContainer, RfcErrorInfo& errorInfo) in /src/YaNco.Core/Internal/Api.cs:line 79
at Dbosoft.YaNco.RfcRuntime.GetTypeDescription(IDataContainerHandle dataContainer) in /src/YaNco.Core/RfcRuntime.cs:line 167
at Dbosoft.YaNco.DataContainer.GetTypeDescription() in /src/YaNco.Core/DataContainer.cs:line 53

What is null?

The dataContainer that is passed to Api.GetTypeDescription is null.

Why?

In RfcRuntime.cs, line 167 we have:

ITypeDescriptionHandle handle = Api.GetTypeDescription(dataContainer as Internal.IDataContainerHandle, out var errorInfo);

Both StructureHandle and FunctionHandle classes implement IDataContainerHandle, but TableHandle class does not. When the GetTypeDescription() method is called on a Table object, since its _handle field does not implement Internal.IDataContainerHandle, the above line of code passes null to the Api.GetTypeDescription.

@prodehghan
Copy link
Contributor Author

The fix is easy. I'll send a PR.

prodehghan added a commit to prodehghan/YaNco that referenced this issue Oct 27, 2023
This fixes `NullReferenceException` when calling `Dbosoft.YaNco.Table.GetTypeDescription()` method.
@fw2568 fw2568 added the bug Something isn't working label Nov 1, 2023
fw2568 pushed a commit that referenced this issue Nov 13, 2023
This fixes `NullReferenceException` when calling `Dbosoft.YaNco.Table.GetTypeDescription()` method.
@fw2568 fw2568 linked a pull request Nov 13, 2023 that will close this issue
@fw2568 fw2568 closed this as completed Nov 13, 2023
fw2568 pushed a commit that referenced this issue Nov 13, 2023
This fixes `NullReferenceException` when calling `Dbosoft.YaNco.Table.GetTypeDescription()` method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants