Upgrading VS2010 Beta 2 UML diagrams to VS2010 Release Candidate

Living on the bleeding edge means we have to bleed occasionaly so I wasn't totally surprised when my modeling project wouldn't load under the VS2010 Release candidate - but I was concerned about the hemorrhage this was causing as I not only had days of work invested in UML diagrams for my personal project (http://ehr.codeplex.com/) but also weeks of work invested for my current contract.  

So when a co-worker told me about the Microsoft Visual Studio 2010 Architecture Model Upgrade Tool I was ecstatic!   I was relieved when upon upgrade completion I found that all of my diagrams opened up - I was now able to continue forward instead of losing countless time rebuilding old diagrams from print-outs.

Note: I did have some inconvenience during the first upgrade and used lessons learned to streamline the second.   Some tips follow:

1.  I didn't keep the default install path.   I selected the root folder of my documentation (Modeling is the Beta 2 and ModelingRC was the new diagrams moving forward).

2.  Since I was under source control on both projects I was sure to reset the readonly flag on all files in the Beta 2 Modeling folder (the second time).   Since I couldn't "check out" all files from the solution because I couldn't load the project to do so - my first attempt failed to upgrade because the files were readonly and I ended up going back and forth until I got through all of the failed files.   

3.  By installing to the root folder I was able to use the /upgrade /recursive command line which simplifies the switches required to run the upgrade utility.  

 
Note: I had to insert a space between /upgrade and /recursive 


Tags: , ,
Categories: Visual Studio 2010


Actions: E-mail | Permalink |  Grammar/Typo/Better way? Please let me know

VS2010 RC - Azure "One of the request inputs is out of range" error

Things were starting to move rather smoothly, my base classes seemed to be pretty solid and all that remained was to add CRUD capabilities to CloudBlockBlob objects (Tables and Containers are done). 

I setup my unit test to create a new container for my Blob and I was greeted with a foreboding "One of the request inputs is out of range" with the inner exception reporting "The remote server returned an error: (400) Bad Request"; another head-banging session was about to begin....

Line 209 below is where the fun started, my container ("Images") didn't exist and the baseclasses are smart enough to create the container if it isn't available.   What had me chasing my tail for a while was "what input was wrong".   The short version - Azure only accepts lower case!!

Once I figured this out I updated by baseclasses to ensure that key points would convert to lowercase so that I would no longer be greeted by this obscure message in the future - I can use whatever I like and it will ensure nothing reaches the backend in anything other than lowercase.

 

  189 /// <summary>

  190 /// Determines whether this instance [can create cread update delete

          BLOB from file name].

  191 /// </summary>

  192 [TestMethod]

  193 [DeploymentItem("Images\\Jesus.jpg")]

  194 [DeploymentItem("Images\\AngelRays.jpg")]

  195 public void CanCreateCreadUpdateDeleteBlobFromFileName()

  196 {

  197     string imageName = "Jesus.jpg";

  198     string imageName2 = "AngelRays.jpg";

  199 

  200     string container = "Images";

  201 

  202     Assert.IsTrue(File.Exists(imageName));

  203 

  204     string fullName = new FileInfo(imageName).FullName;

  205     string fullName2 = new FileInfo(imageName2).FullName;

  206 

  207     //::::[ CREATE ]:::::

  208 

  209     string uniqueName = client.CreateBlob(container, fullName);

  210     Assert.IsNotNull(uniqueName);

  211 

  212 

  213     // ::::[ READ ]::::::

  214 

  215     using (MemoryStream stream = client.ReadBlobStream(container, uniqueName))

  216     {

  217         Assert.IsNotNull(stream);

  218         Bitmap image = new Bitmap(stream);

  219 

  220         // Save image as file

  221         image.Save("_"+imageName, ImageFormat.Jpeg);

  222         Assert.IsTrue(File.Exists("_"+imageName));

  223     }

  224 

  225     // ::::[ UPDATE ]:::::

  226 

  227     client.UpdateBlob(container, uniqueName, fullName2);

  228     using (MemoryStream stream = client.ReadBlobStream(container, uniqueName))

  229     {

  230         Assert.IsNotNull(stream);

  231         Bitmap image = new Bitmap(stream);

  232 

  233         // Save image as file

  234         image.Save("-" + imageName, ImageFormat.Jpeg);

  235         Assert.IsTrue(File.Exists("-" + imageName));

  236     }

  237     byte[] bytes1 = File.ReadAllBytes("_" + imageName);

  238     byte[] bytes2 = File.ReadAllBytes("-" + imageName);

  239     Assert.AreNotEqual(bytes1.Length, bytes2.Length);

  240 

  241 

  242     //:::[ DELETE ]:::::

  243     bool deleted = client.DeleteBlob(container, uniqueName);

  244     Assert.IsTrue(deleted);

  245 

  246     var deletedFileIsNull = client.ReadBlob(container, uniqueName);

  247     Assert.IsNull(deletedFileIsNull);

  248 }

