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

[Flaky Test] com2fontconvertertests.com2fontconverter_convertnativetomanaged #8632

Closed
Tracked by #8607
runfoapp bot opened this issue Feb 13, 2023 · 2 comments · Fixed by #8864
Closed
Tracked by #8607

[Flaky Test] com2fontconvertertests.com2fontconverter_convertnativetomanaged #8632

runfoapp bot opened this issue Feb 13, 2023 · 2 comments · Fixed by #8864

Comments

@runfoapp
Copy link

runfoapp bot commented Feb 13, 2023

Runfo Tracking Issue: [Flaky Test] com2fontconvertertests.com2fontconverter_convertnativetomanaged

Build Definition Kind Run Name

Build Result Summary

Day Hit Count Week Hit Count Month Hit Count
0 0 0
@dreddy-work
Copy link
Member

Assert.Equal() Failure\r\nExpected: 12\r\nActual:   1.5


Stack trace
   at System.Windows.Forms.Tests.ComponentModel.Com2Interop.COM2FontConverterTests.COM2FontConverter_ConvertNativeToManaged() in /_/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComponentModel/Com2Interop/COM2FontConverterTests.cs:line 48
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)

@lonitra
Copy link
Member

lonitra commented Feb 24, 2023

It looks like an ArgumentException might have occurred and Control.DefaultFont was passed back from ConvertNativeToManaged().

            try
            {
                // This wasn't working because it was converting everything to world units.
                using (Font font = Font.FromHfont(_lastHandle))
                {
                    _lastFont = ControlPaint.FontInPoints(font);
                }
            }
            catch (ArgumentException)
            {
                // We will fail on non-truetype fonts, so just use the default font.
                _lastFont = Control.DefaultFont;
            }

We should add an assert in the test that checks that the font of interest isn't equal to Control.DefaultFont to help narrow down the cause and perhaps add some sort of debug statement to capture details of the exception.

@ghost ghost added the 🚧 work in progress Work that is current in progress label Mar 14, 2023
@ghost ghost removed the 🚧 work in progress Work that is current in progress label Mar 16, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Apr 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants