Showing posts with label Tools. Show all posts
Showing posts with label Tools. Show all posts

Friday, January 7, 2011

Attaching debugger to .NET Compact Framework on mobile device (or emulator)

How to attach debugger to .NET Compact Framework running on the mobile device emulator

Enable Managed debugging on the mobile device - by default it is disabled to not affect performance.

Run Visual Studio Remote Tools> Remote Registry Editor and choose the Mobile Device/Emulator

Add/Change following key in registry

Go to the :
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETCompactFramework/Managed Debugger/ and set the AttachEnabled value to 1

if the 'Managed Debugger' key does not exist just create it, the same with AttachEnabled value (new DWORD Value with name: AttachEnabled and value: 1)

In the Visual Studio go to Debug > Attach to Process
In the Transport choose Smart Device
Browse for your Device/Emulator
Choose the application and attach debugger ( if an application have been opended before making changes in the Device Registry you may have to restart the application )

Right now (if the symbols are loaded) you can start debugging application. Voila!

Friday, February 26, 2010

Migrating ClickOnce deployment to IIS7 and Fiddler Web Debugger

After migrating ClickOnce deployment to IIS7 I tried to install the application I got following exception:

System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
 - Downloading file_name_.extension did not succeed.

I have checked the log but still I could not figure out what exactly was wrong and my colleague suggested using the Fiddler (thanks Benny!) – great Web Debugging Proxy which logs all HTTP(S) traffic between your computer and the Internet. The Fiddler allows you to inspect all HTTP(S) traffic, set breakpoints, and "fiddle" with incoming or outgoing data. Fiddler includes a powerful event-based scripting subsystem, and can be extended using any .NET language.

Fiddler helped me found out that there were some missing MIME types configured on IIS 7. IIS uses a default list of global MIME types to determine which types of content to serve. If a client requests a MIME type that is not defined on the Web server, IIS returns a 404.3 error (according to MSDN). To fix this I had to add those missing MIME types in the IIS7 configuration.

After adding MIME types to the configuration I got again the same exception but this time a ".config" file could not be downloaded and again the Fiddler helped me figure out what was wrong. This time it was Request Filtering - IIS7 has really many types denied in request filtering by default. If your ClickOnce application contains .config file you have to allow this extension in request filtering feature.
After allowing the ".config" extension in request filtering feature in IIS7 the deployment started to work. Problem solved.

Thursday, February 11, 2010

SQL Server Management Tools installation problem and Windows Installer CleanUp Utility tool

Recently I had to install SQL Server 2005 with Management Tools, however setup complained about already installed Client Tools from SQL Server Express Edition. I tried to find the SQL Express Edition from Add/Remove Programs but it was not there! The Windows Installer CleanUp Utility (free tool!) came with help. After removing the Express Edition the SQL Server 2005 installed Management Tools without any problems.

Sunday, January 24, 2010

Setting up playground bug tracking system (Bugzilla on Win7 and IIS 7)