Source code available at http://EHR.CodePlex.com  (GWN.Contrib.Azure project) 


Tags: , ,
Categories: Azure | Visual Studio 2010


Actions: E-mail | Permalink |  Grammar/Typo/Better way? Please let me know

VS2010 RC - Unit Testing Azure Create, Read, Update and Delete (CRUD)

I did some head-banging this morning while writing a unit test for Azure table storage CRUD operations.   My WebRole application uses the PersonDataSource (line 8) as an ObjectDataSource and works without issue so I was perplexed as to why my unit test kept crashing on line 40.   The UpdateItem(testdata) was successfully executing but the value was not being updated to "TestOrganization" as expected.

    1 /// <summary>

    2 /// Determines whether this instance can create read update delete

    3 /// azure table records.

    4 /// </summary>

    5 [TestMethod]

    6 public void CanCreateReadUpdateDeleteAzureTableRecords()

    7 {

    8     PersonDataSource mockData = new PersonDataSource();

    9     EHRPerson testData = null;

   10 

   11     string uniqueId = Guid.NewGuid().ToString();

   12 

   13     //:::::[ CREATE ]:::::::

   14     bool isSuccessful = mockData.CreateItem(new EHRPerson

   15     {

   16         ID = uniqueId,

   17         Name = "EHRTest",

   18         Organization = "EHROrganization",

   19         PersonType = "EHRPersonType",

   20         ProfessionalTraining = "EHRProfessionalTraining"

   21     });

   22     Assert.IsTrue(isSuccessful);

   23 

   24     //:::::[ READ ]:::::::

   25     testData = new List<EHRPerson>(mockData.Read())

   26         .FirstOrDefault<EHRPerson>(p => p.ID.Equals(uniqueId));

   27 

   28     Assert.IsNotNull(testData);

   29     Assert.AreEqual("EHRTest", testData.Name);

   30     Assert.AreEqual("EHROrganization", testData.Organization);

   31     Assert.AreEqual("EHRPersonType", testData.PersonType);

   32     Assert.AreEqual("EHRProfessionalTraining", testData.ProfessionalTraining);

   33 

   34     //:::::[ UPDATE ]:::::::

   35     testData.Organization = "TestOrganization";

   36 

   37     mockData.UpdateItem(testData);

   38     testData = new List<EHRPerson>(mockData.Read())

   39         .FirstOrDefault<EHRPerson>(p => p.ID.Equals(uniqueId));

   40     Assert.AreEqual("TestOrganization", testData.Organization);

   41 

   42     //:::::[ DELETE ]:::::::

   43     mockData.DeleteItem(testData);

   44 

   45     testData = new List<EHRPerson>(mockData.Read())

   46         .FirstOrDefault<EHRPerson>(p => p.ID.Equals(uniqueId));

   47     Assert.IsNull(testData);

   48 

   49 }

