[Mono-devel-list] Strange behavior while enumerating font families

Christoph Feller c_feller at informatik.uni-kl.de
Wed Jul 6 08:55:59 EDT 2005


Hallo,

a strange NullReferenceException occured when i used

Font font = new Font(FontFamily.GenericSansSerif, 10.0f);

two times in (not immediate) succession.

As I couldn't isolate the source of this Exception I wrote this little
Test:

------------------------------------------------------

using System;
using System.Drawing;

public class Test
{
    public static void Main()
    {
        for (int i = 0; i < 20; i++)
        {
            Console.WriteLine(FontFamily.GenericSansSerif.Name);
            foreach(FontFamily f in FontFamily.Families)
            {
                Console.Write(f.Name + ", ");
                //      System.Threading.Thread.Sleep(10);
            }
            Console.WriteLine("");
            Console.WriteLine("-->  Versuch: " + i);
            //System.Threading.Thread.Sleep(1000);
        }
    }
}

------------------------------------------------------------

First I get this output:

Bitstream Vera Sans
Nimbus Mono L, Edgewater, Creature, Bitstream Vera Serif, Nimbus Sans L,
Independence, Century Schoolbook L, Luxi Serif, Beta Dance, mdk_teams,
Electroharmonix, Adventure, Failed Attempt, Courier, Ikarus, Brand New,
Standard Symbols L, Babelfish, Captain Podd, Courier 10 Pitch, Bazaronite,
Utopia, Blue Highway, FakeReceipt, ActionIs, Fadgod, URW Chancery L, Betsy
Flanagan, Raghindi, Bitstream Vera Sans, Golden Girdle, URW Gothic L,
Bitstream Charter, Luxi Sans, A.D. MONO, der Dämonschriftkegel, Blue
Highway Condensed, Die Nasty, Font in a Red Suit, Larabiefont, Binary,
Flubber, Nimbus Sans L Condensed, Bitstream Vera Sans Mono, URW Palladio
L, Luxi Mono, Indigo Joker, Fudd, Dingbats, Ikarus Turbulence, URW Bookman
L, Distortia, Nimbus Roman No9 L, Embargo, Cursor, Ikarus Vulture, Davis,
DirtyBaker'sDozen, malayalam, HydrogenWhiskey, Eli 5.0b, Densmore,

This seems quite right and it is repeated 4 times. But the sixth time the
ending changes into:

Fudd, Dingbatsm Vera S, Ikarus Turbulencens, URW Bookman L, Distortia,
Nimbus Roman No9 L, Embargoam Vera, Cursor Sans , Ikarus Vulture, Davisry
Sc, DirtyBaker'sDozen, malayalame, HydrogenWhiskey, Eli 5.0barmonix,
Densmoree,

Then I get more strange things like:

Nimbus Mono L, Edgewater, Creature Symbols, Bitstream Vera Serif, Nimbus
Sans L, Independenceitch, Century Schoolbook L, Luxi Serifer, Beta Dance,
mdk_teams, Electroharmonixce, Adventurean L, Failed Attempt, CourierRoman
N, Ikaruso, Brand New, Standard Symbols L, Babelfish, Captain PoddDozen,
Courier 10 Pitch, Bazaroniteiskey, Utopia0b, Blue Highway, FakeReceiptera
Sans, ActionIsm Vera S, Fadgod Mono , URW Chancery L, Betsy Flanagan,
Raghindim Vera S, Bitstream Vera Sans, Golden Girdle, URW Gothic L,
Bitstream Charter, Luxi Sans, A.D. MONO, der Dämonschriftkegel, Blue
Highway Condensed, Die Nasty, Font in a Red Suit, Larabiefont, Binary,
Flubber, Nimbus Sans L Condensed, Bitstream Vera Sans Mono, URW Palladio
L, Luxi Mono, Indigo Joker, Fudd, Dingbats, Ikarus Turbulence, URW Bookman
L, Distortia, Nimbus Roman No9 L, Embargo, Cursornite, Ikarus Vulture,
DavisHighw, DirtyBaker'sDozen, malayalam, HydrogenWhiskey, Eli 5.0bcery L,
Densmoreanagan,

