What's new in NDepend v2017.1

After my first article “Analyzing the Quality of your code with NDepend” on NDepend, I found few new interesting feature in it’s new release. Microsoft has introduced new version of the Visual Studio which my first choice for development. New Roslyn platform heading us to the Open source development using the Microsoft tools that making things easier to learn and get knowledge about the new tools. But we are going to explorer new features of the NDepend. Few of them are as below:
Support for Visual Studio 2017

  • NDepend 2017.1 supports Visual Studio 2017.
  • NDepend 2017.1. It also supports Visual Studio 2015, 2013, 2012 and 2010.

    NDepend_7_VS_Integration

.NET Core support

  • NDepend can now analyze any .NET Core assembly and its associated PDB and source files.
  • The new .NET Core Portable PDB file format is now also supported.
  • Support for inferring code to analyze from a project.json file, which about to completely come in the first quarter of this year. All .NET Core assemblies you need to analyze can be easily found through Analyze .NET assemblies in directory (recursive).

Dashboard Improvements

  • Dashboards have been improved in the NDepend UI in Visual Studio, in the generated reports section and in the Team Services web portal.
  • It now contains technical debt estimations, quality gates, rules and issues data.
  • For each data, a visual indicator shows the progression since baseline. Red and green coloured values are used to pinpoint progress or regression.
  • Clicking any value generates a query that drills down through corresponding data, which can be a list of code elements, debt estimations, quality gates, rules or issues.

    NDepend_Deshboard

Visual Studio Team Services VSTS and TFS 2017 Advanced Extension
A new Visual Studio Team Services extension is available. It consists of a build task that analyses code and code coverage yielded by the build process.
A web portal presents the results which embeds the NDepend dashboard and makes data actionable by drilling down anything with a single click.

A new Visual Studio Team Services extension is available. It consists of a build task that analyses code and code coverage yield by the build process. A web portal presents analysis results.clip_image004[4]

  • The web portal has a dashboard that presents the most relevant data including technical debt, code size, quality gates, rules and issues numbers.
  • A TFS build can be used as a baseline. All dashboard data is then diff-ed since the baseline.
  • Each data presented in the dashboard is clickable to view more information.
    clip_image006[4]
  • A detailed summary of quality gates is available.
    clip_image008[4]
  • Technical debt can be drilled down till the issue level. Clicking an issue allows it to be edited in the Rules panel.
    The datagrid is interactive: issues can be grouped, ordered and filtered by rule name.
    clip_image010
  • Rules details can be explored. Clicking a rule violation redirects the user to the VSTS Code Search extension, displaying the source code of the culprit code element.
    clip_image012
  • The VSTS extension logs trend metrics for each build, and Trend charts are shown.
    clip_image014
  • A panel shows a code metrics recap for each code element. The datagrid is interactive: elements can be grouped, ordered and filtered by name.
    clip_image016

Report Improvements

  • The new improved report dashboard now contains information on debt and issues.
    clip_image018
  • The report main section contains Quality Gates status summary.
    clip_image020
  • The report Rules Summary now shows the number of issues added and fixed per rule.
    clip_image021[4]
  • A green/red colour scale is now shown on code coverage values.
    clip_image022[4]