What I found was that my item (TItem) parameter was being reset to default items on line 330 (image below) effectively overwriting my changes with original values.    However, if I ran my Cloud application it successfully updated the data (PersonDataSource as ObjectDataSource).   

I discovered that I was being returned the reference of the item that was read previously (line 25 above) which meant I was passing around a reference so line 330 below effectively replaced it with the original contents thus entry = item.  This wasn't a problem with the ObjectDataSource because I trust that ASP.NET creates a new instance and populates it with form values prior to sending it to the ObjectDataSource.

I resolved the issue by updating my TableServiceEntity base class to implement ICloneable so that I don't have to manage it at higher levels.    All of my table entities, i.e., EHRPerson will be POCO so this should work well.  

Source code available at http://ehr.codeplex.com/ (GWN.Contrib.Azure project) 

 


Tags: , ,
Categories: Azure | Visual Studio 2010


Actions: E-mail | Permalink |  Grammar/Typo/Better way? Please let me know

Serialize / Deserialize POCO objects - Silverlight and WPF (multi-targeting code)

In our SDMS application (source code here) we have a library that is multi-targeting (shared codebase) for ASP.NET MVC2, Silverlight and WPF, as you'll see in the image below the "only" differences will be the App.xaml and Mainxxxx.xaml files.   To pull this off we give the CAG Bootstrapper a little more work to do.

One of the jobs of the GetModuleCatalog() method in the Bootstrapper is to deserialize our parameter object (more on parameter object in my next blog).   We have to do this in GetModuleCatalog because it is called within the UnityBootstrapper's CreateContainer command which occurs prior to CreateShell (see sequence diagram here).  Note that we do this with the object extension DeserializeObject

The following code will permit us to serialize and deserialize our POCO object.   The code resides in this applications UnityContrib project in the Extensions\ObjectExtension class.

 


Tags: , , , ,
Categories: Unity | Visual Studio 2010 | WPF


Actions: E-mail | Permalink |  Grammar/Typo/Better way? Please let me know

Migrating Health Common User Interface from VS2008 to VS2010

Initial efforts to convert/migrate the Microsoft Health Common User Interface from VS2008 to VS2010 failed miserably.   There were so many errors it wasn't real apparent where to start (after a few hours I gave up).  

After having converted a number of other programs I found there are a few consistent problems that once resolved move things along nicely.   They revolve around "Treat warnings as errors", Code Analysis and missing references.  If one of these occurs on an assembly that multiple projects have references to the error rate is compounded (making it harder to find).

After make the following few changes I found the Health Common User Interface compiles under VS2010:

Microsoft.Cui.SamplePages --- Add reference to System.Net

Microsoft.Cui.SampleWinForm --- Select None for "Treat warning as errors"

 

Uncheck "Enable Code Analysis on Build" for the following files:

  • Microsoft.Cui.ShowcaseControls
  • Microsoft.Cui.SamplePages
  • Microsoft.Cui.Roadmap
  • Microsoft.Cui.IsvDataProvider
  • Microsoft.Cui.Data
  • Microsoft.Cui.Controls

You'll want to remove the following three Unit Test

  • NhsCui.Toolkit.Test
  • NhsCui.Toolkit.Web.Test
  • NhsCui.Toolkit.WinForms.Test

If you don't you'll be prompted to convert the solution each time you load it as it will attempt to convert these and will fail.

Once the steps are complied with you can compile successfully!


Tags: , ,
Categories: Visual Studio 2010


Actions: E-mail | Permalink |  Grammar/Typo/Better way? Please let me know

VS2010 - The ServicePointManager does not support proxies with the https scheme

I created a Codeplex project for a Visual Studio 2010 solution and was greated with the error "The ServicePointManager does not support proxies with the https scheme".

When you Google for "VS2010 Codeplex" you will find the following link at the top of the list:

http://coolthingoftheday.blogspot.com/2009/05/have-vs2010-beta-1-trying-to-connect-to.html

