Skip to content

Upgrade to ClosedXML 0.100.3 #305

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

Closed

Conversation

myomintin
Copy link

Upgrade to ClosedXML v 0.100.3

using System.Collections.Generic;
using System.Text;

namespace ClosedXML.Report.Utils;
Copy link
Contributor

Choose a reason for hiding this comment

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

Feature 'file-scoped namespaces' is not available. Please use language version 10.0 or greater.

Copy link
Contributor

Choose a reason for hiding this comment

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

Current version is 7

Choose a reason for hiding this comment

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

Using latest for LangVersion should use the highest compatible C# for the targeted framework, no need to set to an explicit version number.

Copy link
Contributor

@vbondarev vbondarev Mar 28, 2023

Choose a reason for hiding this comment

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

One of the supported frameworks is net462 which doesn't support c# 11. Change language version to the Latest and try to compile.

Choose a reason for hiding this comment

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

I have tried with latest, and it builds, even on net462: of course using language features not supported by net462 is gonna fail whatever the language version specified, so I would try to keep it as wide as possible by using latest.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was wrong. If I set the Latest version is OK, but if I set the version is 11 I get the compile error Invalid option '11' for /langversion. Use '/langversion:?' to list supported values.

Choose a reason for hiding this comment

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

csc /langversion:? by me is listing 11 as the latest (and default version, so I think now can be omitted to get the latest).
csc /version gives 4.5.0-6.23128.14 (651d32d8)

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I don't have .net 4.62 on my development machine.
Please wrap IXLCellExtensions class into namespace ClosedXML.Report.Utils.

@@ -64,6 +66,27 @@ public IXLCell WriteValue(object value, IXLCell settingCell)
return xlCell;
}

public IXLCell WriteCellValue(XLCellValue value, IXLCell settingCell)
Copy link
Contributor

Choose a reason for hiding this comment

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

Method 'WriteCellValue' return value is never used.

Copy link
Author

@myomintin myomintin Mar 31, 2023

Choose a reason for hiding this comment

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

Yes, 'WriteCellValue' return value is never used now. It's method overloading as WriteValue(object value, IXLCell settingCell).

@@ -237,7 +237,7 @@ private void MoveSummary(MoveData moveData)
return;

trgtRng.Clear();
fcell.Value = srcRng;
fcell.CopyFrom(srcRng); //fcell.Value = srcRng;
Copy link
Contributor

@vbondarev vbondarev Mar 23, 2023

Choose a reason for hiding this comment

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

Please remove all your commented text. We have git )

Copy link
Author

@myomintin myomintin Mar 31, 2023

Choose a reason for hiding this comment

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

I removed my comments and then pushed it again.

Copy link
Contributor

Choose a reason for hiding this comment

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

I cloned the branch and got the next error:

 ClosedXML.Report.Tests.csproj: [NU1605] Warning As Error: Detected package downgrade: System.Linq.Dynamic.Core from 1.3.1 to 1.2.20. Reference the package directly from the project to select a different version. 
 ClosedXML.Report.Tests -> ClosedXML.Report -> System.Linq.Dynamic.Core (>= 1.3.1) 
 ClosedXML.Report.Tests -> System.Linq.Dynamic.Core (>= 1.2.20)

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed error and run all tests:

image

Copy link

@Ulisse67 Ulisse67 Apr 6, 2023

Choose a reason for hiding this comment

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

Cannot say for all tests, but for this the test should be fixed:
image

It has to do with Cell.Value now being an XLCellValue type where before was object.
Same here:
image

@Pankraty
Copy link
Member

Closed via #307.

@mymintin thank you for the try! Unfortunately, this particular upgrade turned out to be way harder than a usual "bump all dependencies up".

@Pankraty Pankraty closed this Jul 26, 2023
@myomintin myomintin deleted the UpgradeToClosedXML_0.100.3 branch July 8, 2024 05:27
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