Wednesday, February 04, 2009
An error occurred when verifying security for the message
- Check if the time on the server and the time on the client does not match.
Thursday, January 08, 2009
Resharper, Stylecop and type members layout
<Patterns xmlns="urn:shemas-jetbrains-com:member-reordering-patterns">
<!--Do not reorder COM interfaces-->
<Pattern>
<Match>
<And Weight="100">
<Kind Is="interface"/>
<HasAttribute CLRName="System.Runtime.InteropServices.InterfaceTypeAttribute"/>
</And>
</Match>
</Pattern>
<!--Special formatting of NUnit test fixture-->
<Pattern RemoveAllRegions="true">
<Match>
<And Weight="100">
<Kind Is="class"/>
<HasAttribute CLRName="NUnit.Framework.TestFixtureAttribute" Inherit="true"/>
</And>
</Match>
<!--Setup/Teardow-->
<Entry>
<Match>
<And>
<Kind Is="method"/>
<Or>
<HasAttribute CLRName="NUnit.Framework.SetUpAttribute" Inherit="true"/>
<HasAttribute CLRName="NUnit.Framework.TearDownAttribute" Inherit="true"/>
<HasAttribute CLRName="NUnit.Framework.FixtureSetUpAttribute" Inherit="true"/>
<HasAttribute CLRName="NUnit.Framework.FixtureTearDownAttribute" Inherit="true"/>
</Or>
</And>
</Match>
</Entry>
<!--All other members-->
<Entry/>
<!--Test methods-->
<Entry>
<Match>
<And Weight="100">
<Kind Is="method"/>
<HasAttribute CLRName="NUnit.Framework.TestAttribute" Inherit="false"/>
</And>
</Match>
<Sort>
<Name/>
</Sort>
</Entry>
</Pattern>
<!--Default pattern-->
<Pattern RemoveAllRegions="true">
<!--Delegates-->
<Entry>
<Match>
<And Weight="100">
<Access Is="public"/>
<Kind Is="delegate"/>
</And>
</Match>
<Sort>
<Access Order="public internal protected-internal protected private" />
<Name/>
</Sort>
</Entry>
<!--Fields and constants-->
<Entry>
<Match>
<Or>
<Kind Is="field"/>
<Kind Is="constant"/>
</Or>
</Match>
<Sort>
<Access Order="public internal protected-internal protected private" />
<Kind Order="constant"/>
<Readonly/>
<Static/>
<Name/>
</Sort>
</Entry>
<!--Enums-->
<Entry>
<Match>
<Kind Is="enum"/>
</Match>
<Sort>
<Access Order="public internal protected-internal protected private" />
<Name/>
</Sort>
</Entry>
<!--Constructors. Place static one first-->
<Entry>
<Match>
<Kind Is="constructor"/>
</Match>
<Sort>
<Static/>
<Access Order="public internal protected-internal protected private" />
</Sort>
</Entry>
<!--Destructors. Place static one first-->
<Entry>
<Match>
<Kind Is="destructor"/>
</Match>
<Sort>
<Static/>
<Access Order="public internal protected-internal protected private" />
</Sort>
</Entry>
<!-- Events -->
<Entry>
<Match>
<Kind Is="event"/>
</Match>
<Sort>
<Access Order="public internal protected-internal protected private" />
<Name/>
</Sort>
</Entry>
<!--Properties-->
<Entry>
<Match>
<And>
<Kind Is="property"/>
<Not>
<Kind Is="indexer"/>
</Not>
</And>
</Match>
<Sort>
<Access Order="public internal protected-internal protected private" />
<Static/>
<Abstract/>
<Virtual/>
<Override/>
<Name/>
</Sort>
</Entry>
<!--Indexers-->
<Entry>
<Match>
<Kind Is="indexer"/>
</Match>
<Sort>
<Access Order="public internal protected-internal protected private" />
<Static/>
<Abstract/>
<Virtual/>
<Override/>
<Name/>
</Sort>
</Entry>
<!--Methods-->
<Entry>
<Match>
<And>
<Or>
<Kind Is="method"/>
<Kind Is="operator"/>
<HandlesEvent />
</Or>
<Not>
<Kind Is="destructor"/>
</Not>
</And>
</Match>
<Sort>
<Access Order="public internal protected-internal protected private" />
<Static/>
<Abstract/>
<Virtual/>
<Override/>
<Name/>
</Sort>
</Entry>
<!--all other members-->
<Entry/>
<!--nested types-->
<Entry>
<Match>
<Kind Is="type"/>
</Match>
<Sort>
<Access Order="public internal protected-internal protected private" />
<Static/>
<Abstract/>
<Virtual/>
<Override/>
<Name/>
</Sort>
</Entry>
</Pattern>
Now, choose Cleanup Code.
( tnx to Jordan Dimitrov)
Monday, December 29, 2008
Add file header
Sub AddFileHeader()
DTE.ActiveDocument.Selection.StartOfDocument()
DTE.ActiveDocument.Selection.Text = "//-----------------------------------------------------------------------"
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// <copyright file=""" + DTE.ActiveDocument.Name() + """ company=""MyCompany d.o.o."">"
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// Copyright (c) MyCompany d.o.o. All rights reserved."
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// </copyright>"
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "//-----------------------------------------------------------------------"
DTE.ActiveDocument.Selection.NewLine(2)
End Sub
Friday, December 26, 2008
Visual Studio - Create Blank Solution
To create blank solution do the following:
On the File menu, select New and then click Project.
In the Project types pane, select Other Project Types and then select Visual Studio Solutions.
In the Templates pane, select Blank Solution.
Thursday, December 18, 2008
Visual studio test environment and provide additional files
- Add test.xml to test project
- Set "Copy to output directory" property of file to "Copy always"
- For test method add [DeploymentItem("test.xml")] attribute.
Get current exe assembly folder location
string folderPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
Thursday, December 11, 2008
ASP.NET IIS trouble
One of the possible error messages can be: "Failed to access IIS metabase", or "service unavailable"...
To repair ASP.NET you should run:
aspnet_regiis -u
aspnet_regiis -i
It worked for me :)
Monday, December 08, 2008
This will save you some time
Wednesday, December 03, 2008
Get calling method name
System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace();
System.Diagnostics.StackFrame stackFrame = stackTrace.GetFrame(1);
System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
string methodName = methodBase.Name;
Console.WriteLine("Method name: "+ methodName);
Tuesday, December 02, 2008
ctor snippet upgrade
///
/// Initializes a new instance of the MyClass class.
///
In order to do this automatically you can use SnippetDesigner (or you can do it by yourself) to change default ctor snippet.
It should be:
///
/// Initializes a new instance of the $classname$ class.
///
public $classname$ ()
{
$end$
}
Snippet location is:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC#\Snippets\1033\Visual C#\ctor.snippet