Subscribe: WebLog of Ken Cox
Added By: Feedage Forager Feedage Grade B rated
Language: Greek
azure  code  entity framework  entity  error  fix  framework  net  page  project  studio  system  visual studio  visual  web 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: WebLog of Ken Cox

WebLog of Ken Cox


Fix: Add an Existing Entity Framework .edmx File to Visual Studio 2013

Sun, 03 Aug 2014 20:59:00 GMT

One of my older code samples for RainWorx AuctionWorx uses Entity Framework and SQLCE to bulk import AdventureWorks products as sample auction, classified, and fixed price listings into the system.

When I created the EF files, all the scaffolding was handled by Visual Studio's EF tooling.

To use the sample, developers need to incorporate the EF files into their RainWorx.FrameWorx.MVC project. That's where I hit a snag.

If you add AdventureWorksSQLCE.edmx as an existing item in VS2013, the IDE doesn't generate all the supporting files.  It does create AdventureWorksSQLCE.Designer.cs which contains this advice:

// To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
// property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
// is open in the designer.

Okay let's try that.


Oops. The Code Generation Strategy is read-only and set to T4. How do I change it?

The solution is to open the .edmx file in the XML (Text) Editor.


Look for the UseLegacyProvider property and set it to True



Save the file and close the XML Editor.

Open the .edmx file in the Model Browser and check the properties again. The Code Generation Strategy property is no longer read-only so you can set it to Legacy ObjectContext.


Build your project, refresh Solution Explorer, and you'll find that the tools have generated your code.


Like most things in software development, it's an easy fix once you know how to do it! Perhaps you won't lose time on this like I did?

BOGUS Error: JIT Compiler encountered an internal limitation.

Tue, 03 Jun 2014 23:02:00 GMT

Out of the blue, Visual Studio 2013 (Update 2) refused to debug ASP.NET 3.5 Web site projects. The error message was:

JIT Compiler encountered an internal limitation.

My ASPInsider colleague Jeff Fritz helped me confirm that it had nothing to do with the controls in the site - the test project ran fine for him.

Repairing VS 2013 didn't work. Restoring my system back to an April restore didn't change anything except cause VS to crash with no error message.

Things became more clear when I ran VS is Safe Mode. Instead of the bogus JIT error, the VS debugger complained:

unable to launch the configured visual studio development web server.invalid pointer

At least that gave me something more to go on. Repairing IISExpress didn't work.

Finally, I saw a suggestion to clean up the VS Environment. In VS 2013, I went to Tools > Import and Export Settings > Reset all Settings. I threw away the previous settings file.

BAM! Debugging on the ASP.NET 3.5 web site started working again.

Lost the best part of the work day on this but maybe you won't have to lose yours as well?


Fix: Azure Disabled over 49 cents? Beware of using a Java Virtual Machine on Microsoft Azure

Sun, 18 May 2014 17:07:00 GMT

I love my MSDN Azure account. I can spin up a demo/dev app or VM in seconds. In fact, it is so easy to create a virtual machine that Azure shut down my whole account!

Last night I spun up a Java Virtual Machine to play with some Android stuff. My mistake was that I didn’t read the Virtual Machine pricing warning:

“I have a MSDN Azure Benefit subscription. Can I use my monthly Azure credits to purchase Oracle software?

“No, Azure credits in our MSDN offers are not applicable to Oracle software. In order to purchase Oracle software in the MSDN Azure Benefit subscription, customers need to turn off their {0} spending limit and pay at the regular pay-as-you-go rate. Otherwise, Oracle usage will hit the {1} spending limit and the subscription will be immediately disabled.

 Immediately disabled? Yup. Everything connected to the subscription was shut off, deallocated, rendered useless - even the free Web sites and the free Sendgrid email service.

 The fix? I had to remove the spending limit from my account so I could pay $0.49 (49 cents) for the JVM usage. I still had $134.10 in credits remaining for regular usage with 6 days left in the billing month.

 Now the restoration/clean-up begins… figuring out how to get the web sites and services back online.

 To me, the preferable way would be for Azure to warn me when setting up a JVM that I had no way of paying for the service. In the alternative, shut down just the offending services – the ones that can’t be covered by the regular credits.

What a mess.

Fix: The type 'System.Web.Mvc.ViewPage' is ambiguous:

Sun, 11 May 2014 22:52:06 GMT

Once again, my lack of attention leads to a blog post.