Where I was very happy to find a solution I was disappointed that it was only partial; it didn't provide the actual registry entries.  I found a blog that actually provided the registry settings and was disappointed when it didn't work.  

So I continued my search and was glad to find the following blog because it actually provided the commands necessary to automatically add the required registry entry.   It seemed to match what I did manually so I trust I made a typo somewhere.

The following link fixes it:

http://blogs.msdn.com/ablock/archive/2009/05/20/for-tfs-2010-beta-1-resolving-tf31001-the-servicepointmanager-does-not-support-proxies-with-the-https-scheme.aspx

I deleted my entries and ran the above commands for a 64bit environment and "walla!" I was able to connect to my codeplex project using VS2010!

For you 64bit folks the following batch file may save you a few steps

tfsFix.bat (267.00 bytes)

Note: In case their site is down at the time you need it I provide an excerpt (important stuff) from the above link:

If you are receiving the TF31001 error, you should be able to resolve this issue by running the following commands:

On all machine:

reg add hklm\SOFTWARE\Microsoft\VisualStudio\10.0\TeamFoundation\RequestSettings /v BypassProxyOnLocal /t REG_SZ /d False

reg add hklm\SOFTWARE\Microsoft\TeamFoundationServer\10.0\RequestSettings /v BypassProxyOnLocal /t REG_SZ /d False

 

Additionally on a 64-bit machine:
reg add hklm\SOFTWARE\Wow6432Node\Microsoft\TeamFoundationServer\10.0\RequestSettings /v BypassProxyOnLocal /t REG_SZ /d False
reg add hklm\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\TeamFoundation\RequestSettings /v BypassProxyOnLocal /t REG_SZ /d False
  --Aaron

 


Tags: , ,
Categories: Visual Studio 2010


Actions: E-mail | Permalink |  Grammar/Typo/Better way? Please let me know

Visual Studio 2010 and .NET Framework 4.0 CTP

Link follows for the CTP download:
http://www.microsoft.com/downloads/details.aspx?FamilyId=922B4655-93D0-4476-BDA4-94CF5F8D4814&displaylang=en

Be sure to review System Requirements - I was forced to purchase a new computer (requires 2 gig and dual-core processor).  An excerpt from the above link follows:

For more information on Visual Studio 2010 and the .NET Framework 4.0 visit http://msdn.microsoft.com/en-us/vs2008/products/cc948977.aspx

This CTP release is available in English only as a Virtual PC image. To download Virtual PC 2007 please visit http://www.microsoft.com/downloads/details.aspx?FamilyId=28C97D22-6EB8-4A09-A7F7-F6C7A1F000B5&displaylang=en
The CTP is designed to enable users to experience Visual Studio 2010 and the .NET Framework 4.0, and to provide feature design feedback on a limited set of features. These features are exposed through a set of walkthroughs that are included in the VPC itself. Many common development scenarios may not work in this CTP as it is designed to support the above walkthroughs.

 Top of page

System Requirements

  • Supported Operating Systems: Windows Server 2003; Windows Server 2008; Windows Vista; Windows XP
  • Minimum 75 GB available HDD space
  • The host computer must have a minimum of 2 GB RAM, with 1 GB allocated to the host operating system and 1 GB allocated to the VPC.
  • We recommend that the host computer CPU be at least a Core Duo 2 GHz processor.
  • Service Pack 1 of Microsoft Virtual PC 2007 is required to access the VPC.

To upgrade Microsoft Virtual PC 2007 to Service Pack 1, download and install the update from: http://www.microsoft.com/downloads/details.aspx?FamilyID=28c97d22-6eb8-4a09-a7f7-f6c7a1f000b5&DisplayLang=en

If the host computer has more than 2 GB RAM, you can increase performance of your VPC by allocating more memory to the VPC. After that change to the VM settings, you will need to update the page file inside the guest OS to be 1.5 times the amount of RAM you’ve allocated.

Tags:
Categories: Visual Studio 2010


Actions: E-mail | Permalink |  Grammar/Typo/Better way? Please let me know