Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
bulent  
#1 Posted : Monday, February 19, 2018 5:18:04 AM(UTC)
bulent

Rank: Newbie

Groups: Member
Joined: 2/19/2018(UTC)
Posts: 9

When I call the writer.GetGraphics() method:

Code:
System.TypeInitializationException
  HResult=0x80131534
  Message=The type initializer for 'Aurigma.GraphicsMill.AdvancedDrawing.FontRegistry' threw an exception.
  Source=Aurigma.GraphicsMill
  StackTrace:
   at Aurigma.GraphicsMill.AdvancedDrawing.FontRegistry.get_Installed()
   at Aurigma.GraphicsMill.AdvancedDrawing.Graphics..ctor(PdfWriter pdf)
   at Aurigma.GraphicsMill.Codecs.PdfWriter.GetGraphics()
    at Test.Program.Main(String[] args) in C:\Working\SheetGenerator\Test\Program.cs:line 89

Inner Exception 1:
SEHException: External component has thrown an exception.


Fedor  
#2 Posted : Monday, February 19, 2018 8:27:05 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Could you post a code snippet so we could reproduce hte problem?
Best regards,
Fedor Skvortsov
bulent  
#3 Posted : Monday, February 19, 2018 9:15:53 AM(UTC)
bulent

Rank: Newbie

Groups: Member
Joined: 2/19/2018(UTC)
Posts: 9

I'm using x64 binaries, here is my code snippet:

Code:
Graphics graphics;
PdfWriter writer = null;
Bitmap bm;

writer = new Aurigma.GraphicsMill.Codecs.PdfWriter("test.pdf");

int en = 2480;
int boy = 3508;
bm = new Bitmap(en, boy, PixelFormat.Format24bppRgb, RgbColor.White);

writer.AddPage(bm.Width, bm.Height);
graphics = writer.GetGraphics();
Eugene Kosmin  
#4 Posted : Monday, February 19, 2018 4:38:44 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Hi,

I've tested your snippet, and it works fine.