This time, an MVC2 project I’m working on started to misbehave with the error “The type 'System.Web.Mvc.ViewPage' is ambiguous:”

For some reason, it was pointing to the logon.aspx page:

Line 1: <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> Line 2: Line 3:

After the usual gnashing of teeth and denial that I did anything to cause it, I settled down to backtrack at what had changed. I had absent-mindedly added a page to the project. It turns out it WASN’T an MVC page but a Webforms page!

Excluding the errant webforms page (and its associated code-behind) cleared up the problem. My fault for sure, but the error message really wasn’t helpful.

Added to the list of dumb mistakes that I admit so you don’t have to…

EntityDataSource control for Entity Framework 6 Preview

Fri, 31 Jan 2014 16:59:47 GMT

It took a while but we now have a preview version of the EntityDataSource control for Entity Framework 6.

This will really help those of us who want to move ASP.NET 3.5 sites to a later version of the framework without going back over those legacy (but working) web forms pages.


Get the alpha version here:

Explained: EF 6 and “Could not determine storage version; a valid storage connection or a version hint is required.”

Tue, 12 Nov 2013 15:56:00 GMT

I have a legacy ASP.NET 3.5 web site that I’ve upgraded to a .NET 4 web application. At the same time, I upgraded to Entity Framework 6.

Suddenly one of the pages returned the following error:

[ArgumentException: Could not determine storage version; a valid storage connection or a version hint is required.]
   System.Data.SqlClient.SqlVersionUtils.GetSqlVersion(String versionHint) +11372412
   System.Data.SqlClient.SqlProviderServices.GetDbProviderManifest(String versionHint) +91
   System.Data.Common.DbProviderServices.GetProviderManifest(String manifestToken) +92

