Windows Mobile Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Wednesday, 20 June 2012

Visual Studio debugging tips and tricks

Posted on 06:24 by Unknown
Continui seria de posturi (1, 2, 3, 4) despre debug cu un post despre tips and tricks.
Daca in posturile precedente am vorbit despre cum se face debug in Visual Studio in functie de diferite cazuri, astazi vreau sa va prezint cateva tips and tricks din aceata zona.

Make Object Id
Prin acesta functionalitate putem sa facem tracking la un obiect chiar daca am iesit in afara blocului unde a fost declarat. Trebuie sa mentionez ca acest lucru se poate face doar cu reference type. Din fereastra de "Watch" trebuie sa dati click pe variabila pe care o aveti deja adaugata si sa selectati "Make Object ID". In urma acestei actiuni. In urma acestei actiuni o sa observati ca apare o noua variabile cu un nume de genul #1, iar valoarea o sa fie terminata cu "{1#}". Si dupa iesirea din blocul unde erau declarate si folosite, acestea o sa ramana in continuare active.

Immediate Windows
Aceasta fereastra poate sa fie extrem de utila cand este nevoie sa verificam anumite expresii sau sa executati anumite metode. Tot in aceasta fereastra puteti sa afisati/setati si valoarea unei variabile. Aceleasi lucruri se pot face si din Watch Window.

Run to cursor
Prin intermediul acestei functionalitait puteti sa sariti automat la linia de cod unde este cursorul fara sa tot apasati F10 si F11 si fara sa executati codul pana la linia respectiva. Odata ce v-ati pozitionat cursorul pe linia pe care doriti puteti sa dati click dreapta si sa selectati "Run to cursor" sau sa folosti scurtatura "Ctrl+F10".
Breakspoints features
Pe langa a avea un breakpoint in cod puteti sa ii setati diferite conditii sau diferite actiuni. De foarte multe ori se uita de aceasta functionalitate si se tot apasa F10 pana cand ajungeti pe cazul dorit. Acest lucru se poate foarte usor folosind condtiile care se pot atata unui breakpoint.
Un alt lucru destul de dragut care se poate face aici e definirea unei actiuni custom cand un breakpoint este lovit. De exemplu afisarea unui mesaj in fereastra de debug sau executarea unui MACRO. Despre aceste lucruri am vorbit deja in posturile precedente.

Debbuger.Break()
Sunt cazuri cand pe o anumita linie de cod vreti sa omorati aplicatie (break it). Acest lucru se poate face apeland "System.Diagnostics.Debuger.Break()". Atentie, acest lucru merge si in release mode. Pentru a verifica daca sunteti in debug este nevoie sa apelati proprietatea "System.Diagnostics.Debugger.IsAttached".

Debug.Assert()
Foarte utila cand vreti ca in cazul in care aveti asserturi pe care vreti sa le verificati doar in debug. Daca vreti si in productie aceste asserturi sa existe puteti sa folosti Trace.Assert().

View-uri diferite pentru text in format XML/HTML/Text
Orice valoare de tip string pe care o vizualizati in fereastra de Watch Windows poate sa fie vizualizata in diferite moduri. Clieck dreapta pe value si o sa vedeti ca puteti schimba modul de vizualizare (Text, XML sau HTML).

Schimbare valori la orice valoare on the fly
Odata ce sunteti cu mouse-ul deasupra unei valori, iar fereastra care contine valoarea in sine s-a afisat, puteti fara probleme as ii schimbati valoarea din aceastra fereastra fara nici o problema.

Atasare la un debugger la runtime
In cazul in care doriti ca sa fortati userul sa se ataseze la un debugger un anumite conditi, puteti sa faceti acest folosind "System.Diagnostics.Debugger.Launch()". In urma acestui apel userului o sa i se ceara sa selecteze un tool pentru debugging la care procesul nostru sa se lege.
In mod normal codul care face acesta actiune arata in felul urmator:
#if DEBUGi
f (!System.Diagnostics.Debugger.IsAttached)
{
System.Diagnostics.Debugger.Launch();
}
#endif

