Today I got this error while debugging my silverlight application and the debugger just crashed without any useful error information. I got this error when the debugger crashed:
"The debugger cannot continue running the process. Process was terminated."
After doing some debugging and research I found this thread online where in many people had the same issue because of recursive call in class property:
http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/f9b08dd4-8d20-4104-9a24-9f002caceb48/
I looked at my code and indeed I had a recursive call in one of my property by mistake.
private bool isUser;
public bool IsUser
{
get { return IsUser; }
set
{
IsUser = value;
OnPropertyChanged( "IsUser" );
}
}
As you can see in the above code my getter was recursively referring to IsUser property itself instead of the field isUser. This was just coding error but it took some time to figure out the root cause as the debugger was crashing without proper error information.
Tuesday, January 25, 2011
Tuesday, October 26, 2010
Date format in WPF/Silverlight
Here is an example for formatting date in WPF (Format: MM/DD/YYYY):
<TextBlock Text="{Binding CreationDate, StringFormat=\{0:MM/dd/yyyy\}}" />
<TextBlock Text="{Binding CreationDate, StringFormat=\{0:MM/dd/yyyy\}}" />
Wednesday, September 22, 2010
Error when referencing assembly from network share - Silverlight 4 (.NET Framework 4.0)
I got this error today when I added reference to an assembly from network share:
"Error 3 Could not load the assembly file://\\CM\libraries\Microsoft\Rx\Reactive Extensions v1.0.2677.0\SL4\System.Observable.dll. This assembly may have been downloaded from the Web. If an assembly has been downloaded from the Web, it is flagged by Windows as being a Web file, even if it resides on the local computer. This may prevent it from being used in your project. You can change this designation by changing the file properties. Only unblock assemblies that you trust".
I am using Silverlight 4 (.NET Framework 4.0).
To fix this issue I added following entry in the Visual Studio 2010 devenv.config file.
< loadFromRemoteSources enabled="true" />
To the runtime section of:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config
"Error 3 Could not load the assembly file://\\CM\libraries\Microsoft\Rx\Reactive Extensions v1.0.2677.0\SL4\System.Observable.dll. This assembly may have been downloaded from the Web. If an assembly has been downloaded from the Web, it is flagged by Windows as being a Web file, even if it resides on the local computer. This may prevent it from being used in your project. You can change this designation by changing the file properties. Only unblock assemblies that you trust".
I am using Silverlight 4 (.NET Framework 4.0).
To fix this issue I added following entry in the Visual Studio 2010 devenv.config file.
< loadFromRemoteSources enabled="true" />
To the runtime section of:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config
Wednesday, August 18, 2010
SQL Script to Create a Database
Note: You will need to modify lines 2 and 4 to adjust the file paths for the data and log files to land the database on your files system wherever you want it. That should be the only modifications needed.
----------------------------------------
CREATE DATABASE [MyDatabase] ON PRIMARY
( NAME = N'MyDatabase_data', FILENAME = N'C:\SQL\Data\MyDatabase.mdf' , SIZE = 1048576KB , FILEGROWTH = 10%)
LOG ON
( NAME = N'MyDatabase_log', FILENAME = N'C:\SQL\Log\MyDatabase.ldf' , SIZE = 220160KB , FILEGROWTH = 10%)
GO
EXEC dbo.sp_dbcmptlevel @dbname=N'MyDatabase', @new_cmptlevel=90
GO
ALTER DATABASE [MyDatabase] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [MyDatabase] SET ANSI_NULLS OFF
GO
ALTER DATABASE [MyDatabase] SET ANSI_PADDING OFF
GO
ALTER DATABASE [MyDatabase] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [MyDatabase] SET ARITHABORT OFF
GO
ALTER DATABASE [MyDatabase] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [MyDatabase] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [MyDatabase] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [MyDatabase] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [MyDatabase] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [MyDatabase] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [MyDatabase] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [MyDatabase] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [MyDatabase] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [MyDatabase] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [MyDatabase] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [MyDatabase] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [MyDatabase] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [MyDatabase] SET READ_WRITE
GO
ALTER DATABASE [MyDatabase] SET RECOVERY SIMPLE
GO
ALTER DATABASE [MyDatabase] SET MULTI_USER
GO
ALTER DATABASE [MyDatabase] SET PAGE_VERIFY CHECKSUM
GO
USE [MyDatabase]
GO
IF NOT EXISTS (SELECT name FROM sys.filegroups WHERE is_default=1 AND name = N'PRIMARY') ALTER DATABASE [MyDatabase] MODIFY FILEGROUP [PRIMARY] DEFAULT
GO
----------------------------------------
CREATE DATABASE [MyDatabase] ON PRIMARY
( NAME = N'MyDatabase_data', FILENAME = N'C:\SQL\Data\MyDatabase.mdf' , SIZE = 1048576KB , FILEGROWTH = 10%)
LOG ON
( NAME = N'MyDatabase_log', FILENAME = N'C:\SQL\Log\MyDatabase.ldf' , SIZE = 220160KB , FILEGROWTH = 10%)
GO
EXEC dbo.sp_dbcmptlevel @dbname=N'MyDatabase', @new_cmptlevel=90
GO
ALTER DATABASE [MyDatabase] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [MyDatabase] SET ANSI_NULLS OFF
GO
ALTER DATABASE [MyDatabase] SET ANSI_PADDING OFF
GO
ALTER DATABASE [MyDatabase] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [MyDatabase] SET ARITHABORT OFF
GO
ALTER DATABASE [MyDatabase] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [MyDatabase] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [MyDatabase] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [MyDatabase] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [MyDatabase] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [MyDatabase] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [MyDatabase] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [MyDatabase] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [MyDatabase] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [MyDatabase] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [MyDatabase] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [MyDatabase] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [MyDatabase] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [MyDatabase] SET READ_WRITE
GO
ALTER DATABASE [MyDatabase] SET RECOVERY SIMPLE
GO
ALTER DATABASE [MyDatabase] SET MULTI_USER
GO
ALTER DATABASE [MyDatabase] SET PAGE_VERIFY CHECKSUM
GO
USE [MyDatabase]
GO
IF NOT EXISTS (SELECT name FROM sys.filegroups WHERE is_default=1 AND name = N'PRIMARY') ALTER DATABASE [MyDatabase] MODIFY FILEGROUP [PRIMARY] DEFAULT
GO
Tuesday, August 10, 2010
Tuesday, April 14, 2009
MS Visual SourceSafe - Unable to open user login file error
Today when I opened my MS Visual SourceSafe, following error popped up. Same error with MS Visual Studio too.
"Unable to open user login file \\[server name]\data\loggedin\guru.rao.log"
I could not find this log file in the SourceSafe server. I created an empty "guru.rao.log" file in the server location and it fixed the problem.
"Unable to open user login file \\[server name]\data\loggedin\guru.rao.log"
I could not find this log file in the SourceSafe server. I created an empty "guru.rao.log" file in the server location and it fixed the problem.
Friday, January 9, 2009
C# naming convention for constants
When I was working on C++, my naming convention for constants was to be ALL_CAPS. In C# the recommended naming convention for constants is Pascal casing (starts with upper case).
private const int MaxLimit = 100;
Even though it is a private field, it is not a variable and it cannot be accessed using "this" object within your class. Hence I prefer using Pascal casing to differentiate it with variable members, which are in Camel casing (starts with lower case) as per .NET naming convention.
Microsoft has come up with this cool tool named StyleCop that documents all the preferred conventions and it can also check your source code for compliance.
Check out this link for more information on StyleCop.
http://code.msdn.microsoft.com/sourceanalysis
private const int MaxLimit = 100;
Even though it is a private field, it is not a variable and it cannot be accessed using "this" object within your class. Hence I prefer using Pascal casing to differentiate it with variable members, which are in Camel casing (starts with lower case) as per .NET naming convention.
Microsoft has come up with this cool tool named StyleCop that documents all the preferred conventions and it can also check your source code for compliance.
Check out this link for more information on StyleCop.
http://code.msdn.microsoft.com/sourceanalysis
Subscribe to:
Posts (Atom)