I have decided to improve my coding playground by setting up bug tracking system. I took a look at some open source tools and decided to install Bugzilla (http://www.bugzilla.org) which is widely used in many organizations and projects. I use Windows 7 and instead of recommended Apache server I used IIS 7.

Information on how to set up Bugzilla on windows environment can be found here: https://wiki.mozilla.org/Bugzilla:Win32Install
Most of the installation steps are quite straightforward; anyway it takes a lot of time to install and configure all the required components.

NOTE: if you plan to use smtp.gmail.com as SMTP do not install Perlx64 but Perlx86 (I could not install the required Email-Send-Gmail perl package)

There were a couple of issues during installation… The default installation of IIS 7 on Windows 7 is missing some required modules like ISAPI extensions etc. Click here for instructions how to do it.

Adding Script Modules on IIS 7 is quite different then on previous versions of IIS which goes like this: Select the virtual directory in the IIS (e.g. Bugzilla), then open feature Handler Mappings then 'Add Script Map' from context menu. Two Script Maps has to be added – for Perl and for CGI; for both choose Execute in Edit Feature Permissions.

For Perl type as follows (providing correct path)
Request path: *.pl
Executable: c:\Perl\bin\perl.exe "%s" %s
Name: Perl Script Map
Press 'OK'
Say 'YES' to ISAPI message

And the CGI:
Request path: *.cgi
Executable: c:\Perl\bin\perl.exe -xc:\bugzilla -wT "%s" %s
Name: CGI Script Map
Press 'OK'
Say 'YES' to ISAPI message

After running "checksetup.pl" from <BugzillaFolderPath> I got notifications about some missing required Modules so I had to execute following commands and again run checksetup.pl

ppm install DateTime
ppm install DateTime-TimeZone
ppm install Template-Toolkit
ppm install Email-Send
ppm install Email-MIME
ppm install Email-MIME-Encodings
ppm install Email-MIME-Modifier

Now, after executing 'checksetup.pl' the localconfig file was created and has to be updated with correct mySQL db_pass and db_port information

Since Bugzilla requires an SMTP to function on Windows another problem occurred because SMTP/POP service is not included in Win 7 J I have used smtp.gmail.com since I have an account there… however it does not work!

Gmail uses TSL protocol and to make it work some hack is required as described here.

After providing the necessary information you should be able to access http://localhost/Bugzilla or whatever name you have chosen for the virtual directory in IIS.

Friday, October 23, 2009

SyntaxHighlighter

SyntaxHighlighter is an excellent tool for highlighting code syntax in blog posts. It works with many different languages, here is the full list.

If you'd like to see how your code is going to look, take a look at this post about Trace statements , I updated it to use the SyntaxHighlighter.

The tool is completely free of charge. You don't even have to download anything, just use hosted version and voila.

Its creator definitively deserves a couple of beers!

Wednesday, September 23, 2009

FxCop

FxCop is a great free tool for static code analysis, which checks managed code assemblies for compliance with .NET Framework Design Guidelines. FxCop is available both as GUI and a command line tool, so it can be easily used in build process. Certain messages can be excluded from future reports if you can intentionally avoid rules. New custom rules can be created using FxCop SDK.

If you recently updated Windows SDK to version 7, the FxCop installation file can be found in the Windows SDK v7.0/Tools/ directory.

To use GUI version of FxCop just start the application, add targets i.e. assembly or assemblies which you want to check and click Analyze button. After a while, depending on the assembly size, you will get the report.


Every message should be reviewed and one of the following actions should be taken

  • If there is a code defect - fix the code
  • If rule broken intentionally – exclude message
  • If message generated is false– exclude message

After you fix the code for all other messages rebuild the assembly and analyze the code again.

FxCop is great tool for all .NET developers, especially for these who are not familiar with .NET Framework Design Guidelines. FxCop can help you write robust and easily maintainable .NET Framework code.

Saturday, March 14, 2009

Posting to blog from Word 2007

If you are blogging the Word 2007 has a very nice feature for you - you can post to your blog from Word 2007!

How to do this:

  1. Click the Office button in the top left corner
  2. Click Publish\Blog - it will open new window
  3. Register a blog account 
  4. Choose blog provider
  5. Provide user name and password
  6. Optionally click picture options - you can provide details for picture provider
  7. Now create your post and when it is ready click the Publish button

Except of posting directly to your blog, you can publish a post as a draft or open an existing post for editing!



Unfortunately it seems that there is one flaw - security. If you try to set blog provider to the blogger (I have not checked other providers) in Word 2007, it says that a user name and a password will be visible to other people... It is for sure not the way it should work. Revealing user/pass details to the whole world is just not good idea.

I was searching for a solution. But have not found anything yet. It is impossible that no one thought about the security.

If anyone knows how to use it a secure manner please leave a comment and let me know.