I’ve been working with Azure’s new CloudDrive capability, and today I ran into a problem with caching that I thought I would share the workaround for.
The first step in using caching with CloudDrive is to define a LocalResource for the role in the csdef file:
<LocalStorage name="AzureDriveCache" cleanOnRoleRecycle="false" sizeInMB="8000" />
Next, you need to initialize CloudDrive caching thus:
var localResource = RoleEnvironment.GetLocalResource("AzureDriveCache"); CloudDrive.InitializeCache(localResource.RootPath, localResource.MaximumSizeInMegabytes);
And finally, mount your drive:
var driveLetter = cloudDrive.Mount(4000, DriveMountOptions.None);
And this is when the problem comes up. Doing this will result in an exception: HRESULT=D0000033 When calling CloudDrive.Mount
Through logging, I see that the RootPath property above was returned as:
After consulting with the Azure team, I learned that there is a bug in the current SDK, and that the trailing ‘\’ character is the cause of the error.
Remove it, and you’ll be fine.