Code Querying Improvements

  • Thanks to the new queryable domains QualityGates, Issues, IssuesInBaseline, Rules queries can be written to match IQualityGate, IIssue, IRule objects according to any criteria (rule violated or not, quality gate status that went from pass to fail, issues added since baseline, issues severity or debt...).
    clip_image023[4]
  • New syntax to write quality gates.
  • A new button lets you run the currently edited code query against the baseline.
    clip_image024[4]
  • A code query can now return code elements of various kinds such as assemblies, namespaces, types, methods and fields.
    This new queryable domains are available including CodeElements ANTMF ; CodeElementParents ANT ; TypesAndMembers TMF ; Members MF ; CodeContainersANTM ; AttributeTargets ATMF ; where Assemblies, Namespaces, Types, Methods, Fields.
  • A query can now return values of technical debt through new types Debt, AnnualInterest, DebtRating, Severity, TrendIcon and can also return System.Version and System.TimeSpan values.
    clip_image025[4]
  • A colour scale is now shown on query result metric values making it easier to compare them at a glance.
  • You can now write very simple queries like Methods or JustMyCode.CodeElements or codebase.PercentageCoverage. This syntax simplifies writing quality gates and trend metrics queries.
  • Trend metrics used to only be defined with queries that return a scalar. A trend metric can now also be defined with a query that returns rows. In such situation the trend metric value is equals to the row count.
  • Improved query edit experience including:
    - PageUp/PageDown and dot supported on completion items list
    - smart query results column width auto-adjustment
    - no more flickering on query result row sorting.

Smart Technical Debt Estimation

NDepend v2017 is the only VS extension that can tell the developer that, for example, since this morning the code just written has introduced debt that would cost about 30 minutes should it have to be repaid later.
Knowing this, the developer can fix the code before even committing it to the source control.

  • An NDepend rule can now assign a technical debt and annual interest values to its issues.
  • The technical-debt is the estimated man-time that would take to fix the issue.
  • The annual-interest is the estimated man-time consumed per year if the issue is left unfixed. This provides an estimate of the business impact of the issue.
  • Issues of a rule now have a severity level in the blocker, critical, major, minor, info range.
    The annual-interest is a measure of an issues severity. The severity and the annual-interest represent the same concept where the annual-interest is a continuous measure while the severity is a discrete measure.
  • For example the rule below matches methods which are too complex. The technical debt is linear to the methods excessive complexity and the annual-interest is linear to the methods code coverage by tests (10 minutes per year for 100% coverage, 2 hours per year for 0% coverage).
    All default rules now have these debt/interest formulas which offer real-world estimations, out of the box. If needed, these formulas can be easily customized.
    clip_image026[4]
  • The dashboard now shows estimated Debt values and evolution since baseline.
    This dashboard is available in the NDepend UI in Visual Studio, in generated reports and in the Team Services web portal.
    clip_image027[4]
  • Many facilities are proposed from the dashboard to query/sort/filter/group... the debt estimated values and the issues set.
    These facilities include sorting debt and issues per rule or per code element, focusing on new and fixed debt since baseline and issues to fix by priority heuristics.
    Customizable Quality Gates are now available to define excessive thresholds over debt estimations that might induce build failure and prevent check-in.
    Customizable trend metrics are now available to measure debt trending. The key is to offer comprehensive sets of actionable results.
  • The NDepend project properties now has a Debt and Issues panel to customize all technical debt computation aspects.
    This includes estimated Debt and Interest values conversion from man-time to cost estimation.
    This also includes Debt Ratio and SQALE Debt Rating on a code element (as defined by the SQALE method). These are expressed in percentage of the estimated technical-debt compared to the estimated effort it would take to rewrite the code element from scratch.
    Debt settings can also be shared among different NDepend projects.
    clip_image029
  • More info on Smart Technical Debt Estimation here

Quality Gates

A Quality Gate is a check on a code quality fact that must be enforced before releasing and eventually, before committing to source control.
Quality Gates for example can forbid issues with a certain severity introduced since the baseline, enforce particular code coverage by tests ratio on new and refactored code or enforce thresholds on any Technical Debt criteria.

  • CQLinq can now be used to write quality gates. Technically a quality gate is like a trend metric. It's a code query that returns a scalar or rows (in which case the value is the row count). In practice a quality gate is used to fail a build when some thresholds are violated. A warn threshold, a fail threshold and a unit can be provided.
  • Thanks to the new CQLinq capabilities, quality gates can be use to measure and monitor any fact concerning code, but also any fact concerning technical-debt, rules and issues.
  • Quality gates can also rely on differences since baseline (diff), which means that they can monitor progression like new technical debt since baseline or % code coverage on new code written since baseline.
    clip_image030[4]
  • 11 quality gates are provided per default and LINQ queries can be written to query the quality gates status.
    clip_image031[4]
  • In previous NDepend versions, a build used to fail upon critical rules failures. Now the build fails upon any quality gate failure. The critical rule concept has been kept and the default quality gate Critical Rules Violated mimics the build fail behavior of previous NDepend versions.

