Bug Report T463225
Visible to All Users

Code Cleanup - NullReferenceException during cleanup if "Remove Redundant type qualifier" is enabled

created 8 years ago

Hi, when I'm doing a code clean up on a form class I'm getting the following error and the clean up doesn't happen.

"One or more errors have occurred"

By coping the class to notepad and coping in each method one at a time, I've narrowed it down to a certain method that is causing the problem.

Then, by commenting out the lines in the method I've worked out which lines that is causing the problem. Once they are commented out the error goes away and the clean up happens.

Basically all the commented grid lines cause the error.  To further narrow this down, I believe it's to do with the

C#
Infragistics.Win.Appearance

part of the code, however if I remove this the "Appearance" class is then ambiguous between infragistics.win and System.Win.Form

I think this is the reason for the error, because if I change the USING at the top to "using XYZ = Infragistics.Win;" then change it in the code below to use XYZ, the clean up works, but I don't wan't to make those changes.

Hope the below code helps you in solving the issue.

Thanks

C#
private static void SetUpUltraGrid(UltraGrid grid) { //grid.DisplayLayout.Override.HeaderAppearance = new Infragistics.Win.Appearance() //{ // ThemedElementAlpha = Alpha.Opaque //}; grid.DisplayLayout.Override.HeaderStyle = HeaderStyle.XPThemed; grid.DisplayLayout.Override.ButtonStyle = UIElementButtonStyle.Office2007RibbonButton; //grid.DisplayLayout.Override.CellAppearance = new Infragistics.Win.Appearance() //{ // BorderColor = System.Drawing.Color.Transparent //}; grid.DisplayLayout.ScrollBarLook.ViewStyle = ScrollBarViewStyle.Outlook2007; grid.DisplayLayout.Override.MinRowHeight = 17; grid.DisplayLayout.ScrollBarLook.Appearance.ThemedElementAlpha = Alpha.Opaque; grid.DisplayLayout.ScrollBarLook.ViewStyle = ScrollBarViewStyle.Outlook2007; //grid.DisplayLayout.Override.RowAlternateAppearance = new Infragistics.Win.Appearance() //{ // BackColor = System.Drawing.Color.Transparent //}; //grid.DisplayLayout.Override.SummaryFooterAppearance = new Infragistics.Win.Appearance() //{ // BorderColor = System.Drawing.Color.Black //}; grid.DisplayLayout.Override.SummaryFooterCaptionVisible = DefaultableBoolean.False; //grid.DisplayLayout.Override.SummaryValueAppearance = new Infragistics.Win.Appearance() //{ // BackColor = Color.FromArgb(215, 215, 215), // BorderColor = Color.Black //}; var appearance = grid.DisplayLayout.Appearance; appearance.BackColor = SystemColors.Window; appearance.BackColor2 = Color.LightSteelBlue; appearance.BackColorDisabled = SystemColors.Window; appearance.BackGradientStyle = GradientStyle.None; appearance.BorderColor = Color.FromArgb(227, 239, 255); appearance.ForeColorDisabled = Color.SlateGray; appearance.ThemedElementAlpha = Alpha.Transparent; }
Show previous comments (2)
AM AM
Alan Middleton999 8 years ago

    Hi Again

    Another quick update… Just been looking at my CRR settings and spotted a setting I have turned ON.

    In the Editor > C# > Code Clean Up

    Bottom option "Remove redundant type qualifies" this is turned ON… If I turn this OFF then the clean up works on with no issues, with it ON, I get the error mentioned .

    Hope this helps.

    DevExpress Support Team 8 years ago

      Hi Alan,

      Thank you for the provided info. It was really helpful. Now I can reproduce the exception in simple code so we can fix it. Once we do it, we will update this thread. Please stay tuned.
      As a temporary workaround we would recommend you keep the "Remove redundant type qualifier" rule disabled.

      AM AM
      Alan Middleton999 8 years ago

        Hi Alex

        This is excellent news, glad you can reproduce the exception :)

        Now I know exactly what it is as well, when I get the exception I'll untick that rule and try again, that way if it's something else after unticking, I'll know :)

        Answers approved by DevExpress Support

        created 8 years ago

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.