ãã°ã¯ãã³ãŒãã©ã€ããµã€ã¯ã«ã®2ã€ã®æ®µéã§çºçããŸããéçºäžãšå®çšŒåäžã§ãã å€ãã®å Žåãã³ãŒããèšè¿°ããç¬éãã10ã15å以å ã«çºçãããšã©ãŒã¯ãã°ãšã¯èŠãªãããŸããããããã¯ãã³ãŒããèšè¿°ããããã»ã¹ã®äžéšã«ãããŸããã ãŸããæ¬çªç°å¢ãæ°æ¥åã«èšè¿°ãããã³ãŒãããã¹ããããšãã«çºçããåé¡ãšåŒã°ãããã°ããããããŸãã ãããããããããã£ããããã®ãé£ããããã§ãïŒã³ãŒãã¯ãã§ã«å¿ããããŠããŸãïŒã ãããã«ãããã³ãŒããæå³ãããšããã«åäœããªãå Žåãããã¯ãã°ã§ããããã£ããããŠä¿®æ£ããå¿ èŠããããŸãã
å¹ççãªãããã°ã®4ã€ã®æ±
- é©åãªããŒã«ã ãããèšäºã®ç®çã§ãã ããããä»ã®3ã€ããªããã°ããŒã«ã¯åœ¹ã«ç«ã¡ãŸããã
- ççµåãªããžã§ã¯ããåªå ããã¢ãŒããã¯ãã£ãšã³ãŒãæ§ç¯ãã©ã¯ãã£ã¹ã®äœ¿çšãšãç§ãæ¬åœã«æããã«ã³ãŒããšåŒãã§ãããã®ã®äœæ-ROCããã¯ïŒ ãããã®ãã©ã¯ãã£ã¹ã¯ããã°ãèŠã€ããã®ã«åœ¹ç«ã¡ãæ°ãããã°ãè¿œå ããã ãã®å€æŽãè¡ããªãããã«ããŸãã ãããŠã ãã©ã€ã¢ã³W.ã«ãŒããã³ãšPJãã©ãŠã¬ãŒã®ãããã°ã©ãã³ã°ã¹ã¿ã€ã«ã®èŠçŽ ãïŒComputing Mcgraw-Hillã1978ïŒãèªã¿çŽãã®ã«é ãããããšã¯ãããŸããã
- TDDïŒãã¹ãã«ããéçºïŒã䜿çšããŸãã é«åºŠã«æ¥ç¶ããããŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ä»¥å€ã®äœããéçºããŠããŠãTDDã䜿çšããŠããªãå Žåãããªãã¯çæã§èäžãçžãããéçºè ã§ãã çç£æ§ãèªåãããäœããªããã³ãŒãã®ä¿¡é Œæ§ãæ¬æ¥ãããäœããªããŸãã
- ãããã°ææ³ã å€ãã®éçºè ã¯ããã«ããœãªã¥ãŒã·ã§ã³éçºãã®æé ã«é²ã¿ãŸãããã®çµæããã°ä¿®æ£ã«ã€ãªããããšã¯ã»ãšãã©ãããŸããããå€ãã®å Žåãæ°ããä¿®æ£ãäœæãããŸãã
ãããã°ææ³
TDDã䜿çšããå Žåããã°ãšã¯æ¬¡ã®3ã€ã®ãããããæå³ããŸããèŠä»¶ããã¹ãã«æ£ããå€æãããŠããªãã 䜿çšå¯èœãªãã¹ãã®1ã€ãæ£ãããããŸããïŒãã¹ããå®è¡ããªãã§ãã ããïŒã ããã€ãã®ãã¹ããæ¬ èœããŠããŸãã ãã°ã®ä¿®æ£ïŒã¹ããã2ïŒã¯ããã¹ããä¿®æ£ãŸãã¯è¿œå ããããšã«ãããããã3ã€ã®åé¡ã調æ»ããããšã§ãã ãœãªã¥ãŒã·ã§ã³ã®ãã§ãã¯ïŒã¹ããã5ïŒã¯ãæ°ãããã¹ãã®äœæãæå³ããŸãã ååž°ãã¹ãïŒã¹ããã6ïŒã¯ãå¿ èŠãªãã¹ãã¹ã€ãŒãã®èµ·åãæå³ããŸãã ãœãªã¥ãŒã·ã§ã³ã®ã¢ããªã±ãŒã·ã§ã³ã«ã¯ãæ°ãããã¹ãã®ã«ã¿ãã°åãå«ãŸããŸãã
- ãã°ã説æããŠãã ããã ãã°ã®çç¶ãå®å šã«èª¬æããããã«ãã¹ãŠã®æ å ±ãåéããçç¶ãçŸãããšããšçŸããªããšãã«çŠç¹ãåãããŸãã
- ãã°ãä¿®æ£ããŸãã åžžã«ãã°ã«ã€ãªããäžé£ã®ã¢ã¯ã·ã§ã³ã説æããŸãã ãã®ããããã°ã®çç¶ãçŸããåå ãšãªãæ¡ä»¶ãæ£ããèå¥ããå¿ èŠããããŸãã ä»ã®æ¡ä»¶äžã§ã¯çç¶ãçŸããªãããšã確èªããŠãã ããã
- ãã°ãç¹å®ããŸãã ãã°ãçºçããçã®çç±ãæ£ç¢ºã«èª¬æã§ããããšãããã³èª¬æãæé 1ãš2ã«äžèŽããŠããããšã確èªããŠãã ããã
- ãœãªã¥ãŒã·ã§ã³ãèšèšããŠé©çšããŸãã ãã°ã®çã®åå ãŸãã¯ãã®çç¶ã«èŠåŽããŠãããã©ãããå€æããŸãã ã³ãŒããæžããŸãã
- ãœãªã¥ãŒã·ã§ã³ã確èªããŠãã ããã æé 2ã§èª¬æããæé ã§çç¶ã衚瀺ãããªããªã£ãããšã確èªããŸãã
- ååž°ãã¹ããå®è¡ããŸãã æ°ãããã°ããªãããšã確èªããŠãã ããã
- å€æŽãé©çšããŸãã å€æŽãæ¬çªã«è»¢éããŸãã
TDDã䜿çšããå Žåããã°ãšã¯æ¬¡ã®3ã€ã®ãããããæå³ããŸããèŠä»¶ããã¹ãã«æ£ããå€æãããŠããªãã 䜿çšå¯èœãªãã¹ãã®1ã€ãæ£ãããããŸããïŒãã¹ããå®è¡ããªãã§ãã ããïŒã ããã€ãã®ãã¹ããæ¬ èœããŠããŸãã ãã°ã®ä¿®æ£ïŒã¹ããã2ïŒã¯ããã¹ããä¿®æ£ãŸãã¯è¿œå ããããšã«ãããããã3ã€ã®åé¡ã調æ»ããããšã§ãã ãœãªã¥ãŒã·ã§ã³ã®ãã§ãã¯ïŒã¹ããã5ïŒã¯ãæ°ãããã¹ãã®äœæãæå³ããŸãã ååž°ãã¹ãïŒã¹ããã6ïŒã¯ãå¿ èŠãªãã¹ãã¹ã€ãŒãã®èµ·åãæå³ããŸãã ãœãªã¥ãŒã·ã§ã³ã®ã¢ããªã±ãŒã·ã§ã³ã«ã¯ãæ°ãããã¹ãã®ã«ã¿ãã°åãå«ãŸããŸãã
ãã¬ãŒã¯ãã€ã³ãã䜿çšãã
å€ãã®éçºè ã¯ããããã°ãããã®ããã«æ©èœããããããVisual Studioã®ãã¹ãŠã®ãããã°æ©èœãç¥ããŸããã ããšãã°ããã¹ãŠã®VSéçºè ã¯ãã¬ãŒã¯ãã€ã³ãã«ç²ŸéããŠããŸãããå€ãã®äººã¯[ãã¬ãŒã¯ãã€ã³ã]ãŠã£ã³ããŠã§äœãã§ããããç¥ããŸããã
[ãã¬ãŒã¯ãã€ã³ã]ãŠã£ã³ããŠãéãã«ã¯ã[ãããã°] | [ Windows | ãã¬ãŒã¯ãã€ã³ã ãŠã£ã³ããŠã«ã¯ãèšå®ãããã¹ãŠã®ãã¬ãŒã¯ãã€ã³ãã®ãªã¹ãã衚瀺ãããŸãã ã©ã®ãã€ã³ããã©ã®ã³ãŒãè¡ã«å¯Ÿå¿ãããããããªãå Žåã¯ããããããã«ã¯ãªãã¯ããã ãã§ãé¢é£ããã³ãŒãããšãã£ã¿ãŒã§éããŸãã
ç®çã®ãã€ã³ãã決å®ããããåäœæã«äœãèµ·ããããå¶åŸ¡ã§ããŸãã åãå€æ°ãç¹°ãè¿ããã§ãã¯ããã«ãŒãã«ãã¬ãŒã¯ãã€ã³ããèšå®ããéçºè ãèŠãŸããã ãã¬ãŒã¯ãã€ã³ããå³ã¯ãªãã¯ããŠ[ãããæïŒããªã¬ãŒæ¡ä»¶ïŒ]ãéžæãããšãããªã¬ãŒããããã³ã«äžéãŠã£ã³ããŠã«è¡šç€ºãããã¡ãã»ãŒãžãæå®ã§ããŸãã ã¡ãã»ãŒãžã«ããã€ãã®å®æ°ãå«ããããšãã§ããŸããããšãã°ã$ Callerã䜿çšãããšããã¬ãŒã¯ãã€ã³ããå«ãã³ãŒããåŒã³åºããã¡ãœããã®ååã衚瀺ã§ããŸãã ãŸããå€æ°ãäžæ¬åŒ§ã§å²ãããšã«ãããå€æ°ãå«ããããšãã§ããŸããããšãã°ãã¡ãã»ãŒãžå ã®{Me.NameTextBox.Text}ã¯ãTextãã£ãŒã«ãã®å€ã衚瀺ããŸãã
When Hitãã€ã¢ãã°ã®å¥ã®ãªãã·ã§ã³ã§ã¯ãããã°ã©ã ããã¬ãŒã¯ãã€ã³ãã§åæ¢ãããã©ãããæå®ã§ããŸãã åæ¢ãéžæãããšãäœææã«åã¡ãã»ãŒãžã衚瀺ãããŸãã ããããªããšãããã°ã©ã ã®å®è¡åŸã«ãã¹ãŠã®ã¡ãã»ãŒãžã衚瀺ã§ããŸãã
ç¹å®ã®æ¡ä»¶äžã§ã®ã¿å®è¡ãåæ¢ããå Žåã¯ã[æ¡ä»¶]ãŸãã¯[ãããã«ãŠã³ã]ãªãã·ã§ã³ãéžæã§ããŸãã [æ¡ä»¶]ãªãã·ã§ã³ã䜿çšãããšãåæ¢ãçºçããè«çæ¡ä»¶ãèšå®ã§ããŸãïŒããšãã°ãPosition> 30ïŒã æåŸã®åæ¢ä»¥éã«å€æ°ã®1ã€ãå€æŽãããå Žåãåæ¢ã§ããŸãã Hit Countãªãã·ã§ã³ã¯ããã¬ãŒã¯ãã€ã³ããnåïŒãŸãã¯nåããšïŒããªã¬ãŒãããå Žåã«ã®ã¿å®è¡ãäžæããŸãã ããã¯ããµã€ã¯ã«ã®çµããã«ã©ããã§åæ¢ããå¿ èŠãããå Žåã«ç¹ã«äŸ¿å©ã§ãã
ã¡ãªã¿ã«ãç§ã®çµéšã§ã¯ãã¢ããªã±ãŒã·ã§ã³ã®äžéšã§åé¡ãçºçããå ŽåãåŒãç¶ãåé¡ãçºçããŸãã çµéšããåãããšãèšããã°ãVisual Studio 2010ã®è¿œå æ©èœãæ°ã«å ¥ã£ãŠããŸãããã¬ãŒã¯ãã€ã³ãã«ååãä»ããŠãããããã®ç®çãèšæ¶ããXMLãã¡ã€ã«ã«ãšã¯ã¹ããŒãã§ããŸãã 次åããããå¿ èŠã«ãªã£ãããããããã€ã³ããŒãããŠãããã°ãéå§ã§ããŸãã ã€ã³ããŒã/ãšã¯ã¹ããŒãã¯ããã¬ãŒã¯ãã€ã³ããŠã£ã³ããŠã®äžéšã«ããããŒã«ããŒã䜿çšããŠå®è¡ã§ããŸãã
ã³ãŒãã衚瀺ããŠã¹ããã
ã³ãŒãçæã奜ãã§ãïŒ.NETã§ãããè¡ãæ¹æ³ã«é¢ããæ¬ãæžããŸããïŒã ããããååãšããŠãã¹ã¿ãžãªãšãã¬ãŒã ã¯ãŒã¯ã«ãã£ãŠçæãããã³ãŒããæ©ãåã£ãŠããäœã®åœ¹ã«ç«ã€ãã®ãåŸãããŸããã ãããŠãããã¯åé¡ãèŠã€ããã®ã«åœ¹ç«ããªãããããããã°ããã»ã¹ã®çç£æ§ãäœäžããåé¿ããæ¹ãè¯ãããšãæå³ããŸãã
Visual Studioã®ã©ã®ããŒãžã§ã³ã§ãã[ãããã°] | [ äžè¬çãªèšå®ãã€ã¢ãã°ã§ã¯ã[ãã€ã³ãŒãã®ã¿]ãªãã·ã§ã³ãéžæããŠãèšè¿°ããŠããªãã³ãŒãã®è¡šç€ºãåæ¢ã§ããŸãã åŸã§ãããç¡å¹ã«ããå¿ èŠãããå ŽåïŒããšãã°ãçæãããã³ãŒãã®ã©ããã§äŸå€ãçºçããå ŽåïŒã[ãããã°]ã¡ãã¥ãŒã®[ãªãã·ã§ã³ãšèšå®]ãéžæããŠãããè¡ãããšãã§ããŸãïŒ ãã®é ç®ã¯VS2010-çŽç¿»èš³ã®ã¿ã«ãããŸã ïŒã
ã³ãŒãã®äžéšãæ©ãåãã®ã«ããããããŠããå Žåã¯ã2ã€ã®å±æ§ã®ããããã䜿çšã§ããŸãã ã¡ãœããã«
DebuggerHidden
å±æ§ãèšå®ãããšããã®ã¡ãœããã«å ¥ãããšã¯ãããŸããã
DebuggerNonUserCode
å±æ§ãèšå®ããå Žåã[ãžã£ã¹ããã€ã³ãŒã]ãªãã·ã§ã³ãæå¹ã«ãªã£ãŠããŠãªãã«ãªã£ãŠããå Žåããã®å±æ§ã«
DebuggerNonUserCode
ããããšã¯ã§ããŸããã 2çªç®ã®æ¹æ³ã䜿çšããããšããå§ãããŸãã
äžæ¹ãMicrosoft .NET Frameworkã³ãŒãã®ã©ããã§ãšã©ãŒãçºçããå Žåãçæãããã³ãŒãã ãã§ãªãããã¬ãŒã ã¯ãŒã¯ã¯ã©ã¹ã®ã³ãŒãã調ã¹ãå¿ èŠããããŸãã ãããŠãããªãã¯ãããããããšãã§ããŸãïŒ ãŸããJust My Codeãªãã·ã§ã³ãç¡å¹ã«ãªã£ãŠããããšã確èªããŸãã 次ã«ã[ã·ã³ãã«]ã»ã¯ã·ã§ã³ã®[ãªãã·ã§ã³ãšèšå®]ãã€ã¢ãã°ã§ã[Microsoft Symbol ServerïŒVS 2010ïŒ]ãéžæããããã·ã³ãã«ãã¹ã次ã®ããã«èšå®ããŸãã
referencesource.microsoft.com/symbols
referencesource.microsoft.com/symbols
ïŒã ããã«ããã.NETã¯ã©ã¹ã³ãŒããŠã©ãŒãã³ã°ããµããŒãããæåãããŒãã§ããŸãã ãã ããããããããŠã³ããŒãããå¿ èŠããããŸãã VS2010ã§ã¯ã[ãã¹ãŠã®ã·ã³ãã«ãèªã¿èŸŒã]ãã¿ã³ãã¯ãªãã¯ã§ããŸãããããŠã³ããŒãäžã¯ææ ¢ããå¿ èŠããããŸãã
ç¹å®ã®ã¢ã»ã³ããªãéžæããã«ã¯ïŒãŸãã¯VS2008ã䜿çšããŠããå ŽåïŒããããã°ããã»ã¹ãåæ¢ããã¢ãŒãã§ãïŒã¢ãžã¥ãŒã«ïŒãŠã£ã³ããŠãéããã¢ããªã±ãŒã·ã§ã³ã«ãã£ãŠèªã¿èŸŒãŸããDLLã®äžèŠ§ã§ãå¿ èŠãªDLLãå³ã¯ãªãã¯ããïŒã¢ãžã¥ãŒã«ãèªã¿èŸŒãïŒãéžæããŠãã®DLLã®æåãèªã¿èŸŒã¿ãŸãã ãã¡ããããŸã åŸ ã€å¿ èŠããããŸãããããã»ã©é·ãã¯ãããŸããã
ç§ã¯ããããã£ã«æçšãªã³ãŒããæžãããããã段éçã«ãããã°ã§ããããã«ããã人ã®äžäººã§ãã VS2008SP1以éããªãã·ã§ã³ïŒããããã£ãšæŒç®åã®ã¹ããããªãŒããŒïŒãç»å ŽããŸããããã®ãªãã·ã§ã³ã¯ãããããã£ãšæŒç®åã®æ®µéçãªãããã°ããªãã«ããŸãã ãŸããVS2010ã§ã¯ããã©ã«ãã§ãªã³ã«ãªã£ãŠããããããªãã«ããå¿ èŠããããŸãã
ããŒã¿ã®å¯èŠå
å¥åŠãªããšã«ãå€ãã®éçºè ã¯Visual Studioã®ããŒã¿ããžã¥ã¢ã©ã€ã¶ãŒã«æ £ããŠããŸããã åæ¢ã¢ãŒãã§å€æ°ã«ã«ãŒãœã«ãåããããšãããŒã«ãããã«ãã®å€æ°ã®å€ããããã¢ãã衚瀺ãããŸãã è«çŒé¡ã®ã¢ã€ã³ã³ã衚瀺ãããå ŽåããããŸããã¯ãªãã¯ãããšãããã©ã«ãã®ããžã¥ã¢ã©ã€ã¶ãŒã§å€æ°ã®å€ãéããŸãã ã¢ã€ã³ã³ã®æšªã«ããããããŠã³ç¢å°ã衚瀺ãããŠããå Žåãç¢å°ãã¯ãªãã¯ãããšããã®ããŒã¿ã¿ã€ãã®ä»ã®ããžã¥ã¢ã©ã€ã¶ãŒã衚瀺ãããŸãã ããšãã°ãæååå€æ°ã®å Žåãããã¹ããXMLãããã³HTMLããžã¥ã¢ã©ã€ã¶ãŒã衚瀺ãããŸãã HTMLãæååã«ä¿åããå ŽåãHTMLã¬ã³ãã©ãŒã¯ãã©ãŠã¶ãŒã§HTMLãã©ã®ããã«è¡šç€ºãããããç解ããã®ã«åœ¹ç«ã¡ãŸãã
[ãŠã©ãã]ã[èªå]ãããã³[ããŒã«ã«]ãŠã£ã³ããŠã§ããžã¥ã¢ã©ã€ã¶ãŒã䜿çšããããšãã§ããŸãããå€æ°ãé »ç¹ã«èŠãå Žåã¯ãããŒã«ãããã®æåŸã«ããæŒããã³ãã¯ãªãã¯ããŠãã®å Žæã«ãéä»ããã§ããŸãã 次ã«ãã³ãŒãã®ãã®éšåã次ã«èŠããšãããŒã«ããããèªåçã«ãããã¢ãã衚瀺ãããŸãã
ãã³ããšããã°ãå€æ°ã®å€ãå€æŽããããã«ãããã䜿çšã§ããŸãã VS2010ã§ã¯ãããã«å€ãã®ãã³ãããããŸãããŠã£ã³ããŠã«ãã³ã°ã¢ãããããããã°ã»ãã·ã§ã³äžã¯åžžã«ååšããçµäºåŸãæåŸã®ã»ãã·ã§ã³ã®å€æ°ã®å€ã衚瀺ãããã³ããäœæã§ããŸãã ãã ããæãã¯ãŒã«ãªããŒã«ïŒãããã¬ãŒãã£ã³ãã¹ãšIntelliTraceïŒã¯ãVS2010 Ultimate Editionã§ã®ã¿äœ¿çšã§ããŸãã
VS2010 Ultimate Editionã®ã¿
ã¹ã¿ãžãªã®ãšãã£ã¿ãŒã§ã¯ãäžåºŠã«1ã€ã®ã³ãŒãã®ã¿ãèŠãããšãã§ããŸãã ããããã³ãŒãã®ç°ãªãéšåéã®çžäºäœçšã®çµæãšããŠãå€ãã®ãã°ãçºçããŸãã Debugger Canvasã䜿çšãããšããã¹ãŠã®ã³ãŒããäžåºŠã«è¡šç€ºããã¢ãžã¥ãŒã«éã移åããŠç®çã®éšåãè¿ã¥ããããšãã§ããŸãã
ãã¬ãŒã¯ãã€ã³ããããªã¬ãŒããããšãããã§ã©ã®ããã«çµãã£ãããç解ããå¿ èŠããããŸãã [åŒã³åºãã¹ã¿ãã¯]ãŠã£ã³ããŠã䜿çšã§ããŸãããåæ段éã§äœãèµ·ãã£ãã®ãã¯ããããŸããïŒãªãã·ã§ã³ãšããŠãäžé£ã®ãã¬ãŒã¯ãã€ã³ããé 眮ããå€æ°ã远跡ããŠããããé çªã«ç¢ºèªã§ããŸãïŒã
ãããã¬ãŒãã£ã³ãã¹ã§ãã¢ãžã¥ãŒã«ãä»ããŠãç£èŠã§ããå ŽåãIntelliTrace-ãæéãä»ããŠãããã®ãã¬ãŒã¯ãã€ã³ãã«å°éããæ¹æ³ãç解ã§ããŸãã IntelliTraceã¯ããããã°ã»ãã·ã§ã³ã®ä»¥åã®æç¹ã§å©çšå¯èœã§ãã£ããããã°æ å ±ãåéããŠè¡šç€ºããŸãã
ããã«åªããDebugger CanvasãšIntelliTraceã¯é£åããŠæ©èœããŸããDebuggerCanvasã«ã¯ãã³ãŒãã®æšªã«IntelliTraceãã°ã衚瀺ã§ãããªãã·ã§ã³ããããŸãã
ãã¬ãŒã¯ãã€ã³ããããªã¬ãŒããããšãããã§ã©ã®ããã«çµãã£ãããç解ããå¿ èŠããããŸãã [åŒã³åºãã¹ã¿ãã¯]ãŠã£ã³ããŠã䜿çšã§ããŸãããåæ段éã§äœãèµ·ãã£ãã®ãã¯ããããŸããïŒãªãã·ã§ã³ãšããŠãäžé£ã®ãã¬ãŒã¯ãã€ã³ããé 眮ããå€æ°ã远跡ããŠããããé çªã«ç¢ºèªã§ããŸãïŒã
ãããã¬ãŒãã£ã³ãã¹ã§ãã¢ãžã¥ãŒã«ãä»ããŠãç£èŠã§ããå ŽåãIntelliTrace-ãæéãä»ããŠãããã®ãã¬ãŒã¯ãã€ã³ãã«å°éããæ¹æ³ãç解ã§ããŸãã IntelliTraceã¯ããããã°ã»ãã·ã§ã³ã®ä»¥åã®æç¹ã§å©çšå¯èœã§ãã£ããããã°æ å ±ãåéããŠè¡šç€ºããŸãã
ããã«åªããDebugger CanvasãšIntelliTraceã¯é£åããŠæ©èœããŸããDebuggerCanvasã«ã¯ãã³ãŒãã®æšªã«IntelliTraceãã°ã衚瀺ã§ãããªãã·ã§ã³ããããŸãã
å€éšããŒã«
Visual Studioãå¯äžã®ãããã°ããŒã«ã§ã¯ãªãã貯éç®±ã«è¿œå ã§ããæ°ã®å€éšããŒã«ãšãµãŒãããŒãã£ããŒã«ããããŸãã ç¡æã®ãã®ã«ã®ã¿çŠç¹ãåœãŠãŸãã
ãã¹ãŠã®å€éšããŒã«ããµãŒãããŒãã£è£œã§ã¯ãããŸããã WindowsãµãŒãã¹ãèšè¿°ããå Žåããããã®ãããã°ã¯ç°¡åãªäœæ¥ã§ã¯ãªãããšãããããŸãã ãããã°ã®ããã«ãããã«æ¥ç¶ã§ããŸããããã®æç¹ã§OnStartã³ãŒããšåæåã¯ãã§ã«å®äºããŠããŸãã ãã°ããµãŒãã¹ã®éå§ã劚ããŠããå Žåãåé¡ã説æããæ å ±ãåéããã®ã§ã¯ãªããäœãåé¡ãªã®ããæšæž¬ããããšããã§ããŸããã
åæ§ã®ç¶æ³ã§ãJust-in-TimeïŒJITïŒãããã°ãšèªåå®è¡ãæ§æã§ããŸãããµãŒãã¹ã®éå§æãŸãã¯ãšã©ãŒã®çºçæã«ãããã°ã»ãã·ã§ã³ãéå§ãããŸãã ãããããããè¡ãã«ã¯ãå€éšããŒã«ã䜿çšããå¿ èŠããããŸãã
JITãããã°ã®æ§æã¯ãã®èšäºã®ç¯å²ãè¶ ããŠããããã MSDNã®å¯Ÿå¿ããèšäºãåç §ã§ããŸãã ãã®èšäºã§ã¯ãGlobal Flags EditorïŒgflags.exeïŒã®äœ¿çšãæšå¥šããŠããŸãã èŠã€ãããªãå Žåã¯ãã¬ãžã¹ããªãä¿®æ£ããŠJITãããã°ãæå¹ã«ããæ¹æ³ã«ã€ããŠèª¬æããŸãã ãã ããWinDbgã®äœ¿çšæ¹æ³ãåŠç¿ããå¿ èŠããããŸãã
WinDbgïŒVisual Studioãããã¬ãŒã®å€éš
ãœãŒã¹ã³ãŒããããæ·±ããããã°ã«èå³ãããå ŽåãMicrosoft .NET Frameworkã«ã¯ããã€ãã®åªããããŒã«ãå«ãŸããŠããŸãã
ãããã®ããã€ãã次ã«ç€ºããŸãã
以åã«WinDbgã䜿çšããããšããªãå ŽåãèŠãç®ã»ã©æãã¯ãããŸãã-WinDbgã«ã¯GUIïŒNTSDãKDãCBDãªã©ã®ã³ã³ãœãŒã«ããŒã«ãšã¯ç°ãªããŸãïŒããããã¢ããªã±ãŒã·ã§ã³ã®ãããã°ã·ã³ãã«ãå«ãPDBãã¡ã€ã«ãèªã¿èŸŒãããšãã§ããŸãïŒãããã°ã¢ãŒãã§ã¢ããªã±ãŒã·ã§ã³ãã³ã³ãã€ã«ããã·ã³ãã«ãã¡ã€ã«ãé©åã§ããããšãä¿èšŒãããŸãïŒã SOSã«å ããŠãäžè¬çãªãããã°ã¿ã¹ã¯çšã®WinDbgæ¡åŒµæ©èœãããã€ããããŸãã
ãã ããWinDbgã§äœ¿çšããæã䟿å©ãªããŒã«ã¯ã Mãario HewardtãPatrick DussudãAdvanced .NET DebuggingïŒAddison-Wesley Professionalã2009ïŒã®æ¬ã§ãã 圌女ã¯ãããããã¹ãŠã®ããŒã«ã®äœ¿çšæ¹æ³ã«ã€ããŠè©±ãã ãã§ãªããå žåçãª.NETã®åé¡ããã£ããããã³ã³ããã¹ãã§ãããè¡ããŸãã
ãããã®ããã€ãã次ã«ç€ºããŸãã
- Windowsãããã¬ãŒïŒWinDbg.exeïŒ
- SOSãããã°æ¡åŒµæ©èœïŒSOS.dllãVisual Studioã³ã³ãœãŒã«ãŸãã¯WinDbg.exeã§äœ¿çšå¯èœïŒ
- Assemble Binding Log ViewerïŒFuslogvw.exeã .NET Tipsããã°ã§èª¬æããŸãã ïŒ
以åã«WinDbgã䜿çšããããšããªãå ŽåãèŠãç®ã»ã©æãã¯ãããŸãã-WinDbgã«ã¯GUIïŒNTSDãKDãCBDãªã©ã®ã³ã³ãœãŒã«ããŒã«ãšã¯ç°ãªããŸãïŒããããã¢ããªã±ãŒã·ã§ã³ã®ãããã°ã·ã³ãã«ãå«ãPDBãã¡ã€ã«ãèªã¿èŸŒãããšãã§ããŸãïŒãããã°ã¢ãŒãã§ã¢ããªã±ãŒã·ã§ã³ãã³ã³ãã€ã«ããã·ã³ãã«ãã¡ã€ã«ãé©åã§ããããšãä¿èšŒãããŸãïŒã SOSã«å ããŠãäžè¬çãªãããã°ã¿ã¹ã¯çšã®WinDbgæ¡åŒµæ©èœãããã€ããããŸãã
ãã ããWinDbgã§äœ¿çšããæã䟿å©ãªããŒã«ã¯ã Mãario HewardtãPatrick DussudãAdvanced .NET DebuggingïŒAddison-Wesley Professionalã2009ïŒã®æ¬ã§ãã 圌女ã¯ãããããã¹ãŠã®ããŒã«ã®äœ¿çšæ¹æ³ã«ã€ããŠè©±ãã ãã§ãªããå žåçãª.NETã®åé¡ããã£ããããã³ã³ããã¹ãã§ãããè¡ããŸãã
ãµãŒãããŒãã£ã®ããžã¥ã¢ã©ã€ã¶ãŒ
Visual Studioã®ããžã¥ã¢ã©ã€ã¶ãŒã«ã€ããŠã¯æ¢ã«èª¬æããŸããããä»ã«ããããããããŸãã DotNetDanã®DataSet Visualizerã¯ãããŒã¿ã»ããã®å 容ãç¥ãå¿ èŠãããå Žåã¯éåžžã«çŽ æŽãããã§ãïŒ ããã°ã§èª¬æããŸãã ïŒã
ãã以æ¥ãç§ã¯ãã§ã«RightHand DataSet VisualizerãçºèŠããããã䜿ãå§ããŸããã ããã¯ãåããŒã¿ã»ããããŒãã«ã®ãŠã£ã³ããŠãéãããšãã§ããMDIã¢ããªã±ãŒã·ã§ã³ã§ãã ããã«ã[ãªã¬ãŒã·ã§ã³]ãŠã£ã³ããŠã«ã¯ãçŸåšè¡šç€ºãããŠããããŒãã«ã衚瀺ãããŸãã
ããŒãã«ã衚瀺ããã°ãªããã¯åçŽã§ã¯ãããŸããããŠã£ã³ããŠã®äžéšã«ããé·æ¹åœ¢ã«åããã©ãã°ããŠããã®åã§ããŒãã«ãã°ã«ãŒãåã§ããŸãã ãŸããããŒã¿ã»ããå ã®ããŒã¿ãå€æŽããRowStateãã£ã«ã¿ãŒãå€æŽããŠãç¹å®ã®RowStateãæã€è¡ã®ã¿ã衚瀺ãããããã«ããããšãã§ããŸãïŒããšãã°ãåé€ãããè¡ã®ã¿ïŒã ããŒã¿ã»ããã®äžéšã®ããããã£ãåŒãç¶ãç£èŠïŒããã³å€æŽïŒã§ããŸãã ãŸããããŒã¿ã»ãããXMLãã¡ã€ã«ã«ã¢ããããŒããããã以åã«ä¿åããããŒã¿ãããã¹ãããŒã¿ãããŒããããããããšãã§ããŸãã
DotNetDanã®DataSet Visualizerã¯ããŒã¿ãããé«éã«ããŒããããããRightHandã®ãã«ãã¯ãŒãå¿ èŠãªãå Žåã«åããŠãããŒã¿ãæ®ããããšã«æ³šæããŠãã ããã
ASP.NETã¢ããªã±ãŒã·ã§ã³çšã®Web VisualizerããããŸãã ãã®ããžã¥ã¢ã©ã€ã¶ãŒã¯ãASP.NETããŒãžãªããžã§ã¯ãã®ããŒã«ãããã§å©çšå¯èœã§ãïŒASP.NETã³ãŒãã®Meããã³ãããå«ãïŒ
Webããžã¥ã¢ã©ã€ã¶ãŒã䜿çšãããšããµãŒããŒãªããžã§ã¯ãã®ãµãŒããŒå€æ°ã³ã¬ã¯ã·ã§ã³ãšãªã¯ãšã¹ããªããžã§ã¯ãã®ãã©ãŒã ã³ã¬ã¯ã·ã§ã³ã®ä»»æã®ããŒã¿ãèŠãããšãã§ããŸãã ãã©ãŠã¶ã®ã¯ãšãªæååãšãSessionããã³Applicationãªããžã§ã¯ãã®å 容ã確èªã§ããŸãã ãã ããã¹ã«ã©ãŒããŒã¿ä»¥å€ã®ãªããžã§ã¯ãã®ã»ãã·ã§ã³ããã³ã¢ããªã±ãŒã·ã§ã³ã®å Žåã¯ããªããžã§ã¯ãã®ã¿ã€ãã®ååã®ã¿ã衚瀺ãããŸãã
Entity FrameworkïŒEFïŒãžã®ãã£ãã·ã¥ããã³LINQã¯ãšãªãç£èŠã§ããã»ããEFãžã®SQLåºåLINQã¯ãšãªã衚瀺ã§ããããžã¥ã¢ã©ã€ã¶ãŒããããŸãã å¯äžã®æ²ããããšã¯ãããžã¥ã¢ã©ã€ã¶ãŒã®ã«ã¿ãã°ã1ã€ããªãããšã§ãã
ãã¹ãŠã§ã¯ãããŸããããå€ãã¯Visual Studio Extension Managerã§èŠã€ããããšãã§ããŸãã ASP.NET MVC Routing Visualizerãå«ãã ASP.NET MVCãŸãã¯åçŽãªASP.NETã§ã«ãŒãã£ã³ã°ã䜿çšããå Žåããã®ããŒã«ã圹ç«ã¡ãŸãã ã«ãŒãã£ã³ã°ã«ãŒã«éã®çžäºäœçšã¯ãäºæããªãçµæïŒããã®ããŒãžãååŸããçç±ãïŒãçæããå¯èœæ§ããããŸãããŸãããããã®ã«ãŒã«ã®ãããã°ã¯é£ããå ŽåããããŸãã ããžã¥ã¢ã©ã€ã¶ãŒã䜿çšãããšãURLãå ¥åããã«ãŒã¿ãŒãURLããã³ãŒãããæ¹æ³ïŒåURLã«äœ¿çšãããŠããã«ãŒã«ã«é¢ããæ å ±ãªã©ïŒã確èªã§ããŸãã åæ¢ã¢ãŒãã§äœ¿çšããã«ã¯ãglobal.asaxãã¡ã€ã«ã«åãæ¿ããŠãRouteTableã«ã«ãŒãœã«ãåãããŸãã ããŒã«ãããã衚瀺ãããããã«ãŒãã³ã¬ã¯ã·ã§ã³ãŸã§ã¹ã¯ããŒã«ããè«çŒé¡ã¢ã€ã³ã³ãã¯ãªãã¯ããŸãã
ãã¬ãŒã¹
å®çŸ©äžããã¬ãŒã¹ã¯é åçã§ã¯ãããŸããã ãã ããæ¬çªç°å¢ã§ã¯ãåçŸãå°é£ãªïŒãŸããããèªäœã§è¡šç€ºããã³é衚瀺ã«ãªãïŒãšããã©ããã®ãªããã°ã®1ã€ã«ééãããšããã¬ãŒã¹ãå¿ èŠãªæ å ±ãååŸããå¯äžã®æ¹æ³ã§ãã ãããè¡ãã«ã¯ããŸãããã°å ã®ã¡ãã»ãŒãžã®èšé²ãæŽçããå¿ èŠããããŸããããã«ããããã°ããã£ããããããã®æ å ±ãåŸãããŸãã ãã ãããã®æ å ±ãæå¹ã«ããã«ã¯ããã°ã®å 容ãåæããããŒã«ãå¿ èŠã§ãã
.NETã®äžçã«ã¯ãã¬ãŒã¹çšã®ããã±ãŒãžãå€æ°ãããŸãããç§ã¯log4netã䜿çšããŸãã ä»ã®æ©èœã®äžã§ããlog4netã䜿çšãããšããããã°ã¡ãã»ãŒãžãã³ãŒãã«åã蟌ã¿ãã¢ããªã±ãŒã·ã§ã³ãåæ§ç¯ããããšãªããäœæ¥äžã«ãããã°ã¡ãã»ãŒãžãæå¹ãŸãã¯ç¡å¹ã«ã§ããŸãã 泚ïŒlog4netã¯éåžžã«æè»ãªããŒã«ã§ãããããããå¿ èŠä»¥äžã®ãã®ã§ãã
çµæã®ãã°ã®èªã¿åãã«é¢ããŠã¯ãLizard Labsã®Log Parser Lizardã䜿çšããŸãã ç¡æçã§ã¯ãããã€ãã®æ©èœãå¶éãããŠããŸãïŒäŸ¡æ Œã¯æ¯æãããŠããŸã-çŽ25ãã«ïŒããç§ã¯ããããå¿ èŠãšããŸããã§ããã Log Parser Lizardã¯SQLã«äŒŒãæ§æã䜿çšããŠãã°ãªã¯ãšã¹ãïŒCSVããã³XMLãã¡ã€ã«ãå«ãïŒãäœæããããã«IISãã°åœ¢åŒãWindowsã€ãã³ããããã³log4netãç解ããŸãã çµæã¯ããŒãã«ã«è¡šç€ºãããããããµãŒããŒãšã¯ã¹ãããŒã©ãŒã®ããã«èŠããŸãã
ãããã«
ãããã®ããŒã«ã¯ãã¹ãŠäŸ¿å©ã§ãããæãéèŠãªã®ã¯æ£ãããããã°ææ³ã§ããããšãå¿ããªãã§ãã ããã ããŒã«ã¯ãã°ãèŠã€ããŠä¿®æ£ããã®ã«åœ¹ç«ã¡ãŸããããœãªã¥ãŒã·ã§ã³ã®éçºãšé©çšãå¯èœã«ããã®ã¯ãããã°ææ³ã§ãã