• Uncategorized

    Are you profiling your application and now you can’t debug anymore?

    This is an interesting case I got very recently and that made me scratch my head a lot, wondering what was going wrong on customer’s machine for a while… until I called Doug on the rescue and we (he) drove the call to an happy ending 😊 I got this case from a colleague on the Visual Studio team; the customer reported a weird problem with the debugging of their ASP.NET 1.1 application (with Visual Studio 2003): when trying to step into the code line by line with F11, the debugger actually stopped only on the signature of every method skipping completely the body of the method, and to add something more, this happened only when they were using a specific namespace (e.g. MyCompany.MyNamespace.Group); if they used the same exact code but in a different namespace, everything worked fine 😲. Moreover, this was happening on that very specific web server only, if they moved the code to another machine the debugger worked like charm (but moving to a different machine was not an option for them). My first thought went to the .pdb files, some kind of mismatch between the between the code esecuted in memory and the symbols used…

  • Uncategorized

    Caution: I’m an INTJ!

    As Mike, I’m also interested in the psychological and unconscious side if human beings… and after reading this post I took the personality test based on the Myers-Briggs personality tests. Well, it turns out that I’m an INTJ (and here) 😊. Preferred careers are in computer programming, engineering or natural science… very close! And also I recognize myself in the personality descriptions they gave… nice 🤓 Anyone willing to take the test and share the result? Cheers

  • Uncategorized

    Windows Control Library does not resize correctly if you change IE window size

      Hosting a Windows Control Library control in an ASP.NET 2.0 page, the WCL does not resize correctly, if you change the size of the IE Window. The problem does not occur using .NET Framework 1.1 The problem is a regression in Visual Studio 2005 which prevents the .Net ActiveX implementation from asserting managed code privilege when calling IOleClientSite::OnPosRectChange. Since that call requires managed code execution privileges, it fails and the control cannot resize itself. The workaround is to set the size of the control from the HTML rather than resizing it internally. For example, the onresize in the body tag in the following script does this: <html> <body onresize=”obj1.Width=document.body.clientWidth;”> <div style=”width:100%;height:100%;background-color:blue”> <OBJECT id=”obj1″ height=”90%” width=”90%” classid=”MyResizeControl.dll#MyResizeControl.UserControl1″ VIEWASTEXT /> </div> <br> This is a long string for me to test the other space </body> </html> Capitalization of the properties is important: capital “W” (Width) will correctly change the Width property of the internal .Net control; lowercase “w” (width) will change the property of the HTML object rather than the .Net object, and this will not work if the .Net object is 1.1.   Cheers

  • Uncategorized

    Inconsistent Javascript behavior in Internet Explorer

    My colleague Stefano had this case a few weeks ago, but since he has not a blog (yet ) and I’ve been partially involved in it, I thought this might be interesting to share… So, here is the story: the customer wanted to disable a button inside the onBlur event of a textbox through client-side Javascript. Reason for this is client-side input data validation: if the user enters some unwanted text, the button must be disabled to prevent him to click it; if the value is then corrected, the button must be re-enabled. The problem is when the textbox has the focus and user presses the button; it will be disabled but it has two side effects: The button stays pressed The page is frozen and when user clicks wherever inside the IE window, it fires the onClick event of the button The source code of the page looked like this: <HTML> <HEAD> <script> function logWriteLine(sText) { log.innerHTML+=sText+"<BR/>"; } </script> </HEAD> <BODY onload='text1.focus();'> <input type=text id=text1 onblur='logWriteLine("text1.onblur called");button1.disabled=true;'/> <BR/><BR/> <button id="button1" onclick='logWriteLine("button1.onclick called");'>button1</button> <BR/><BR/> <SPAN id="log"></SPAN> </BODY> </HTML> I tested this on all of my 3 machines in office and always worked just fine, while Stefano was able to reproduce the problem…

  • Uncategorized

    Orcas Beta 1 released

    I’m really not a marketing guy and don’t like that much the kind of shiny advertisements which makes everything looking like the best bargain ever, but I think this time it work making an exception to the rule 😊 So, here is a bit of advertising: Visual Studio code name “Orcas” enables developers and development teams to rapidly create connected, secure and compelling applications on the latest platforms, including Windows Vista, Longhorn, the 2007 Office System and the Web The expanded and improved offerings in Visual Studio code name “Orcas” for software development teams, including tools for database professionals and greater collaboration between development organizations and designers Visual Studio code name “Orcas” delivers improvements to Visual Studio Team System that help software development organizations communicate and collaborate more effectively, providing greater predictability and reliability of their software development processes The .NET Framework 3.5, based on proven technology, adds new features in several major technology areas including: Deep integration of Language Integrated Query (LINQ) and data awareness throughout the runtime, compiler, and class libraries. This new feature will let code written in LINQ-enabled languages to filter, enumerate, and create projections of several types of collections using the same syntax Support for…

  • Uncategorized

    Integrated Authentication does not work with domain name

    This is an easy one, but we got cases like this every now and then… maybe worth repeating. If you use Windows Integrated Authentication in IIS, everything works fine if you browse “http://netbiosname”, but Integrated Authentication fails is you browse “http://dnsname”. Why? Because if the DNS machine name contains a dot (“.”), the web site automatically belongs to the “Internet” zone, and by default IE does not sent the account credentials. How to solve this? Easy, you have two options: Add the URL to the “Trusted Sites” in Internet Explorer Modify the security parameter to allow “Automatic logon with current user name and password” (Control Panel -> Internet Options -> Security tab -> Internet -> Custom level…) Update: By the way, I forgot to mention that this is also true if you use the IP address instead of the netbios name: e.g. http://xxx.xxx.xxx.xxx Cheers

  • Uncategorized

    Vista and CHM

    Now I understand why I have troubles viewing the electronic MSDN Magazine, have a look at this post from Chris Crowe… 😲 But I have to say that usually when I’m in that condition, expanding the content tree on the left and clicking on another topic solves the problem, at least on my machine… never mind, unlocking the file is just 3 seconds and fixes the problem forever 😊 Cheers

  • Uncategorized

    Find which w3wp.exe instance is hosting your application

    Just a quick and easy one for this Friday evening: let’s say you have multiple w3wp.exe instances running on your web server (maybe you have multiple application pools, or you enabled Web Garden etc…), one of the ASP.NET applications you have on that server has some problems and you need to capture a memory dump to troubleshoot it: what can you do? Easy one: install the Debugging Tools for Windows and run adplus with something like the following: cscript adplus.vbs -hang -pn w3wp.exe But, hey, you don’t want to end up with a full dump for every w3wp.exe loaded in memory, you just need one of them, the one which is hosting your application… 🙄 Well… here is where iisapp.vbs comes to the rescue! 😊 You can find it under C:\Windows\System32 folder on your Windows 2003 machine, and if you simply run it at the command line, it’ll print to the console the PID of all w3wp.exe processes running and the Application Pool ID that particular process is hosting; here is a screenshot I just took in my machine: Since you are supposed to know under which application pool your application is running (and if you don’t know you can check…

  • Uncategorized

    If Visual Studio takes ages to load…

    … it might be that you opened a project/solution from a network share which is no longer available, or that is slow to refresh etc… I had this problem myself with Visual Studio .NET 2003 (not Visual Studio 2005 so far, so I’m not sure if this is also affected or not), and took a while to figure out what the problem was. Procmon and some patience to go through the log pointed me to an interesting registry key: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1\ProjectMRUList (the same key exists for VS 2005, but it’s under *VisualStudio\8.0\ProjectMRUList). This key contains the path of the last 20 solutions I opened/created; what’s interesting is that by default Visual Studio does not show all the recent solutions opened (in File menu or in the Start Page) but just the last 6 (I usually change this value to 10), but despite that it reads all the values and (I guess) verify if the solution is still available, thus the delay… To solve my problem I simply deleted the values pointing to a solution from a network share et voilà, Visual Studio was loading at the usual (reasonable) speed.   Cheers