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

MissingMethodException: SixLabors.Fonts #2146

Closed
2 of 6 tasks
hobwell opened this issue Aug 14, 2023 · 4 comments
Closed
2 of 6 tasks

MissingMethodException: SixLabors.Fonts #2146

hobwell opened this issue Aug 14, 2023 · 4 comments
Milestone

Comments

@hobwell
Copy link

hobwell commented Aug 14, 2023

Read and complete the full issue template

Do not randomly delete sections. They are here for a reason.

Do you want to request a feature or report a bug?

  • Bug
  • Feature
  • Question

Did you test against the latest CI build?

  • Yes
  • No

If you answered No, please test with the latest development build first.

Version of ClosedXML

e.g. 0.102.0

What is the current behavior?

When calling worksheet.Rows().AdjustToContents() an exception is thrown:

System.MissingMethodException: 'Method not found: 'System.Collections.Generic.IEnumerable`1<SixLabors.Fonts.GlyphMetrics> SixLabors.Fonts.FontMetrics.GetGlyphMetrics(SixLabors.Fonts.Unicode.CodePoint

This appears to be related to the recent Release build of SixLabors.Fonts (2023-08-11). Reverting to SixLabors.Fonts version 1.0.0-beta19 resolves the issue.

What is the expected behavior or new feature?

Row heights would be adjusted to accommodate cell text.

Is this a regression from the previous version?

No, it appears to be related to the latest release of SixLabors.Fonts

Reproducibility

This is an important section. Read it carefully. Failure to do so will cause a 'RTFM' comment.

Without a code sample, it is unlikely that your issue will get attention. Don't be lazy. Do the effort and assist the developers to reproduce your problem. Code samples should be minimal complete and verifiable. Sample spreadsheets should be attached whenever applicable. Remove sensitive information.

Code to reproduce problem:

public void Main()
{
	XLWorkbook wb = new XLWorkbook();
	IXLWorksheet ws = wb.Worksheets.Add("SixLaborsFault");
	ws.Cell("A1").Value = "Short";
	ws.Cell("B1").Value = "Long";

	ws.Cell("A2").Value = "short";
	ws.Cell("B2").Value = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";

	ws.Rows(1, 2).AdjustToContents();
}
  • I attached a sample spreadsheet. (You can drag files on to this issue)
@wagnerbsouza
Copy link

wagnerbsouza commented Aug 17, 2023

I'm getting a similar message:

System.MissingMethodException: 
'Method not found: 
'System.Collections.Generic.IEnumerable`1<SixLabors.Fonts.GlyphMetrics> 
SixLabors.Fonts.FontMetrics.GetGlyphMetrics(SixLabors.Fonts.Unicode.CodePoint, SixLabors.Fonts.ColorFontSupport)'.'

That happens when I try to new XLWorkbook(stream), where stream is a System.IO.Stream.
In my case, I went from ClosedXML version 0.93.1 to 0.102.0
Apparently it "breaks" from version 0.100.3 (good) to 0.101.0 (bad).

The project I have is in .NETFramework 4.7.2, although we are planning on migrating to .NET7, which somehow might fix things with SixLabors.Fonts.

@dellos
Copy link

dellos commented Aug 18, 2023

I got the same error message.

using Version: 101 and 102

Project: asp.net web form, .NET Framework 4.7.2

Code:

  IXLWorksheet ws = wb.Worksheets.Add(dataTable,"test");
  ws.Columns().AdjustToContents();

I found that older versions like 75 works just fine with .NET Framework 4.7.2

@troybda
Copy link

troybda commented Aug 18, 2023

I received the same error when trying to open an existing excel file with 102 and .NET Framework 4.7.2.
The method GetGlyphMetrics in SixLabors.Fonts.FontMetrics version 1.0.0 was updated with a few more parameters and that is what is causing the error.

Like hobwell stated above I uninstalled ClosedXML 102 and the uninstalled SixLabors.Fonts 1.0.0 and then installed SixLabors.Fonts 1.0.0-beta19 and then installed ClosedXML 102 again and it works now.

@jahav
Copy link
Member

jahav commented Aug 18, 2023

NuGet hates (ignores) beta release with package.config. That means it resolves 1.0.0. instead of beta19 leading to breakdown due to several breaking changes.

Fixed in #2149 and I am making a 0.102.1 release.

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

No branches or pull requests

5 participants