Exista nenumarate tips and trick-uri pe partea de debug. Ce alte tips and tricks vi se pare foarte utile in aceasta zona?
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in debug, visual studio | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Service Bus Topic - Automatic forward messages from a subscription to a topic
    Windows Azure Service Bus Topic is a service that enables us to distribute the same messages to different consumers without having to know e...
  • CDN is not the only solution to improve the page speed - Reverse Caching Proxy
    I heard more and more often think like this: “If your website is to slow, you should use a CDN.” Great, CDN is THE solution for any kind of ...
  • Content Types - Level 6: Rich Media
    Level 6: Rich Media NOTE: This is part 7 of 7 and the conclusion of this continuing series; please see earlier posts for more background inf...
  • Publishing our CellCast Widget for iPad
    The rush has been on this week as our development team worked to design a new version of our CellCast Widget specifically for Apple's up...
  • Patterns in Windows Azure Service Bus - Message Splitter Pattern
    In one of my post about Service Bus Topics from Windows Azure I told you that I will write about a post that describe how we can design an a...
  • E-Learning Vendors Attempt to Morph Mobile
    The sign should read: " Don't touch! Wet Paint !" I had a good chuckle today after receiving my latest emailed copy of the eLe...
  • SQL - UNION and UNION ALL
    I think that all of us used until now UNION in a SQLstatement. Using this operator we can combine the result of 2 queries. For example we wa...
  • Cum sa salvezi un stream direct intr-un fisier
    Cred ca este a 2-a oara când întâlnesc aceasta cerința in decurs de câteva săptămâni. Se da un stream și o locație unde trebuie salvat, se c...
  • Task.Yield(...), Task.Delay(...)
    I think that a lot of person already heard about these new methods. In this post I want to clarify some things about these new methods that ...
  • Content Types - Level 4: Reference
    Level 4: Reference Materials & Static Content NOTE: This is part 5 of 7 in a continuing series; please see earlier posts for more backgr...

