Skip to content

Conversation

@xuzhg
Copy link
Member

@xuzhg xuzhg commented Oct 17, 2025

ODL will remove 'ReadUntypedAsString',

However, ASP.NET Core OData is used in OData.Net E2E test case which 'temporally' set the 'ReadUntypedAsString=false'.

For back-compatibility, We don't remove it completely in current version and let's use the reflection to replace the property setting directly.

In the next major version, let's remove such codes.

I don't think it's a bigger performance.

I do update the version to 9.4.1 and will use this version in the OData.NET E2E test cases.

xuzhg added 2 commits October 17, 2025 11:07
…ed in the next version.

However, the ASP.NET Core OData library is used in OData.NET E2E test cases for ODL 8.x and ODL 9.x.
To keep the existing behavior, we still need to set ReadUntypedAsString=false via reflection.
@mikepizzo
Copy link
Member

I don't understand why we need this -- ReadUntypedAsString="false" should be the default. That is, once we fully deprecate read untyped as string, ODL should never read untyped as string -- it should always read as structured.

So why do we need to set a flag through reflection to do what should be the default?

Copy link
Member

@mikepizzo mikepizzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReadUntypedAsString=false should be the default when we remove the property from ODL. We shouldn't need to set it to false.

@xuzhg
Copy link
Member Author

xuzhg commented Oct 17, 2025

I don't understand why we need this -- ReadUntypedAsString="false" should be the default. That is, once we fully deprecate read untyped as string, ODL should never read untyped as string -- it should always read as structured.

So why do we need to set a flag through reflection to do what should be the default?

@mikepizzo

ASP.NET Core OData 9.x depends on ODL 8.x version, ODL 8.x version has:

  1. ReadUntypedAsString property on ODataMessageReaderSettings, but decorated as Obsolete.
  2. By default, this property is set to true/false based on the version. See details at: https://github.com/OData/odata.net/blob/main/src/Microsoft.OData.Core/ODataMessageReaderSettings.cs#L56

I think that's why we still need 'ReadUntypedAsString="false"' in the code.

@xuzhg
Copy link
Member Author

xuzhg commented Oct 17, 2025

ReadUntypedAsString=false should be the default when we remove the property from ODL. We shouldn't need to set it to false.

@mikepizzo So, do you think 'https://github.com/OData/odata.net/blob/main/src/Microsoft.OData.Core/ODataMessageReaderSettings.cs#L56' is wrong?

@xuzhg
Copy link
Member Author

xuzhg commented Oct 21, 2025

/AzurePipelines run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@mikepizzo
Copy link
Member

mikepizzo commented Oct 22, 2025

ReadUntypedAsString=false should be the default when we remove the property from ODL. We shouldn't need to set it to false.

@mikepizzo So, do you think 'https://github.com/OData/odata.net/blob/main/src/Microsoft.OData.Core/ODataMessageReaderSettings.cs#L56' is wrong?

@xuzhg -- Yes -- as part of deprecating ReadUntypedAsString, we should always default to false (that is, we should always read untyped as structured values). We should never read untyped values as raw strings, regardless the OData version. Whether or not to read as string really isn't dependent upon the version -- we just added that so that, at least for new payload versions, we would never have the problem. Deprecating was removing that behavior from all versions.

@xuzhg
Copy link
Member Author

xuzhg commented Oct 22, 2025

ReadUntypedAsString=false should be the default when we remove the property from ODL. We shouldn't need to set it to false.

@mikepizzo So, do you think 'https://github.com/OData/odata.net/blob/main/src/Microsoft.OData.Core/ODataMessageReaderSettings.cs#L56' is wrong?

@xuzhg -- Yes -- as part of deprecating ReadUntypedAsString, we should always default to false (that is, we should always read untyped as structured values). We should never read untyped values as raw strings, regardless the OData version. Whether or not to read as string really isn't dependent upon the version -- we just added that so that, at least for new payload versions, we would never have the problem. Deprecating was removing that behavior from all versions.

Yes, That's the 'fix' required in ODL. Before that fix, this is the workaround to set the 'ReadUntypedAsString' = false always and we can use the latest ASP.NET Core OData version to develop ODL 8.x and ODL 9.x version.

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.

4 participants