Month: January 2012

Document Outline window for Silverlight

This is one of the greatest features with visual studio when working with Silverlight. It allows you to jump or navigate on the XAML easily. If your Silverlight application has thousands of tags on the page, then you could easily get lost in the XAML code. This feature is very handy in these scenarios.

This window can be opened by clicking on the icon located in bottom left corner of Visual Studio:

Or else you can go to View Menu -> Other Windows -> Select Document Outline menu item. You also can use the short cut key combination Ctrl+W,U.

Microsoft Dynamics CRM Encountered an error

This was one of the issues reported by our QA team during their testing. I have found some discussions which saying that some Javascript code is not working in CRM 2011. So I tried it out by disabling the javascript on the On Save event of the form.

But it was not related Javascripts on OnSave, because there was no scripting in On Save used. I even executed it with the Tracing enabled.

Upon further searching I found out that this Messaging could be disabled by going to File -> Options -> Open the Privacy Tab -> And select either
• Automatically send an error report without asking me permission
• Never send an error report to Microsoft about Microsoft Dynamic CRM

LINQ to SQL Deferred Execution

Deferred execution is one of the important concepts that you need to understand when writing queries in LINQ.

It is highly beneficial  in day to day programming. This concept means that when we write the LINQ query we actually define the query. There is no work or execution done at that point.

The query actually gets executed only when we try to access or iterate through the results.

But there are some operators referred to as greedy operators, which cause the query to execute immediately, for instance the “COUNT” operator is a greedy operator which tells you how many objects in the result sequence. But majority of the LINQ operators are lazy operators, for instance “WHERE, ORDERBY, etc”.

Following is a simple example which uses lazy operators:

public class Program
        public class Student
            public int StudentId { get; set; }
            public string StudentName { get; set; }
            public float GradePointAverage { get; set; }

        public static void Main(string[] args)


        public static void QueryStudentsByAverage() 
            List<Student> _studentList = new List<Student>() 
                new Student{StudentId=100001, StudentName="Smith", GradePointAverage = 16.5f},
                new Student{StudentId=100002, StudentName="James", GradePointAverage = 17.8f},
                new Student{StudentId=100003, StudentName="Anne", GradePointAverage=10.5f},
                new Student{StudentId=100004, StudentName="Jake", GradePointAverage=9.2f}

            IEnumerable<Student> _query = from _student in _studentList
                                          where _student.GradePointAverage > 15.0f
                                          select _student;

            //Even the following line of code is added to the list later because of
            //the deferred execution, the result will be displayed with the following
            //value as well
            _studentList.Add(new Student { StudentId = 100005, StudentName = "Anne", GradePointAverage = 19.2f });

            foreach (var item in _query)
                Console.Write("{0} : {1} : {2}\n", item.StudentId, item.StudentName, item.GradePointAverage);    

CRM workflow registration error

When I was trying to update the plugin I was getting the following error over and over again:

When I expand the error by clicking on the “Yes” button:

The issue was I have declared one of the input arguments, i.e. a reference to the account entity in as follows:

[Input(“Account Id”)]
public InArgument DDIAccountId { get; set; }

Which is in correct. To correct the issue what I did was, because I needed to take the value of a reference.

[Input(“Account Id”)]
public InArgument DDIAccountId { get; set; }

And the workflow got registered successfully.

The report server cannot decrypt the symmetric key….

“The report server cannot decrypt the symmetric key that is used to access sensitive or encrypted data in a report server database. You must either restore a backup or delete all encrypted content. (rsReportServerDisabled)”

When you face this problem follow these steps to solve it.

1. Open the SQL Server Reporting Services Configuration Manager and connect to your Report Server.
2. Select Encrypted Keys from the left pane.
3. Press delete if you do not have a backup. If you have a backup you can restore it. The deleting should be the last option.
4. After that you may have to reset the connection string and credentials to the report.

I faced this problem when I was installing the MS CRM Data Connector for SQL Server Reporting Services with Daynamics CRM 4. I found that the reporting services were giving the above mentioned error.

Creating a CRM Connection with CozyRoc API