Categories

  • .NET
  • .NET nice to have
  • #if DEBUG
  • 15 iunie 2011
  • 15 octombrie 2011
  • 2011
  • abstracta
  • action
  • adaugare
  • ajax
  • Amsterdam
  • Android
  • aplicatii
  • App Fabric
  • Apple iSlate
  • array
  • as
  • ASP.NET
  • AsReadOnly
  • Assembly comun
  • async
  • Asynchronous programming
  • asyncron
  • Autofac
  • AutoMapper
  • az
  • Azure
  • Azure AppFabric Cache
  • Azure backup solution
  • Azure Storage Explorer
  • azure. cloud
  • backup
  • BCP utility
  • bing maps v7
  • BitArray
  • BlackBerry
  • blob
  • BlobContainerPublicAccessType
  • breakpoint
  • bucuresti
  • C#
  • cache
  • CallerMemberName
  • CellCast
  • Certificate
  • CES
  • change
  • ChannelFactory
  • clasa
  • classinitialize
  • clean code
  • click event
  • close
  • Cloud
  • Cluj
  • cluj-napoca
  • Code contracts
  • code retrat
  • codecamp
  • CollectionAssert
  • Compact Edition
  • compara
  • Comparer T .Default
  • CompareTo
  • comparison
  • comunitate
  • concurs
  • Conditional attribute
  • configurare
  • connection string
  • container
  • content type
  • control
  • Convert
  • convertAll
  • convertor
  • cross platform
  • CRUD
  • css
  • custom properties
  • custom request
  • DACPAC
  • Daniel Andres
  • data sync service
  • database
  • date time
  • datetime
  • debug
  • default
  • delegate
  • dependency injection
  • deploy
  • DeploymentItem
  • design patterns
  • Dev de Amsterdam
  • development stoage
  • dictionary
  • diferente
  • digging
  • director
  • Directory.Exist
  • disable
  • dispatcher
  • dispose
  • dropdown
  • dynamic
  • EF
  • email
  • encoding
  • entity framework
  • enum
  • enumerable
  • Environment.NewLine
  • error
  • error 404
  • error handling
  • eveniment
  • event
  • ews
  • excel
  • exception
  • exchange
  • exita
  • explicit
  • export
  • extension
  • field
  • File.Exist
  • finalize
  • fire and forget
  • Fluent interface pattern
  • format
  • func
  • GC.SuppressFinalize
  • generic
  • getdirectoryname
  • globalization
  • gmail
  • hackathon
  • Hadoop
  • handle
  • HTML
  • html 5
  • Html.ActionLink
  • http://www.blogger.com/img/blank.gif
  • HttpModule
  • IComparable
  • IE
  • ienumerable
  • IIS
  • image
  • implicit
  • import
  • int
  • internationalization
  • Internet Explorer
  • interop
  • Ioc
  • IP Filter
  • iPhone
  • iQuest
  • IStructuralEquatable
  • ITCamp
  • itspark
  • java script
  • javascript
  • July 2012
  • KeyedByTypeCollection
  • KeyNotFoundException
  • Kinect SDK
  • lambda expression
  • LightSwitch Microsoft Silverlight
  • linq
  • list
  • lista
  • lista servicii
  • liste
  • Live Connect
  • Live ID
  • load
  • localization
  • lock
  • m-learning
  • MAC
  • Mango
  • map
  • mapare
  • mapare propietati
  • messagequeue
  • meta properties
  • method
  • MethodImpl
  • Metro App
  • Microsoft
  • Microsoft Sync Framework
  • mlearning
  • mlearning devices
  • Mobile Apps
  • mobile in the cloud
  • mobile learning
  • mobile services
  • Mobile Web
  • mongoDb
  • monitorizare
  • msmq
  • multitasking
  • MVC
  • MVC 3
  • MVVM
  • namespace
  • nextpartitionkey
  • nextrowkey
  • Ninject
  • nivel acces
  • no result
  • normalize
  • nosql
  • null expcetion
  • null object pattern
  • NullReferenceException
  • OAuth API
  • office
  • offline
  • Open ID
  • openhackeu2011
  • operations
  • operator
  • optimization
  • option
  • outputcache
  • OutputCacheProvider
  • override
  • paginare
  • pagination
  • path
  • persistare
  • Portable Library tool
  • Post event – CodeCamp Cluj-Napoca
  • predicate
  • predictions
  • prezentare
  • process
  • proiect
  • property
  • propietati
  • query
  • ReadOnlyCollection
  • ReadOnlyDictionary
  • referinta
  • reflection
  • remote
  • reply command
  • request
  • request response
  • resouce
  • REST
  • REST Client
  • RESTSharp
  • ronua
  • rss
  • rulare
  • salvare in fisier
  • sc
  • schimbare timp
  • select
  • select nodes
  • send
  • serializare
  • serialization
  • Server.Transfer. Resposen.Redirect
  • service bus
  • ServiceBase
  • servicecontroller
  • sesiune
  • session
  • Session_End
  • Session_Start
  • setup
  • Sibiu
  • signalR
  • Silverlight
  • sincronizare
  • Single Responsibility Principle
  • SkyDrive
  • skype
  • smartphones
  • smtp
  • Snapguide
  • sniffer
  • socket
  • solid
  • spec#
  • sql
  • Sql Azure
  • SQL CE
  • sql server 2008 RC
  • SRP
  • startuptype
  • stateful
  • stateless
  • static
  • stergere
  • store
  • store procedure
  • stream
  • string
  • string.join
  • struct
  • StructuralEqualityComparer
  • submit
  • switch
  • Symbian
  • Synchronized
  • system
  • tabele
  • table
  • techEd 2012
  • tempdata
  • test
  • testcleanup
  • testinitialize
  • testmethod
  • thread
  • timer
  • ToLower
  • tool
  • tostring
  • Total Cost Calculator
  • trace ASP.NET
  • transcoding
  • tuplu
  • tutorial
  • TWmLearning
  • type
  • unit test
  • unittest
  • UrlParameter.Optional
  • Validate
  • validation
  • verificare
  • video
  • view
  • ViewBag
  • virtual
  • visual studio
  • VM role
  • Vunvulea Radu
  • wallpaper
  • WCF
  • WebBrower
  • WebRequest
  • where clause
  • Windows
  • windows 8
  • Windows Azure
  • Windows Azure Service Management CmdLets
  • windows live messenger
  • Windows Mobile
  • Windows Phone
  • windows service
  • windows store application
  • Windows Task
  • WinRT
  • word
  • workaround
  • XBox
  • xml
  • xmlns
  • XNA
  • xpath
  • YMesseger
  • Yonder
  • Zip