Issues Management

  • A new Issues menu offers actionable options to list issues to be fixed by priority, and browse debt and issues per rule or per code element.
    clip_image032[4]
  • Quality gates, rules and issues numbers are shown from the dashboard. All these numbers are clickable to get lists of quality gates, rules or issues.
    clip_image033
  • A single click allows to list issues with a particular severity, added or fixed, since baseline.
    clip_image034
  • New menu to list issues concerning a code element.
    clip_image035
  • Hovering an issue with the mouse displays a complete description.
    clip_image036
  • Code element tooltip now shows debt and issues related data.
    clip_image037

Enhanced Baseline Experience

Do you want to measure progress since this morning, last week or since the last release?
Choose the baseline in a single click from the Dashboard and harness the updated results in just a few seconds.

  • Any stored baseline can be applied from the dashboard through a single click.
    Code base diff, rules, issues and quality gates are then recomputed in a few seconds.
  • Any newly created project now has the baseline settings set to 30 days ago per default.
    As a consequence, the stored baseline with the date closest to 30 days ago is applied.
    The first analysis result of a project is compared with itself since no other result can be used as the baseline.
  • Rules and Quality Gates are now executed against both current and baseline analysis results. Debt estimation, issues and status differences can then be queried.
    clip_image039
  • The search panel can now match all code elements added, refactored or removed since baseline.
    The results also show debt and issues information.
    This perspective is ideal to browse changes and issues introduced since baseline.
    clip_image041

Default Rules-Set Improvements

  • All default rules now include debt/interest estimation formulas that offer real-world estimations of the technical-debt, out of the box. If needed, these formulas can be easily customized.
    Typically rules related to poor coverage, poor quality and poor structure are the highest source of technical-debt.
  • The new CQLinq capabilities 52 existing rules have been improved to offer less false positives and more relevant data.
  • For example the rule Avoid namespaces mutually dependent has been improved to offer actionable results. It now lists all dependencies to remove at type and method level to reach a clean layered code structure.
    clip_image043
  • New rule Assemblies should have the same version lists application assemblies that have a different version than most other application assemblies.
  • New rule Avoid non-readonly static fields.
  • New notmycode query Discard generated Namespaces from JustMyCode matches the VB.NET generated namespace My.
  • The notmycode query Discard generated Types from JustMyCode now also matches anonymous types.

Enhanced Visual Studio Integration

  • NDepend analysis can be started after a build to automatically refresh NDepend results. New settings are provided to avoid starting the NDepend analysis when the builds purpose is to provide up-to-date compiled bits for a run session, a debug session or a unit-test session. In such a situation, it might be preferable to avoid starting the NDepend analysis to avoid both consuming CPU cycles and distracting the developer's focus.
  • Minimal interval between NDepend results being refreshed automatically after a build in VS which can now also be expressed in minutes.

NDepend.API Improvements

  • Possibility to compute an issues-set and an issues-set-diff through a single method call thanks to the new methods ComputeIssues() and ComputeIssuesDiff() declared in ExtensionMethodsProjectAnalysis.
  • Possibility to compile a code query once and resolve it against multiple code bases. This facility represents a significant optimization when multiple resolutions are needed, because query compilation is way slower than query resolving.
    Related method ExtensionMethodsQuery.CompileNoResolve() which returns a IQueryCompiledUnresolved that presents two Resolve() methods, against a ICodeBase and an ICompareContext.
  • The new method ExtensionMethodsQuery.GenerateCompletionItems() provides completion items in code query edition context.
  • The new method ExtensionMethodsQuery.CompileMany(IEnumerable<IQuery>) takes an enumerable of IQuery and returns a dictionary of IQueryCompiled indexed by IQuery.