So, the next steps are:
  • Get the latest version if you don't have it yet. At the moment, 9.3.15 is the last one.
  • If not helps, try to figure out what font causes the exception. Here is a small snippet for filling CustomFontRegistry with files from your windows fonts directory one by one. Probably you should get the same exception.
    Code:
    var fr = new CustomFontRegistry();
    
    var fonts = System.IO.Directory
                .GetFiles(@"c:\windows\Fonts\", "*.*")
                .Where(file => (file.ToLower().EndsWith(".otf") || file.ToLower().EndsWith(".ttf") || file.ToLower().EndsWith(".pfb")))
                .ToList();
    
    foreach (var font in fonts)
    {
        Console.WriteLine(font);
        fr.Add(font);
    }
  • Try to uninstall that font from your system. If everything works fine, please send us this file.
Best regards,
Eugene Kosmin
The Aurigma Development Team
bulent  
#5 Posted : Monday, February 19, 2018 10:25:34 PM(UTC)
bulent

Rank: Newbie

Groups: Member
Joined: 2/19/2018(UTC)
Posts: 9

var fr = new CustomFontRegistry();

line throws the exception now:

Code:
System.TypeInitializationException
  HResult=0x80131534
  Message=The type initializer for 'Aurigma.GraphicsMill.AdvancedDrawing.FontRegistry' threw an exception.
  Source=Aurigma.GraphicsMill
  StackTrace:
   at Aurigma.GraphicsMill.AdvancedDrawing.FontRegistry..ctor()
   at Test.Program.Main(String[] args) in C:\Working\SheetGenerator\Test\Program.cs:line 17

Inner Exception 1:
SEHException: External component has thrown an exception.


X64 Console app with .NET 4.5.2 as target framework. I also tried the old versions and here is my result:
9.2.23: works without problem
9.3.07: throws exception
9.3.11: throws exception
9.3.15: throws exception
Eugene Kosmin  
#6 Posted : Tuesday, February 20, 2018 1:25:20 AM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Is it possible for you to send us the content of your c:\windows\font folder? I'm afraid it is the fastest way...
You can use this link to upload the files directly to our DropBox account if you want.
https://www.dropbox.com/...est/JnG3fjaEVpkqJxbuiws2
Best regards,
Eugene Kosmin
The Aurigma Development Team
bulent  
#7 Posted : Tuesday, February 20, 2018 11:32:10 AM(UTC)
bulent

Rank: Newbie

Groups: Member
Joined: 2/19/2018(UTC)
Posts: 9

I uploaded my folder to your link. Waiting for your response. But I don't understand why a font file can do this before I select the fonts to use with the library?
Eugene Kosmin  
#8 Posted : Tuesday, February 20, 2018 6:35:56 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Potentially, a font file could be a cause of the failure. At least for the first snippet.

So, I have checked your files with the second snippet on Windows 7/8/10, and there is no success.

In GM 9.3 we changed the underlying library for text handling, and I expect the problem is there. But I need to reproduce it on my side. Could you give me more information about your software environment like OS version, updates installed, Visual Studio redistributables version, antivirus software and so on. By the way, you can try to reinstall VS redist, just in case. Our both setups from the website contain the required redistribution files inside.

And could you also send me a crashing dump? If you have Visual Studio on the target machine, just attach to the process after the crash, then DEBUG -> Save Dump As... If not, try to use ProcDump tools from Sysinternals.

It is easy to use:
Code:
procdump64.exe -i c:\pd_dumps
RunCrashingConsole.exe
procdump64.exe -u

Edited by moderator Monday, February 26, 2018 3:17:11 AM(UTC)  | Reason: Not specified

Best regards,
Eugene Kosmin
The Aurigma Development Team
bulent  
#9 Posted : Wednesday, February 21, 2018 5:28:25 AM(UTC)
bulent

Rank: Newbie

Groups: Member
Joined: 2/19/2018(UTC)
Posts: 9

Hi Eugene,

I uploaded the dump and info files to your previous dropbox folder. Hope this helps. I'm on a trial license now and my first impressions with the library isn't good.

Best Regards,
Bulent.
Eugene Kosmin  
#10 Posted : Thursday, February 22, 2018 1:29:14 AM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Hi Bulent,

I understand your feelings, and I'm sorry for that. Sometimes such things happen, but we do a lot to minimize it as much as possible.

I reproduced your environment on a clean virtual machine, and there was no success too. Actually, your software configuration is pretty close to mine.

I checked the code, and I think I have an idea what could be wrong. I built a test version of GM. Please try to run it on your side. Here is a console application for testing:
https://www.dropbox.com/...estFontRegistry.zip?dl=0
Best regards,
Eugene Kosmin
The Aurigma Development Team
bulent  
#11 Posted : Thursday, February 22, 2018 4:36:26 AM(UTC)
bulent

Rank: Newbie

Groups: Member
Joined: 2/19/2018(UTC)
Posts: 9

Hi Eugene,

I tried your sample and still getting the exception. I debug the test program with reflection and this code goes into the catch block:

Code:
try
{
	<Module>.TextWhizz.FontRegistry.InitFromSystem(<Module>.std.shared_ptr<TextWhizz::FontRegistry>.operator-><class\u0020TextWhizz::FontRegistry,0>(ifwFontRegistry));
}
catch
{
	<Module>.___CxxCallUnwindDtor(ldftn(std.shared_ptr<TextWhizz::FontRegistry>.{dtor}), (void*)(&shared_ptr<TextWhizz::FontRegistry>));
	throw;
}
Eugene Kosmin  
#12 Posted : Friday, February 23, 2018 4:22:58 AM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
OK, here is another version. I removed static constructor from FontRegistry class. Maybe it will give us more details.

https://www.dropbox.com/...tFontRegistry_2.zip?dl=0
Best regards,
Eugene Kosmin
The Aurigma Development Team
bulent  
#13 Posted : Friday, February 23, 2018 10:56:36 PM(UTC)
bulent

Rank: Newbie

Groups: Member
Joined: 2/19/2018(UTC)
Posts: 9

This new version works without any problem. Writes all the font names on screen and finally writing True.
Eugene Kosmin  
#14 Posted : Monday, February 26, 2018 2:12:28 AM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Try the following code:
Code:
InstalledFontRegistry fontRegistry = (InstalledFontRegistry)typeof(InstalledFontRegistry).GetConstructor(
        BindingFlags.NonPublic | BindingFlags.Instance,
        null, Type.EmptyTypes, null).Invoke(null);

foreach (var font in fontRegistry.Fonts)
{
    Console.WriteLine(font.PostscriptName);
}

Does it throw an exception? If yes, send me the dump, please.
Best regards,
Eugene Kosmin
The Aurigma Development Team
bulent  
#15 Posted : Monday, February 26, 2018 2:22:01 AM(UTC)
bulent

Rank: Newbie

Groups: Member
Joined: 2/19/2018(UTC)
Posts: 9

I uploaded the dump file to your dropbox folder
Eugene Kosmin  
#16 Posted : Monday, February 26, 2018 3:45:55 AM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Please try to delete this file.
C:\Windows\Fonts\XaraFont.fon

Then run the console again.
Best regards,
Eugene Kosmin
The Aurigma Development Team
bulent  
#17 Posted : Monday, February 26, 2018 4:02:18 AM(UTC)
bulent

Rank: Newbie

Groups: Member
Joined: 2/19/2018(UTC)
Posts: 9

Now working
Eugene Kosmin  
#18 Posted : Monday, February 26, 2018 6:29:19 AM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
That's great! The fix will be available in the next release.
Best regards,
Eugene Kosmin
The Aurigma Development Team
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.