Monthly Archives: November 2013

Internet Explorer 11 isn’t displaying all .htc files in JavaScript debugger part

Since I upgraded my Windows 7 developer box with Internet Explorer 11 I am very satisfied with how Microsoft upgraded developer tools. They have added new stuff and it works (well from time to time IE freezes but that might be also my problem with my JavaScript since other browsers hang/crash from time to time on my code also). But that is another story.

Today I came across small “feature” that took me few minutes to realize, what is happening.

I am using IE 11 to debug older ASP.NET WebForms app (with older I mean we are just now moving away from HTC files – Microsoft specific stuff).

IE is loading page from my local IIS with x-ua-compatible flag like described on the link provided, setting rendering core to use version 8 so behaving like IE8.

Loading my page like this results to loading just some .htc files referenced. If I set breakpoint to some code in .htc file, it will be not hit, even some objects are declared as undefined but strangely executing any method over these yields results and works as expected (so I suppose the JS core works as it should , it’s just matter of developer tools).

Quick fix to this is : just reload the page, then all files will be loaded and you can happily work as expected.

Small sample how it looks like in IE developer tools (the very same page, just loaded 2 times) :

First load:

ie11 developer tools load error

Second load:

ie11 developer tools load OK

Just in the case, version of my IE 11 :

my ie11 version

Hope this helps someone, enjoy.

PowerShell Tools for Visual Studio 2012 problem – .ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies

Solution to your problem :

For some reason,  account on which you run VS on and on which VS hosts PowerShell has restricted ExecutionPolicy (you can type Get-ExecutionPolicy , select the text and hit CTRL+F8 and should see Restricted as the answer).

So the solution is simple (should be): override the settings and set it to RemoteSigned with this command :

Set-ExecutionPolicy RemoteSigned

select the text, hit CTRL+F8. Now hitting F5 should make your PS behave.

(Alternatively Unrestricted is also viable option, but this is considered unsafe. More on this here : http://technet.microsoft.com/en-us/library/ee176961.aspx)

More on the topic :

I wanted to create some PowerShell script and I thought there has to be something better than PowerShell ISE (sry, I am just too used to VS and debugger and all that goodness I have at my disposal) so I discovered this wonderful plugin for VS 2012 – PowerShell Tools for Visual Studio – http://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597 and all worked as expected, until (as far as I remember) I restarted OS and had this strange error in VS in my output window :

Error: File C:\users\your_name\documents\visual studio 2012\Projects\PowerShell Script Project1\PowerShell Script Project1\Script.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.

The program ‘PowerShell Script’ has exited with code 0 (0x0)
(Small side note here to make you more puzzled but this might also help you in some way : I work in a company where admins takes security seriously and our “normal” day to day accounts are restricted and don’t have access to this and that so we have another accounts to install sw, make changes to the system, etc. I need to run my VS under this account, not my own.)
Great, no what? There is a link to documentation about what execution policies are and how to set them, etc, I changed it from vanilla restricted state to RemoteSigned and the very same .ps1 file worked after I set RemoteSigned for my and my admin account. It looks like PS stores policies per user in registry. More on this here : http://dusan.kuzmanovic.net/2012/01/04/powershell-execution-policy/

 

Than I had “brilliant” idea to try PowerShell commands in NuGet Package Manager Console because it is using PowerShell under the hood, I was just looking for some prompt to query the ExecutionPolicy. And the magic happened, after query the PowerShell worked!!!! Brilliant but this is just workaround and not the solution.

 

After this the best idea seemed to contact the author so I mailed directly Adam Driscoll (apologies for distraction) which led to few discoveries like :
  • Writing some text in the .ps1 file in VS and selecting some code and right click reveals Execute selection option that is able to run your code event if it fails running it F5,
  • Adam downloaded in his spare time NuGet sources and it looks like : “NuGet sets the process scoped execution policy to RemoteSigned when it is initialized. “

So next logical step would be to try to run Set-ExecutionPolicy from VS to set it for account that VS is using to run PowerShell. And it looks like it is working.

Enjoy guys and thanks Adam for your plugin and your time.