Conclusion
NDepend is again loaded with more improvements and features from it’s last version. NDepend team introduced above valuable feature and enhancements.
Note: Information and Images are taken from NDepend documentation.

CodeRush for Roslyn is now available RTM Version

CodeRush helps the developers to write, refactor, navigate and debug C# and VB source code faster and more efficiently. Along this CodeRush includes the world's fastest .NET test runner which helps developers to complete software development tasks with less effort (both physical and cognitive), and in less time.

What makes this CR for Roslyn better than Classic version?

This newer version of CodeRush for Roslyn uses significantly less memory, works faster, and lets the Visual Studio to start faster the CodeRush Classic. It leverages Visual Studio's solution-parsing data and automatically supports new C# and VB language features as they become available in Visual Studio.

Features provided by CR for Roslyn:

  1. Visualize Code and Intuitively Debug
  2. Move at Warp Speed
    It helps to find symbols and files quickly in your solution and easily navigate to code constructions related to the current context. CodeRush includes the Quick Navigation and Quick File Navigation features, which make it fast and easy to find symbols and open files.

    Navigation features are available via the Navigation menu, which can be invoked using the Ctrl+Alt+N shortcut.

  3. Validate Quality Faster
    CodeRush lets you create new test cases or new test suites in a single keystroke. CodeRush for Roslyn automatically detects unit tests for NUnit, xUnit, MSpec and MSTest frameworks, and can optionally run tests located across multiple assemblies concurrently. The Test Runner also runs CoreCLR test cases in the DNX environment. The Sessions support makes it very easy to organize tests and run only those that are required.
  4. Code Refactoring
  5. Code Analysis
  6. Code Formatting and Cleanup
  7. many more…

Complete feature comparison matrix between CodeRush editions is available at Download Classic or Roslyn Version.

When to use CodeRush Classic or CodeRush for Roslyn?

Microsoft’s has started new way of development in Open Source world with the  paradigm “Compiler as a service”. Now Microsoft has lots of open source projects including the .NET Compiler Platform (“Roslyn”).NET Compiler Platform (“Roslyn”). The .NET Compiler Platform ("Roslyn") provides open-source C# and Visual Basic compilers with rich code analysis APIs. You can build code analysis tools with the same APIs that Microsoft is using to implement Visual Studio!. According to these dramatic changes in the development on the Microsoft platform lots of tools are adopting ways to move along these. After a while again I got chance to install CodeRush in Visual Studio IDE and I there are two different flavours of CodeRush. This makes me little confuse that which one should i install to work with.

After checking through documentation and ready some blog posts related to my question I got that When to use this newer version of CodeRush for Roslyn or CodeRush Classic. Actually CodeRush Classic work with the prior version of .NET Framework 4.6. With this newer version of .NET framework which is shipped with the Microsoft’s open source projects which based on the Rosyln compiler platform. Below are points which help you to decide that which version suits to your development environment:

  1. If you are using Visual Studio  2015 and .NET framework 4.6 (above) then CodeRush classic does work for you. In this case you should install CodeRush for Roslyn. This does not has all the feature of the CodeRush Classic but newer version will defiantly improve this open source stack.
  2. If you are working with older version of .NET Framework then you’ll need CodeRush Classic. If you need both, you can install both versions simultaneously and defiantly i try this too.
  3. CodeRush Classic supports C# 5.0, VB10, ASP.NET, HTML, JavaScript, XML, and XAML. In this case, for the newer version of language CodeRush for Roslyn is the only option and may be in near future Classic version of CodeRush go obsolete.

Learning and source of information:
CodeRush
.NET Developer Tooling: The Roslyn Revolution
CodeRush on Roslyn

How to add Intellisense to Visual Studio Code for bootstrap

Peoples who are habitual of using intellisense in Visual Studio and suddenly it is found missing then they really get mad during the work. Today I am trying to create some html pages with bootstrap for learning. I was feeling little hard to do code with bootstrap, because I am not able remember all of the class names of the bootstrap.

There are lots of glyphicon classes which is hard to remember. Visual Studio has this nice feature by adding JavaScript library path to the “_references.js” file and after that everything available in autosuggest mode.

What happened with me, I am not able to find the correct gylphicon class name without intellisense. Regarding this I have googled and found that this feature is not currently available in VS Code right now. However, it has been added as a feature request for upcoming updates.

Do not disappoint, There is also hope to do work with intellisense in VSCode. You can use extension"HTML CSS Class Completion".

Open Command Palette by press ctrl+ship+p Then run  “ext install HTML CSS Class Completion” to install this extension. Check the results in below image to see after enabling this extension.

image

Happy coding!

Customize context menu in Nevron Diagram

Scenario:

I had a requirement for preventing user to edit the “Composite Shape” elements (e.g. Text Primitives, Ports etc.). This restriction is required during the development for most of the cases because programs are using these shapes for some special purpose representation and these should not be altered by the use at run time to keep them consistent.

If user change these shapes then it will be hard to know that it has been modified this diagram is saved as XML string in some data store. If shape elements are used to identify the shape elements by name then it will break the program for being consistent for these shapes. See the below image, If the edited port name is used in program to  identity the center port then it will be distinguish the center  port in all of these ports.

clip_image002[5]_thumb[1]

Finally, it is required to remove some commands from the context menu of the shape in the diagram view for the user so that user will not able to modify the shape elements.

Solution:

At first place, you need to use the “Protection” on the shape to prevent some operation. You can restrict few operation on the shape for the user.

clip_image003[9]_thumb[1]

These can be set programmatically, these are just for making restrictions on the shape not for the context menu operations. See below code example:

NAbilities shapeAbilities = new NAbilities();
shapeAbilities.All = false;
shapeAbilities.InplaceEdit = true;
shapeAbilities.ResizeX = true;
shapeAbilities.ResizeY = true;
shapeAbilities.Export = false;
NShape shape = (NShape)nDrawingDocument1.ActiveLayer.Children(null)[0];
shape.Protection = shapeAbilities;

Real Solution
The simplest solution is that create a custom context menu builder for creating context menu for the current diagram view.  This will create/add the required command that you want to provide to the user while working in the diagram.

First create a Custom ContextMenuBuilder by inheriting “NDiagramContextMenuBuilder” class and override “BuildContextMenu” method. There you need to create the context menu and add the required commands to the created context menu.

internal class CustomContextMenuBuilder : NDiagramContextMenuBuilder
{
    public override NContextMenu BuildContextMenu(object obj)
    {
        NContextMenu contextMenu = new NContextMenu();
        contextMenu.Commands.Add(CreateCommand((int)DiagramCommand.Delete, false));

        return contextMenu;
    }
}

After that create an instance of this custom context menu builder and assign it to the ContextMenuBuilder property of your diagram command bars manager:

nDiagramCommandBarsManager1.ContextMenuBuilder = new CustomContextMenuBuilder();

Create and preview website page using Visual Studio Code

Today is the first day when i have used Visual Studio code after uninstalling the Bracket. Bracket has nice feature live preview to run the html document in the browser. I was expecting the same in Visual Studio code but it took me half an hour to figure that how to run the html from VSCode. VSCode use Node.js for most of the work to be done.
Finally i have figure out that how to start a small project, containing only a single HTML file in VSCode and edit it with preview in a browser similar to live preview feature in Bracket. I have all my tools setup to start creating my first project in VSCode but if you are not installed VSCode and Node.js then download VSCode and Node.js.  You can find little bit information to install Node.js here.
After you have done installation of the Node.js, either you need to setup the PATH variables in windows or the setup automatically done this work for you. You can verify this by typing below command on command prompt that Node package manager is globally accessible or not:
npm -v

Now it the right time to setup the webserver. Run the below command on the command prompt:
npm install -g live-server

