Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TextFormatter Exception
Message
De
10/02/2010 03:53:23
 
 
À
09/02/2010 16:59:18
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01447906
Message ID:
01448512
Vues:
23
>>>>Hi,
FormattedText ft = new FormattedText("Hello", CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
>>>>new Typeface("Verdana"), 100, Brushes.Black);
>>>>double d = ft.MinWidth;
Second line throws a ArgumentNullException. Stack trace shows MS.Internal.TextFormatterImp.VerifyTextFormattingArguments(.....) Value cannot be null. Parameter name: textSource. Works fine IF DrawingContext.DrawText(ft,0,0) is executed between the two lines.
>>>>Anyone?
>>>
>>>That is really a weird one.
>>>
>>>What's even weirder... if I hover over and browse the properties for ft in vs... it doesn't throw the error.
>>>
>>>Thought it might be timing, but that wasn't it.
>>>
>>>I added an able to reproduce response to your bug report.
>>
>>Thx. I also notices the behaviour you mention - inspecting the value in the debugger doesn't throw the exception and shows a valid double.
>> Guess we'll have to wait and see what MS say about this one :-{
>>
>>Update: Just see MS has replied - fixed in .NET4. No workaround though......
>>
>>Best,
>>Viv
>
>Glad to hear it will be fixed in .NET 4
>
>I didn't have time to dig deeper... seems that inspecting the object would be a clue to a possible work around. I didn't have time to dig deaper into it though. Also wonder if it throws the error in a release version. Didn't have time to test that one either.

Hi,
Update:
Tested in Beta 2 - fixed....
Also have an interim workaround using ft.BuildGeometry(new Point()):
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/acfe3120-a850-4897-8fda-0d42d631ff70/
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform