Home Dashboard Directory Help
Search

The Graphics.MeasureString function hangs with right-to-left strings by Maurice Bonne


Status: 

Closed
 as External Help for as External


2
0
Sign in
to vote
Type: Bug
ID: 559572
Opened: 5/17/2010 7:28:19 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

The .NET framework function Graphics.MeasureString(...) hangs when a long right-to-left charaters string is passed. When there are more than 2046 right to left chars in the string, the function does not return, and the CPU is 100% used (one cores of the CPU).

I tried several overload of the method and also the MeasureCharacterRanges method, but all have the same behavior.
Details
Sign in to post a comment.
Posted by Microsoft on 6/17/2010 at 1:31 AM
Windows team has confirmed that it's a regression, but they decide not to fix in Win7 since a string with more than 2046 characters is a corner case. However, they would evaluate it for Win8.

Addtionally, we have a workaround, using Graphics.MeasureCharacterRanges. Thefore, I'm going to close this issue.

Thanks and keep the feedback coming.
UIFx Team
Posted by Microsoft on 6/17/2010 at 1:31 AM
Windows team has confirmed that it's a regression, but they decide not to fix in Win7 since a string with more than 2046 characters is a corner case. However, they would evaluate it for Win8.

Addtionally, we have a workaround, using Graphics.MeasureCharacterRanges. Thefore, I'm going to close this issue.

Thanks and keep the feedback coming.
UIFx Team
Posted by Microsoft on 6/9/2010 at 7:31 PM
Thanks for your feedback on the .NET Framework!

Unfortunately the issue that you have reported is caused by GDI+, a component external to Windows Forms and as such cannot be fixed by our team.

Inside Graphics.MeasureString, GdipMeasureString is called. We can get the call stack when hanging:

     GdiPlus.dll!otlCacheManager::GetNextLookup() + 0xab bytes
     GdiPlus.dll!ApplyFeatures() + 0x23c bytes    
     GdiPlus.dll!SubstituteOtlGlyphs() + 0x18c bytes    
     GdiPlus.dll!SubstituteOtlGlyphsWithLanguageFallback() + 0x1e bytes    
     GdiPlus.dll!ArabicOtlShape() + 0x59f bytes    
     GdiPlus.dll!ShapingCache::Shape() + 0x295 bytes    
     GdiPlus.dll!ShapingCache::TryShape() + 0x5b bytes    
     GdiPlus.dll!ShapingCache::GetGlyphs() + 0xa1 bytes
     GdiPlus.dll!FullTextImager::CreateTextRuns() + 0x7a bytes
     GdiPlus.dll!FullTextImager::BuildRunsFromTextItemsAndFormatting() + 0x2cb bytes    
     GdiPlus.dll!FullTextImager::BuildRunsUpToAndIncluding() + 0xba bytes
     GdiPlus.dll!BuiltLine::BuiltLine() + 0x70 bytes    
     GdiPlus.dll!FullTextImager::BuildAllLines() + 0xd5 bytes
     GdiPlus.dll!FullTextImager::BuildLines() + 0x1b bytes    
     GdiPlus.dll!FullTextImager::Measure() + 0xd bytes    
     GdiPlus.dll!GpGraphics::MeasureString() + 0x19c bytes    
     GdiPlus.dll!_GdipMeasureString@36() + 0x13e bytes    
     [Managed to Native Transition]    
>    System.Drawing.dll!System.Drawing.Graphics.MeasureString(string text, System.Drawing.Font font, System.Drawing.SizeF layoutArea, System.Drawing.StringFormat stringFormat) Line 2513 + 0x200 bytes     C#

We have informed the responsible team about the issue, however they do not use this forum to track issues and hence we are closing it.

If the fix is urgently needed on down-level .net frameworks, please kindly escalate this issue through Microsoft technical support channel in your region. They could help you with the hot-fix/QFE process (note: strong business justification is required).

Thanks and keep the feedback coming.
UIFx Team
Posted by Microsoft on 5/18/2010 at 12:25 AM
Thanks for your feedback. We were able to reproduce the issue you are seeing. We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 5/17/2010 at 5:03 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.