image_thumb[3][9]

Now create a html file in VSCode configured folder.

image_thumb[6][9]

To preview the html document, run the below command at the project folder.

live-server


image_thumb[10][9]

It is also possible to see the live preview in VSCode split windows. You have follow below steps to do this:

  1. Create a live-view.md file with this in it (Place it wherever you want. I put it at the base folder of all my projects since I can use it for whatever I'm currently working on):
    <div style="border:1px solid #777;
    position:absolute;left:10px;top:10px;bottom:10px;right:10px;"> 
      <iframe src="http://localhost:8080/"; width="100%" height="100%" frameborder="0" /> 
    </div>
    
  2. Open live-view.md in the second/split pane in VS Code and click the "Open preview" button (top right of file).
Happy coding.

Run CSharp “Hello World!” program on Developer Command prompt

To start writing your first program without using the Visual Studio or other tools, you just need to open “Command Prompt”. Just type command on the search in Start menu either you are using Windows 7 or any higher.

image_thumb[10]_thumb[3][4]

Visual Studio installs few command line tools to do some operation using command tools and these can be invoked using the “Developer Command Prompt for VS2015”(For Visual Studio 2015). If someone has not installed Visual Studio then just install .NET Framework on the computer.

After this we are ready to create and compile our “Hello World!” program using the .NET Framework compilers.

Now create a file “hello.cs” using the “notepad”. We are going to write our code to print “Hello World!” on the screen for this example. “.cs” is the common extension for the C# file and “.vb” for Visual Basic. So now we going to create a C# program now so this file will contain C# code.

image_thumb[16]_thumb[1][4]

After running this command a prompt will appear with message “Do you want to create a new file?”. Click on “Yes” to create a new file.

In this we are going to create a class with a static method “Main”. In a Console application that would run on command prompt, CLR look for class named “Program” with a “Main” method to run the program.

image_thumb[8][3]

Now save this file and come back to the command prompt.

Now one of the tool “csc.exe” exists in the “Windows” directory in the .NET framework installation paths. It can be located at the path “C:\Windows\Microsoft.NET\Framework\{.NET Framework}”. Under the Framework folder you will find installation of .NET Framework multiple version. Below is the path of the latest one on my system. It is the “Visual C# Command Line Compiler” which compiles the C# code.

image_thumb[24][4]

Now we are going to compile the C# code then execute the program. After compiling the program C# compiler produce a executable file(.exe).

To compile the created C# code file, use the below command line on command prompt. Just pass the created “hello.cs” as parameter.

  1. csc hello.cs

image_thumb[29][4]

On windows we can run exe. Now run the hello.exe to view the result of our example program.

image_thumb[32][4]

That’s all done. We have created an example program run on the command prompt using the C# command line compiler.

Actually it transforms C# code into Microsoft Intermediate Language. This can either an exe or dynamic link library. We specify the assembly format to the csc.exe using the /target:library option. See below image for various target options:

image_thumb[37][4]

  Happy Coding!

Configuring Orchard CMS blog in Open Live Writer

After using Windows Live Writer, now I have start using Open Live Writer to do remote blogging. Right now WLW is not able to connect with few blogging platforms like blogger.com and also Microsoft has stopped putting efforts on the amazing tool for the bloggers.

OLW is an open source tool which is developed by the contribution of the developer community. Lots of features of this tool is under development. It has the main advantage that there are many tools available as compare to the HTML editor on the remote blog. You can work offline, which might be good if you’re in a situation where you don’t have a decent internet connection or not able to connect to internet for days. It will let you write blog posts and save them to draft for later publishing.

In this article, you will go through the steps to configure Open Live Writer for the Orchard CMS. This provide support for remote bloging through XmlRcp. Both WLW and OLW are able to connect with the Orchard CMS blog using this feature.

Orchard provides this XML-RPC feature out of the box and You have to enable it in the Modules section inside your Orchard CMS Orchard admin panel.

Prerequisites:

  1. You have setup Orchard CMS on your web hosting or local IIS and created a blog on website.
  2. Installed OLW on your computer.

If you have done pre work then go to the Administration Dashboard of Orchard and click the Modules. There you will find Remote Blog Publishing feature under the Content Publishing section. It is dependent on XmlRpc so if you enable it then XmlRpc feature will automatically enabled.

clip_image002

To enable Remote Blog Publishing click the Enable link. After clicking the enable link you will see both of them enabled at once since they are dependent features. After you click Enable, if everything is Ok then you will see following message:

clip_image004

After enabling these modules you are ready to configure Orchard blog in Open Live Writer. Now, launch Live Writer from your Start menu in Windows.

In Blog Accounts section, click on 'Add blog account'

clip_image006

 

When you choose “Add blog account” then you will see below prompt to select the blog service. Choose “Other blog service” from the available options and click Next.

clip_image007

Type the URL to your Orchard blog, along with the admin user name and password that you defined when you set-up Orchard for the first time.

clip_image008

Click Next. Open Live Writer will connect to your blog in order to read the XML-RPC capabilities that Orchard supports and download the current Theme (for previewing posts before publishing). If you are prompted to create a temporary post during this step, select "Yes" in the dialog.

clip_image009

After that it will complete downloading supporting files and template for making blog post writing intuitive.

clip_image010

Once it finishes, you will have window where you can specify the name of your blog you have just configured in Open Live Writer, click Finish.

clip_image011

Now you are ready to write blog post for your Orchard CMS blog.

Prevent minification to manipulate Angular JS controller parameters

In AngularJS controller can have $scope or $http parameters. These must be $scope or $http rather than s or h. Minification process removes extra spaces and convert JavaScript method parameters to single character so that it tries to convert them in single character parameters.

When we declare a controller using the module then most of us just simply specify the controller method as below:

var app = angular.module("githubViewer", []);
//Controller
var MainController = function($scope, $http) {
};

app.controller("MainController", MainController); //MainController is controller method

During the learning, I get to know that during the minification process these parameters are changes to some single character. If these are renamed then AngularJS will not able to find the $scope and $http parameter. It expect them as 6 character $scope and 5 character $http in the controller method. To avoid this happen you need manually specify the parameters name when you specify the controller name and controller method to the module.

app.controller("MainController", ["$scope", "$http", MainController]);

       Hope this help someone to avoid making this mistake..

“Object reference not set to an instance of an object” after install of Visual Studio 2015 Update 3.

Yesterday I have installed update 3 for Visual Studio  2015 Community edition. At that time set failed due to internet disconnection during the installation. Somehow setup completed but when Visual studio was not working correctly. It was showing “Object reference not set to an instance of an object” when try to select any item in visual studio as shown below:

image_thumb[1][3]

Solution
To resolve this issue I have tried to repair the Visual Studio using Program and Features in Control Panel but still the situation is same. After doing some research I found that it is the issue with the configuration setting and common files for the visual studio located at following locations:

  1. C:\Users\{user}\AppData\Local\Microsoft\VisualStudio
  2. C:\Users\{user}\AppData\Local\Microsoft\VSCommon

Delete the content from these folders. If you do this way then all of your user settings such as Visual Studio layout, linked Microsoft account or start page settings get lost.

If you have installed multiple version of the Visual Studio then it is sufficient do delete folder ComponentModelCache on path
C:\Users\{user}\AppData\Local\Microsoft\VisualStudio\{version - 14 or 12}. It will preserve other setting of the Visual Studio. If it does not work then delete all content from the “Visual Studio” folder.

Some times it require to run “devenv /resetuserdata” command to reset the user data of the visual studio. I did it also using the Developer Command Prompt for Visual Studio Console but you can find this command tool at following locations:

  1. [x64] C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
  2. [x86] C:\Program Files\Microsoft Visual Studio 14.0\Common7\IDE

image_thumb[3][3]

Hope it will save time for someone rather doing uninstall or install for Visual Studio again.