Skip to content

Fixed NullReferenceException in OpenXmlElement RawOuterXml field #818

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

Merged
merged 7 commits into from
Jan 8, 2021

Conversation

aidilumarov
Copy link
Contributor

The current version of your code:

It sets _rawOuterXml to string.Empty if value is null, but instead of leaving the setter immediately, it resets the field to null at the end of the setter

The changes I made should resolve the issue.

Thanks.

@twsouthwick
Copy link
Member

@aidilumarov Thanks for the catch! Can you add a regression test so that it will be caught in the future?

@twsouthwick
Copy link
Member

@aidilumarov I'd like to get a 2.12.0 release out this week. If you can get some tests in, we'll have this as part of that release.

Also, can you update the CHANGELOG.md to include this?

@twsouthwick twsouthwick reopened this Nov 30, 2020
@ghost
Copy link

ghost commented Dec 19, 2020

CLA assistant check
All CLA requirements met.

@aidilumarov
Copy link
Contributor Author

@twsouthwick Sorry for taking long. I was off for several weeks. I have made the changes you asked for. Kind regards.

Copy link
Member

@twsouthwick twsouthwick left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@twsouthwick twsouthwick left a comment

Choose a reason for hiding this comment

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

Looks like the build is broken. We have warnings as errors on CI builds

CHANGELOG.md Outdated

### Fixed
- Fixed a `System.NullReferenceException` when setting _rawOuterXml field in `DocumentFormat.OpenXml.OpenXml` (#818)
- Added regression tests in `DocumentFormat.OpenXml.Tests.OpenXmlElementTest2` to check for the mentioned exceptions in the future (#818)
Copy link
Member

Choose a reason for hiding this comment

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

This line is unneeded. I try to keep the changelog focused on observable changes to the library

@@ -0,0 +1,7 @@
{
"profiles": {
"DocumentFormat.OpenXml": {
Copy link
Member

Choose a reason for hiding this comment

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

This file and the other one appear unrelated to the change. I believe this is for vs code. If so, happy to take it but would like the rest of the projects supported as well. Best in a separate pr though

@twsouthwick
Copy link
Member

I've taken the liberty of updating the branch so it can be merged

@twsouthwick twsouthwick merged commit 4c19295 into dotnet:master Jan 8, 2021
twsouthwick pushed a commit to twsouthwick/Open-XML-SDK that referenced this pull request Jan 11, 2021
twsouthwick added a commit that referenced this pull request Jan 11, 2021
* Allow rewriting of all malformed URIs regardless of target value (#835)

* Fixed `OpenXmlElement.RawOuterXml` to properly set null values without throwing (#818)

Co-authored-by: Alex Kindle <[email protected]>
Co-authored-by: aidilumarov <[email protected]>
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.

2 participants