And even:

Bitstream Vera Sans
Nimbus Mono L, Edgewater, Creatureoman No9, Bitstream Vera Serif, Nimbus
Sans Là ³ê à ³ëà ³ç¸à ³ç¨à ³çà ³çà ³, Independence, Century Schoolbook
Lâ¹°à µâ¸à µâ¶°à µâµà µâ³°à µâ²à µâ°°à µâ¯à µâ­°à µâ¬à µ, Luxi Serif, Beta
Danceèà ±è¨à ±è¸à ±ë °à ³ê·à ³, mdk_teamsà ¹, Electroharmonixà ¸ì¤à ¸ì¢ à
¸ì¡à ¸ì à ¸ìà ¸ì à ¸ìà ¸, Adventureà ±îà ±îà ±, Failed Attemptà¸à ²à¸ à
²à¸¸à ²à¹à ²êªà ³êª¨à ³ê«à ³, Courierà ¹êà ¹ê¨à ¹ê¸à ¹, Ikarusãà ¹ã à ¹ãà
¹, Brand New࠷⧰࠷â¨à ·â¨ à ·â¨¸à ·, Standard Symbols Lâà ·â¨à ·âà ·âà
·âà ·âà ·â à ·â¸à ·âà ·, Babelfishà ¹å°à ¹å¯¨à ¹å®¸à ¹å®à ¹, Captain
Poddê¸à ¹êà ¹êà ¹ê¨à ¹ê¸à ¹êà ¹, Courier 10 Pitchåà ·åà ·å°à ·åà ·å à ·å¸à
·åà ·, Bazaroniteå¸à ·åà ·å¨à ·åà ·åà ·, Utopiaå¸à ¹åà ¹åà ¹, Blue
Highway堨࠹å¸à ¹åà ¹åà ¹å¨à ¹å¸à ¹, FakeReceiptà ¹ãà ¹ã¨à ¹ã¸à ¹ãà ¹ãà
¹, ActionIs㷸࠹ã·à ¹ã¶à ¹ãµ¨à ¹, Fadgod裡࠶ï¨à ¶ï¨à ¶, URW Chancery
Lïà ¶ï à ¶ï¸à ¶ïà ¶ïà ¶ïà ¶ïà ¶, Betsy Flanaganêªà ¹ê©¨à ¹ê¨¸à ¹î¾¨à ¦î½à
¦î»¨à ¦îºà ¦, Raghindiã¸à ¹ãà ¹ãà ¹ã¨à ¹, Bitstream Vera Sans, Golden
Girdlee, URW Gothic L, Bitstream Charter, Luxi Sans, A.D. MONOhiskey, der
Dämonschriftkegel, Blue Highway Condensed, Die Nasty Vera San, Font in a
Red Suits, Larabiefont L, Binaryterc L, Flubberem Char, Nimbus Sans L
Condensed, Bitstream Vera Sans Mono, URW Palladio Lftkegel, Luxi
Monochoolbook, Indigo Joker, Fudd Dan, Dingbatssnt, Ikarus Turbulence, URW
Bookman L, DistortiatemptCond, Nimbus Roman No9 Ls Mono, Embargoladio,
CursorNewà  , Ikarus Vulturels Lé« à  , Davisfishà  , DirtyBaker'sDozen,
malayalam0 Pitch, HydrogenWhiskey, Eli 5.0b, Densmorehway,

Question are:

1. Am I doing something wrong (e.g. use the API in a wrong way)

2. Is this a known bug?

3. Can anyone reproduce this behaviour?

I'd be grateful if someone could enlighten me ;-).

Thanks in advance

Christoph Feller



More information about the Mono-devel-list mailing list