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;
}
Hi Alan,
I spent some time trying to reproduce the issue but my attempts didn't succeed. Perhaps, the cause of the issue is related to specifics of your local environment. Would you please provide us with your CodeRush and Visual Studio settings?
2. Click the Tools > Import and Export Settings menu item. Export all Visual Studio Settings and attach the obtained "*.vssettings" file to your next message.
Also, please provide us with CodeRush logs obtained at the moment when the issue appears:
%LocalAppData%\CodeRush\Logs
Hi
Sorry to hear you can't reproduce it. The issue is down to the lines that contain this:
new Infragistics.Win.Appearance()
I have noticed also that it's not just the "infragistics.win" but had it recently with other namespaces, but the end result would be an ambiguous error.
I believe CRR is trying to move the "infragistics.win" part to the top as "using" ( I noticed this recently with System.Reflection), which will then give ambiguous errors on the "Appearance" class. I don't think any of the other addins I have does this move, only the CRR cleanup. However I've added all my VS Help About info below as well as the requested files.
The actual error in the CRR Package log is:
Error: Message: Object reference not set to an instance of an object.
Error: Type: System.NullReferenceException
Error: Source: DevExpress.CodeAnalysis.CSharp
Error: StackTrace: at DevExpress.CodeAnalysis.CSharp.Refactorings.RemoveTypeQualifier.RemoveTypeQualifierRefactoring.ApplyRefactoring(RefactoringContext context)
at DevExpress.CodeAnalysis.Refactorings.RefactoringAction.<Apply>d__4.MoveNext()
It appears I can only attach one file, so have zipped up the VS settings and the log into the CRR zip
Many thanks for the help:
Here is the VS Help info:
Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01590
Installed Version: Enterprise
Architecture and Modeling Tools 00322-80000-00000-AA262
Microsoft Architecture and Modeling Tools
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.
LightSwitch for Visual Studio 2015 00322-80000-00000-AA262
Microsoft LightSwitch for Visual Studio 2015
Microsoft Visual Studio Tools for Applications 2015 00322-80000-00000-AA262
Microsoft Visual Studio Tools for Applications 2015
Visual Basic 2015 00322-80000-00000-AA262
Microsoft Visual Basic 2015
Visual C# 2015 00322-80000-00000-AA262
Microsoft Visual C# 2015
Visual C++ 2015 00322-80000-00000-AA262
Microsoft Visual C++ 2015
Windows Phone SDK 8.0 - ENU 00322-80000-00000-AA262
Windows Phone SDK 8.0 - ENU
AnkhSVN - Subversion Support for Visual Studio 2.6.12735.14
AnkhSVN - Subversion Support for Visual Studio 2.6.12735.14
* Ankh.Package 2.6.12735.14
* Subversion 1.9.2 via SharpSvn 1.9002.3777.76
SharpSvn is linked to: Apr 1.5.1, Apr-util 1.5.4, Cyrus Sasl 2.1.26, eXpat 2.1.0, LibSSH2 1.6.0, OpenSSL 1.0.2d 9 Jul 2015, Serf 1.3.8, SQLite 3.8.11.1, Subversion 1.9.2-SharpSvn, Utf8proc 1.1.5, ZLib 1.2.8
SharpSvn is optionally linked to: Berkeley DB 4.4.20, SharpPlink 0.65.0(SharpSvn)
ASP.NET and Web Tools 2015.1 14.1.21111.0
ASP.NET and Web Tools 2015.1
ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563
ASP.NET Web Frameworks and Tools 2013 5.2.40314.0
For additional information, visit http://www.asp.net/
Azure App Service Tools v2.9.6 14.0.21111.0
Azure App Service Tools v2.9.6
Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.
Azure Data Lake Tools for Visual Studio 2.2.2100.0
Microsoft Azure Data Lake Tools for Visual Studio
Clear MEF Component Cache 1.3.1
Clears the Visual Studio MEF component cache to fix issues with cache corruption.
CodeRush for Roslyn 16.2.3.0
DevExpress CodeRush for Roslyn package.
Common Azure Tools 1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Crystal Reports for .NET Framework
Crystal Reports for .NET Framework
Devart SQL Complete 5.5.218
Devart dbForge SQL Complete for Management Studio and Visual Studio
Copyright © 2016 Devart. All rights reserved.
Web: http://www.devart.com/dbforge/sql/sqlcomplete
Support: http://www.devart.com/dbforge/sql/sqlcomplete/support.html
Ordering: http://www.devart.com/dbforge/sql/sqlcomplete/ordering.html
DevExpress.DeploymentTool 1.0
A useful tool for deploying DevExpress assemblies.
DevExpress.Win.LayoutAssistant Extension 1.0
DevExpress.Win.LayoutAssistant Visual Studio Extension Detailed Info
Dummy Text Generator 1.2.13
Easily insert dummy text into the editor in Visual Studio. Lorem Ipsum and other vocabularies are supported.
Fast Koala 1.0
Enables config file transformations at build-time for most project types.
File Nesting 2.6.67
Automatically nest files based on file name and enables developers to nest and unnest any file manually
GhostDoc 5.4.16325.0
GhostDoc automatically generates XML documentation comments.
I Hate #Regions 1.0
Regions Suck. You need this.
Infragistics Version Utility 1.0
This utility lets you set the Infragistics version that a specific project is using.
Infragistics.ColorTuner 1.0
Infragistics Color Tuner for Microsoft Visual Studio 2010. For more information visit http://www.infragistics.com
Infragistics.VSExtension 1.0
Infragistics Visual Studio Extension (AddIn) adds scheduled check for update functionality to your Visual Studio IDE. It also provides some fast shortcuts to infragistics products and online resources.
JavaScript Language Service 2.0
JavaScript Language Service
JavaScript Project System 2.0
JavaScript Project System
JustDecompile Tools 1.0
Makes JustDecompile functionality available in VIsual Studio. Requires JustDecompile installation.
Microsoft .NET Core Tools (Preview 2) 14.1.21111.0
Microsoft .NET Core Tools (Preview 2)
Microsoft Azure Hive Query Language Service 2.2.2100.0
Language service for Hive query
Microsoft Azure Mobile Services Tools 1.4
Microsoft Azure Mobile Services Tools
Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.9.41104.6
Microsoft Team Foundation Server 2015 Power Tools 14.0
Power Tools that extend the Team Foundation Server integration with Visual Studio.
Microsoft Visual Studio Process Editor 1.0
Process Editor for Microsoft Visual Studio Team Foundation Server
NuGet Package Manager 3.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
Office Developer Tools for Visual Studio 2015 ENU 14.0.23928
Microsoft Office Developer Tools for Visual Studio 2015 ENU
PreEmptive Analytics Visualizer 1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.
SQL Server Analysis Services 13.0.1701.8
Microsoft SQL Server Analysis Services Designer
Version 13.0.1701.8
SQL Server Data Tools 14.0.61021.0
Microsoft SQL Server Data Tools
SQL Server Integration Services
Microsoft SQL Server Integration Services Designer
Version 13.0.1601.5
SQL Server Reporting Services 13.0.1701.8
Microsoft SQL Server Reporting Services Designers
Version 13.0.1701.8
Supercharger 1.0.0.722
Extend Visual Studio with CodeMAP, Intelligent Code Flow Lines, Code Highlighters, SuperFind, Rich Code, Magic Comments etc. More info: http://supercharger.tools
TargetFrameworkMigrator 1.0
Bulk Change .Net Projects Target Frameworks
ToolWindowHostedEditor 1.0
Hosting json editor into a tool window
TypeScript 1.8.36.0
TypeScript tools for Visual Studio
Visual Studio Spell Check Everywhere VSSpellCheckEverywhere
An extension that enables spell checking within any Visual Studio file editor or tool window that uses WPF text boxes.
https://GitHub.com/EWSoftware/VSSpellChecker
Visual Studio Spell Checker VSSpellChecker
An editor extension that checks the spelling of comments, strings, and plain text as you type or interactively with tool windows.
https://GitHub.com/EWSoftware/VSSpellChecker
Visual Studio Tools for Universal Windows Apps 14.0.25527.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.
VSProject.Extension 1.0
Information about my package
Workflow Manager Tools 1.0 1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.
Xamarin 4.1.1.3 (34a92cd)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android 6.1.1.1 (7db2aac)
Visual Studio extension to enable development for Xamarin.Android.
Xamarin.iOS 9.8.1.4 (3cf8aae)
Visual Studio extension to enable development for Xamarin.iOS.
XtraReports package 1.0
XtraReports package
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.
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.
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 :)