[ProviderIncompatibleException: The provider did not return a ProviderManifest instance.]
   System.Data.Common.DbProviderServices.GetProviderManifest(String manifestToken) +11431433
   System.Data.Metadata.Edm.Loader.InitializeProviderManifest(Action`3 addError) +11370982
   System.Data.EntityModel.SchemaObjectModel.Schema.HandleAttribute(XmlReader reader) +216

A search of the error message didn’t turn up anything helpful except that someone mentioned that the error messages was bogus in his case.

The page in question uses the ASP.NET EntityDataSource control, consumed by a Telerik RadGrid. This is a fabulous combination for putting a huge amount of functionality on a page in a very short time.

Unfortunately, the 6.0.1 release of EF6 doesn’t support EntityDataSource. According to the people in charge, support is planned but there’s no timeline for an EntityDataSource build that works with EF6.  I’m not sure what to do in the meantime. Should I back out EF6 or manually wire up the RadGrid?

The upshot is that you might want to rethink plans to upgrade to Entity Framework 6 for Web forms projects if they rely on that handy control.

It might also help to spend a User voice vote here:

Creating a SQL Azure Database Should be Easier

Wed, 30 Oct 2013 01:30:59 GMT

Every time I try to create a database + tables + data for Windows Azure SQL I get errors.  One of them is 'Filegroup reference and partitioning scheme' is not supported in this version of SQL Server.'

It’s partly due to my poor memory (since I’ve succeeded before) and partly due to the failure of tools that should be helping me.

For example, when I want to create a script from an existing database on my local workstation, I use SQL Server Management Studio (currently v 11.0.2100.60).  I go to Tasks > Generate Scripts which brings up the nice Generate and Publish Scripts wizard.

When I go into the Advanced button, under Script for Server Version, why don’t I see SQL Azure as an option by now? The tool should be sorting this out for me, right? Maybe this is available in SQL Server Data Tools? I haven’t got into that yet. Just merge the functionality with SSMS, please.


Anyway, I pick an older version of SQL for the target and still need to tweak it for Azure. For example, I take out all the “[dbo].” stuff. Why is it put there by the wizard? I also have to get rid of "ON [PRIMARY]"  to deal with the error I noted at the top.

Yes, there’s information on what a table needs to look like in SQL Azure but the tools should know this so I don’t have to mess with it.

Assemblies Go Missing in MVC 2 Project!

Tue, 06 Aug 2013 21:38:11 GMT

Sometimes, my MVC 2 project fails during development because an assembly has disappeared from the /bin folder.

I have no idea what gremlin is messing with my project, but I wish it would stop! For quite a while, AntiXssLibrary.dll was the target. In the latest, a third-party assembly wasn’t found.

Whenever I get a sudden, bizarre, inexplicable runtime error, I should remember to re-copy all the library files.

Has this happened to anyone else in VS 2010?

Deleting a Project From

Sat, 03 Aug 2013 01:57:25 GMT

I really appreciate having the online Team Foundation Service ( as free source control for my personal projects. It has saved my bacon more than once when I’ve needed to roll back my code to a known good point, regroup, and dive in afresh.


While doing some housekeeping, I wanted to clear out old projects. There didn’t seem to be a way to delete a project in the browser-based interface or the embedded VS 2012 GUI.


The short answer is that you need to use the Visual Studio 2012 Command Prompt. Here’s where the shortcut led on my system:


%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat""


At the prompt, execute this command, inserting your own TFS name and project name.


TfsDeleteProject /collection: ProjectName

Fix: The type 'System.Data.Objects.ObjectContext' is defined in an assembly that is not referenced.

Wed, 05 Jun 2013 00:05:21 GMT

I got this message in a class that inherits from  DbContext.  It made no sense, because System.Data.Entity was definitely referenced in my ASP.NET project.

The fix was to select the reference in the properties page and change Copy Local to True.


Entity Framework Code First–Magic SQL Tool

Tue, 04 Jun 2013 19:37:41 GMT

Having written the plain old  classes (POCO) for my latest Web application, I wasn’t looking forward to creating the corresponding tables in SQL Server. I’m not a database guy really. Just a guy who needs to use databases.


Faced with a lot of drudgery, I looked for a shortcut and recalled the Code First capabilities of recent versions of Entity Framework. I know, I’m late to the party but it seems I play with new stuff when it appears as previews and only get my hands dirty when there’s paid work to be done.


I turned to the excellent videos on the Get Started with Entity Framework (EF) page. The first video,  Use Code First to define your model in code and then generate a database was all I needed to get me going. Nicely done!


The hardest part of the whole operation was discovering where EF had created the SQLExpress database. Perhaps I didn’t refresh SSMS enough times or missed it. Anyway, I realized my code knew where it was even if I didn’t, so a look at the connection string did it:

var db = new SpecificationContext();

Next, I’ve got to investigate the capabilities for automatically updating SQL when my classes change. EF has really become a Magic SQL Tool for guys like me.

Are Software Development and IT Careers Doomed in North America?

Sun, 14 Apr 2013 01:29:00 GMT

In the Internet age, a developer can work from anywhere. I do off-site consulting work from my lakefront home in Canada’s near North.

However, as Canadians have learned this week, North American programming and support is increasingly done in India. Well-paid corporate IT jobs are disappearing at an alarming rate as companies look to low-wage outsourcing centres.

Given the alarming Canadian experience this week, a North American college student should think twice about pursuing a career in software development, especially in mid- to large-scale companies. A promising career and a comfortable living could come to an abrupt end.

The raging controversy and boycott campaign this week swirled around Canada’s biggest, richest bank – The Royal Bank of Canada (RBC).

An RBC whistleblower complained to CBC News that RBC was using the Temporary Foreign Worker Program (TFWP) to bring in workers to take over 45 IT jobs, including his. To add insult, the soon-to-be-fired worker, Dave Moreau, was required to train his replacement. Canadians were outraged that a respected and extremely profitable bank would be this callous to employees and work against the economic interests of Canada.

RBC started out by denying that it has hired temporary foreign workers at all – ever. That turned out to be a half-truth because it was working closely with a huge outsourcing supplier named iGate that obtains and manages the ‘global resources’, mostly from India.

People in the software development industry were mystified as to how a replacement worker from India could get approval for a work visa here in the current economic climate.  Is there really a shortage of programmers in Canada?  (It’s patently ridiculous to say there’s a shortage in this instance because the guy who wrote the code is standing there showing you how it works and doesn’t want to give up his job.) It turns out the Canadian government is pretty, er, flexible on who is allowed to work here.

In reality, RBC was letting go Toronto IT staff and outsourcing their jobs to save money. To their dismay, Canadians learned that this has been going on for a long time, is accelerating, and most of the biggest Canadian companies are heavily into outsourcing IT to India. If the work were done by employees in Canada, the low salaries and working conditions would violate our labour law. But what happens offshore is not the bank’s concern. These aren’t employees but “suppliers”.

Experts say that even if the Canadian government tightens up the TFWP to close the loopholes, the general offshoring of IT projects is unstoppable.  The cost savings are so significant (Canadian salaries + benefits vs cheap contractors in India) that a company that doesn’t outsource to India is at a competitive disadvantage.

This isn’t a xenophobic issue – it’s social, economic, and political.  When a North American corporation outsources projects and support functions they’re not looking at where you were born - many of Canada’s top paid programmers are immigrants  -  but how much you cost. Immigrant or native-born, the job is gone and so are you.

Just like your Nike running shoes… once the manufacturing goes overseas nobody expects them to be made in North America again.

Fix: Orchard Error ‘The controller for path '/OrchardLocal/' was not found or does not implement IController.

Thu, 29 Nov 2012 19:40:46 GMT

Suddenly, in a local Orchard 1.6 project, I started getting this error in ShellRoute.cs:

The controller for path '/OrchardLocal/' was not found or does not implement IController.

Obviously I had changed something, but the error wasn’t helping much.  After losing far too much time, I copied over the original Orchard source code and was back in business. Shortly thereafter, I further flattened my forehead by applying a sudden, solid blow with the lower portion of my palm!

You see, in testing the importing of comments via blogML, I had set the added blog as the Orchard site’s Start page. Then, I deleted the blog so I could test another import batch.

The upshot was that by deleting the blog, Orchard no longer had a default (home) page at the root of the site. The site’s default content was missing.

The fix was to go to the Admin subdirectory (http://localhost:30320/OrchardLocal/admin) . add a new page, and check Set as homepage.

Once again, the problem was between the keyboard and the chair. I hope this helps someone else.


Free Team Foundation Service a Boon for Play Projects

Fri, 02 Nov 2012 02:02:53 GMT

My ‘jump in and sink or swim’ learning style leads me to create dozens of unbillable ‘play’ projects in Visual Studio 2012.  For example, I’m currently learning to customize the powerful auction/fixed price/classifieds software called AuctionWorx Enterprise.  I make stupid mistakes as I grasp a new API and configure projects. It’s frustrating to go down a rat hole and discover the VS IDE’s Undo doesn’t reach back to a working build from the previous weekend.

Enter Visual Studio’s Free Team Foundation Service.  Put your play projects into the free source control and check in (or shelve) a snapshot before embarking on something risky. (I already use Discount ASP.NET’s Team Foundation Server hosting for client projects so there’s zero TFS/VS learning curve for me and first class GUI support.)

TFS is free right now for teams of five or fewer. I’m not naive enough to expect ‘free’ to last forever. So, it’ll be interesting to see how much Microsoft intends to charge in 2013 for TFS. In the meantime, why not grab some free source code storage?

BTW, it’s weird to realize that Microsoft is backing up my junky little playtime code on three physically-distinct servers every day - and taking incremental backups every hour.

Tell Visual Studio 2012 UI Designers What to Fix

Tue, 16 Oct 2012 16:44:18 GMT

If you hate the default interface themes in Visual Studio 2012 as much as I do, you have another outlet to vent.

The UI designers have posted a survey where you can tell them how distracting and annoying you find the gray themes and black icons. You even get to comment on the (fixable) all-caps issue.

The UI people didn’t listen much to the (largely hostile) developer feedback during the product design – or more likely were constrained by some edict from on high - but seem more willing now to create decent themes for updates.

Here’s the Visual Studio 2012 Visual Theme survey URL

VS 2012 is a great product hampered by a lousy UI. If I could have a Visual Studio 2010 theme (with its coloured icons) I’d be more than satisfied with the 2012 release.

Web Development Goes Pre-Visual InterDev

Sat, 15 Sep 2012 05:23:04 GMT

As a longtime and hardcore ASP.NET webforms developer, I’m finding the new client-side development world a bit of a grind.  I love learning new technologies, but I can’t help feeling we’ve regressed and lost our old RAD advantage as we move heavy lifting to the client.

For my latest project, I’m using Telerik’s KendoUI in Visual Studio 2012. To say I feel clumsy writing this much JavaScript is an understatement. It seems like the only safe way to ‘write’ this code is by copying a working snippet from someone else and pasting it into my HTML page.  For me, JavaScript has largely been for small UI tasks like client-side validation and a bit of AJAX – and often emitted by a server-side control.

I find myself today lost in nests of curly braces that Ctrl+K, Ctrl+D doesn’t seem to understand that well either. IntelliSense, my old syntax saviour, doesn’t seem to have kept up with this cobweb of code either. Code completion? Not seeing it.

As I fumbled about this evening, I thought about how web development rocketed forward when Microsoft introduced Visual InterDev. Its Design-Time Controls (DTCs) changed the way we created sites. All the iterations of Visual Studio have enhanced that server-side experience where you let a tool write the bulk of the code and manually finesse it from there.

What happened? Why am I typing  properties and values (especially default values!) into VS 2012 to get a client-side grid on a page? Where are the drag and drop objects that traditionally provided 70 percent of the mark-up and configuration?  Did we forget how to write Property Pages where you enter a value and the correct syntax appears magically in the source code?

To me, the tooling was looking the other way as the scene shifted from server-side code to nimble client-side script. It’ll have to catch up.

Although JavaScript is the lingua franca of web browsers, the language is unwieldy, tough to maintain, and messy to debug. If a .NET JIT compiler can turn our VB, F#, and C# source code into an Intermediate Language that executes on a computer, I don’t see why there can’t be a client-side compiler that turns a .NET language into JavaScript that browsers can consume.

Hate That Gray? Wash It Away! Visual Studio 2012 Color Theme Editor

Thu, 06 Sep 2012 14:35:49 GMT

Microsoft’s Matthew Johnson has updated his excellent free tool.

Once we repair the cosmetics, Visual Studio 2012 is going to be very good indeed.

Is there an icon editor for VS 2012?

An, Er, ‘Interesting’ Visual Studio 2012 Colour Theme

Sun, 19 Aug 2012 05:16:00 GMT

After confronting the pathetic, grayed-out appearance of Visual Studio 2012 RTM for a few hours, I craved my relaxing VS2010 themes. I recalled Matthew Johnson’s excellent Visual Studio Color Theme Editor and wondered if it might install on VS2012. No go.

While probing inside his VS Studio Extension (.vsix is actually a .zip), I found a manifest file.

Could it be that simple to change the SupportedProducts node to

and the versioning to


To my surprise, the package installed with those changes!

However, my elation was short-lived and turned to horror. Microsoft’s UX team is double-over in hysterics right now knowing that they got me real good.

I can hear them chortling, “You don’t like our ‘Light’ theme? Then try our colour palette you ignorant b#$^%!”

When I selected the ‘Windows Aero’ theme from the freshly mixed case Theme menu, the resulting screen reminded me of a psychedelic Swedish underground movie from the seventies. If you’ve never seen what an IDE looks like in dayglow and blacklight, here it is. Not sure I can work with this either.



Visual Studio 2012 Downloads Start August 15th

Wed, 01 Aug 2012 16:41:11 GMT

I see from Jason Zander’s blog that MSDN subscribers can download Visual Studio 2012 starting August 15th.

We’ll be officially in the Metro UI design era that bans gradients, rounded corners, shadows, and anything that looks rich or has texture. At the same time, it requires ALL CAPS in menus, plain blocks of a restricted set of colours and a drab, flat appearance.  You’re seeing the theme on all MS web sites now - including the new Oh well, styles come and go. Let’s hope this one goes sooner than later.

The Windows Metro UI is clearly a tablet-oriented UI that doesn’t tax the graphics card or use excessive resources. Pushing a boring, stark UI onto the desktop is a strange move. I suspect there’ll be a service pack or third-party utility  to restore a traditional desktop look and feel to Windows 8 and boost corporate adoption.

However, as many have pointed out, if people continue to buy Windows 7 over Windows 8, Microsoft is in a win-win situation.

Fix: IIS and This page contains both secure and nonsecure items

Thu, 19 Jul 2012 15:32:42 GMT

After moving a production site to use HTTPS exclusively (using the excellent IIS URL rewrite module), Internet Explorer 9 drove me nuts with the “Security Information” warning:

“This page contains both secure and nonsecure items. Do you want to display the nonsecure items?”

This was baffling, because the whole site was SSL using a genuine certificate and therefore had nothing nonsecure to send… At least I thought!

(I could get rid of the IE warning on my own machine by dumbing down the security with custom settings. However, I wanted a proper server-side fix.)

What I had missed was a script link in the HTML that someone had inserted:

The fix was to ensure that the link was to Google’s secure CDN:

It would be nice if the Internet Explorer warning included an option to “Show Me What Is Nonsecure On This Page” so we’d know what we’re getting into.

BTW, thanks to Ruslan for his valuable IIS URL rewriter module support blog at .