Creating a CRM Connection with CozyRoc API I’ve been using CozyRoc SSIS tools for R&D work related to my company work. The out of the box CRM Source and the Destination was not enough for implementing some of the Data upload jobs via SSIS. So I was forced to use the CozyRoc API and create a CRM Source and a Destination using Script Component and Script tasks. Due lack of information related to this on the web I thought it would be ideal to blog what I found.
1. Creating the CRM Connectivity for Script Component Plus or Script Component

public override void PreExecute()
		crmConnectionManager = Connections.Connection;
		_crmConnection = (ICrmConnection)crmConnectionManager.AcquireConnection
	catch (Exception ex)
		MessageBox.Show(ex.ToString(), "Pre execute");

After establishing the CRM Connection then you can use the connectivity for CRUD operations. Following is a simple example of retrieving data. For this I have used Fetch XML string.

fetchString = string.Format("Fetch XML String"); resultString = _crmConnection.Fetch(fetchString);

It is always good practice to close all opned connections. I used the Post Execute method to close the connections as follows.

public override void PostExecute()

2. Creating the CRM Connectivity for Script Task Plus or Script Task

private bool IsDocumentAlreadyImported(string employeeNumber)
	ConnectionManager _connectionManager = Dts.Connections["CrmConnection"];
	ICrmConnection _connection = (ICrmConnection)_connectionManager.AcquireConnection(null);
		_connection.ServerUser = Dts.Variables["UserName"].Value.ToString();
		_connection.ServerPassword = Dts.Variables["Password"].Value.ToString();
		string fetchString = string.Format("Fetch XML String");
		string resultString = _connection.Fetch(fetchString);
		return (resultString.Contains("")) ? false : true;
	catch (DtsConnectionException dtsconnex) { throw new Exception(dtsconnex.ToString()); }
	catch (DtsException dtsex) { throw new Exception(dtsex.ToString()); }
	catch (Exception ex) { throw new Exception(ex.ToString()); }

Successful implementation of Test Automation with Test Driven Development

In today’s world of software development there are may methods and tools involved in implementing test automation. My main intention of writing this blog post is to share my personal experience of implementing test automation.

  • If any of the employees of      the company are not familiar with the test automation we shouldn’t be      trying test automation with major development projects or ongoing      projects.  Initially the employees,      specially the QA Engineers should be given considerable amount of      training. Of course developers have to be trained as well. If the QA      engineers are not familiar with the development tools(for example C#.NET,      Java, VB.NET), then it would be wise to assign couple of developers      together with the QA team to guide or help them.
  • If you are planning to use      SCRUM project management and Test Driven Development then Test Automation      is for you. Actually test automation is there to be implemented with these      Software Development practices. Test Driven Development is, in simpler      terms, where you write the test cases first and then develop the      requirements.  In order to do this      the User Stories(or what ever the means of gathered user requirements)      should be equipped with quality test data.       And when there are no quality test data attached with the user      stories development team will be forced to do the development of the user      requirement and not the test scenarios which will take out the development      team from Test Driven Development. My point here is to implement test      automation, the quality of the user stories are vital. If there are some      test data which are duplicated in several scenarios, then the automated      test scripts will result in bogus outputs. So for the automated test      scripts to be successful the quality of the user story, satisfactory      conditions and the test data is highly important. I’m not saying here is      that everything should be 100% perfect, but it has to have some level of      quality .
  • This has to be written as a      separate test frame work, I’m saying it because if we try to do the      development of the test cases and the system development altogether at      once the development process will end up consuming more time than      expected.  If you are planning to      implement test automation it should be planned properly and it should also      be developed separately so the different projects of the entire company      can utilize this with ease. For example we were involved in developing MS      Dynamics CRM solution.  So for some      of the user stories, it took only matter of hours to implement the user      requirement, but to do the automated test implementation the developers      has to spend hours and even days to write the test case and scripts,      because one simple functionality involved many other scenarios to become      true.  If all the generic      functionality would have been written in first place then then this      unnecessary time wastage would have been eliminated. Therefore this has to      be designed and developed separately as a mini project and get all the      generic components build and tested. You may not be able to use it with      your ongoing projects, but that is Ok, I’m sure that any project lead,      program manager, architect, etc  out      there don’t want their projects to run away from the planned cost and time      lines.

If you can get the test automation implementation properly planned then, yes, it can benefit you a lot.