From e84c5673cf74d328094d3a60c0130eb3b430822b Mon Sep 17 00:00:00 2001 From: kasperk81 <83082615+kasperk81@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:13:05 +0300 Subject: [PATCH] Debug::Assert(false to Debug::Fail (#9441) --- .../CPP/DWriteWrapper/FontCollectionLoader.h | 2 +- .../CPP/DWriteWrapper/FontFileEnumerator.h | 2 +- .../CPP/DWriteWrapper/FontFileLoader.h | 2 +- .../CPP/DWriteWrapper/FontFileStream.h | 2 +- .../src/System.Printing/CPP/src/GDIExporter/gdibitmap.cpp | 4 ++-- .../src/System.Printing/CPP/src/GDIExporter/gdibrush.cpp | 2 +- .../src/System.Printing/CPP/src/GDIExporter/gdipath.cpp | 2 +- .../src/System.Printing/CPP/src/GDIExporter/gdipen.cpp | 2 +- .../src/System.Printing/CPP/src/GDIExporter/gdirt.cpp | 8 ++++---- .../src/System.Printing/CPP/src/GDIExporter/gditextrt.cpp | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontCollectionLoader.h b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontCollectionLoader.h index 9933942abf0..ead14818259 100644 --- a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontCollectionLoader.h +++ b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontCollectionLoader.h @@ -25,7 +25,7 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface public: - FontCollectionLoader() { Debug::Assert(false, "Assertion failed"); } + FontCollectionLoader() { Debug::Fail("Assertion failed"); } FontCollectionLoader( IFontSourceCollectionFactory^ fontSourceCollectionFactory, diff --git a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileEnumerator.h b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileEnumerator.h index 884227aae75..b72985ff7fb 100644 --- a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileEnumerator.h +++ b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileEnumerator.h @@ -27,7 +27,7 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface public: - FontFileEnumerator() { Debug::Assert(false, "Assertion failed"); } + FontFileEnumerator() { Debug::Fail("Assertion failed"); } FontFileEnumerator( IEnumerable^ fontSourceCollection, diff --git a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileLoader.h b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileLoader.h index 771fb1c93f6..8af1924c31d 100644 --- a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileLoader.h +++ b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileLoader.h @@ -22,7 +22,7 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface public: - FontFileLoader() { Debug::Assert(false, "Assertion failed"); } + FontFileLoader() { Debug::Fail("Assertion failed"); } FontFileLoader(IFontSourceFactory^ fontSourceFactory); diff --git a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileStream.h b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileStream.h index 3e0bb35b8d3..32b5d552926 100644 --- a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileStream.h +++ b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileStream.h @@ -29,7 +29,7 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface /// Asserts false because COM convention requires us to have a default constructor /// but we are the only entity that can construct these objects, and we use the /// other constructor. - FontFileStream() { Debug::Assert(false, "Assertion failed"); } + FontFileStream() { Debug::Fail("Assertion failed"); } /// /// ctor. diff --git a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdibitmap.cpp b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdibitmap.cpp index dc0991d0fc0..4299f6ff4d4 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdibitmap.cpp +++ b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdibitmap.cpp @@ -188,7 +188,7 @@ void CGDIBitmap::SetupPalette(interior_ptr bmi, int bitCount) } else { - Debug::Assert(false, "Unsupported format"); + Debug::Fail("Unsupported format"); } bmi->bmiHeader.biClrUsed = count; @@ -242,7 +242,7 @@ void CGDIBitmap::SetBits(interior_ptr bmi) } else { - Debug::Assert(false, "Unexpected bitcount"); + Debug::Fail("Unexpected bitcount"); m_Buffer = nullptr; } } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdibrush.cpp b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdibrush.cpp index a3b5f6c3c64..339709fa620 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdibrush.cpp +++ b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdibrush.cpp @@ -33,7 +33,7 @@ GdiSafeHandle^ CGDIDevice::ConvertBrush(COLORREF colorRef) } else { - Debug::Assert(false, "CreateSolidBrush failed"); + Debug::Fail("CreateSolidBrush failed"); } } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdipath.cpp b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdipath.cpp index 16f860c2150..5290549aac7 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdipath.cpp +++ b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdipath.cpp @@ -343,7 +343,7 @@ ref class GdiGeometryConverter : public CapacityStreamGeometryContext if (Double::IsNaN(transformedPoint.X) || Double::IsNaN(transformedPoint.Y)) { - Debug::Assert(false, "Invalid path input: NaN encountered"); + Debug::Fail("Invalid path input: NaN encountered"); ForceGeometryEmpty(); return -1; } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdipen.cpp b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdipen.cpp index 4f7aaca56ae..7b120b828e1 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdipen.cpp +++ b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdipen.cpp @@ -361,7 +361,7 @@ GdiSafeHandle^ CGDIDevice::ConvertPen( } else { - Debug::Assert(false, "ExtCreatePen failed"); + Debug::Fail("ExtCreatePen failed"); } } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdirt.cpp b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdirt.cpp index ed51749fe0b..298ff6e41db 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdirt.cpp +++ b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gdirt.cpp @@ -1178,7 +1178,7 @@ HRESULT CGDIRenderTarget::StrokePath( } else { - Debug::Assert(false, "PathGeometry.GetWidenedPathGeometry failed."); + Debug::Fail("PathGeometry.GetWidenedPathGeometry failed."); } } @@ -1487,12 +1487,12 @@ HRESULT CGDIRenderTarget::FillLinearGradient( } else if (gradientBrush->GradientStops == nullptr || gradientBrush->GradientStops->Count == 0) { - Debug::Assert(false, "Empty LinearGradientBrush, should've been culled"); + Debug::Fail("Empty LinearGradientBrush, should've been culled"); return S_OK; } else if (gradientBrush->GradientStops->Count == 1) { - Debug::Assert(false, "Single-stop LinearGradientBrush, should've been converted to SolidColorBrush"); + Debug::Fail("Single-stop LinearGradientBrush, should've been converted to SolidColorBrush"); return FillPath(geometry, gcnew SolidColorBrush(gradientBrush->GradientStops[0]->Color)); } @@ -1538,7 +1538,7 @@ HRESULT CGDIRenderTarget::FillLinearGradient( break; default: - Debug::Assert(false, "Unknown GradientSpreadMethod"); + Debug::Fail("Unknown GradientSpreadMethod"); return E_NOTIMPL; } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gditextrt.cpp b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gditextrt.cpp index 0426f32315b..ef91d81ed90 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gditextrt.cpp +++ b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/src/GDIExporter/gditextrt.cpp @@ -931,7 +931,7 @@ GdiSafeHandle^ CGDIRenderTarget::CreateSimulatedStyleFont(interior_ptr