Blog Archive

  • ►  2013 (139)
    • ►  November (17)
    • ►  October (12)
    • ►  September (10)
    • ►  August (7)
    • ►  July (8)
    • ►  June (15)
    • ►  May (12)
    • ►  April (17)
    • ►  March (16)
    • ►  February (9)
    • ►  January (16)
  • ▼  2012 (251)
    • ►  December (9)
    • ►  November (19)
    • ►  October (26)
    • ►  September (13)
    • ►  August (35)
    • ►  July (28)
    • ▼  June (27)
      • Day 4 of TechEd 2012 - Amsterdam
      • Day 3 of TechEd 2012 - Amsterdam
      • Memento Pattern - the key to unde/redo functionality
      • Day 2 of TechEd 2012 - Amsterdam
      • Serie de turoriale despre debug in Visual Studio
      • Day 1 of TechEd 2012 - Amsterdam
      • How should we treat virtual methods exposed in API...
      • How should we treat virtual methods exposed in APIs
      • XXX takes a dependency on Microsoft.VCLibs.110 fra...
      • How to validate a Windows 8 application
      • Why I cannot use Live account on some Microsoft Se...
      • Applications bugs that can be caused by 'ref' keyword
      • Visual Studio debugging tips and tricks
      • New debugging functionalities in Visual Studio 2012
      • How to secure connection string of a SQL server in...
      • WTF - Package Load Failure - Microsoft.VisualStudi...
      • Some cool stuff debugging with Debugger Canvas
      • Debugging multithreaded applications in Visual Studio
      • Could this be a good case when to use 'params'
      • The provided URI scheme 'file' is invalid; expecte...
      • Base Visual Studio debugging functionalities
      • How to manual create and restore a database from S...
      • Fundamental books for a software engineer (developer)
      • Windows 2008 Server + Office 2007 = InteropService...
      • How to secure connection string of a SQL server in...
      • How to create a setup package for a Metro Applicat...
      • How to backup SQL Azure database using blobs or Da...
    • ►  May (24)
    • ►  April (18)
    • ►  March (17)
    • ►  February (20)
    • ►  January (15)
  • ►  2011 (127)
    • ►  December (11)
    • ►  November (20)
    • ►  October (8)
    • ►  September (8)
    • ►  August (8)
    • ►  July (10)
    • ►  June (5)
    • ►  May (8)
    • ►  April (9)
    • ►  March (14)
    • ►  February (20)
    • ►  January (6)
  • ►  2010 (26)
    • ►  December (1)
    • ►  November (1)
    • ►  October (1)
    • ►  June (2)
    • ►  May (1)
    • ►  April (4)
    • ►  March (1)
    • ►  February (1)
    • ►  January (14)
Powered by Blogger.

About Me

Unknown
View my complete profile