When building the Azure extension in Visual studio there are no issues and the Dev Box providers bloom image is sent correctly to Dev Home. However, when building using the official build script and outside of Visual studio with .\Build.cmd -Configuration release trimming and ReadyToRun are enabled. I suspect that due to this combination somehow it is causing a System.InvalidCastException: Specified cast is not valid. error when we attempt to use the StorageFile.OpenReadAsync method. This then returns a failure ComputeSystemThumbnailResult back to Dev Home who then shows the Dev Environments Default image instead of the Bloom image for Dev Boxes.
This is the default image for environment:
but for Dev Boxes we should be showing this image:
This is an issue because the Hyper-V extension also uses that default image. So to the user it will look like all the images are the same and there is no distinction. Due to this being build related, and we're so close to the cut off date for bug fixes, I do not want to add anything that could destablize anything else. So, This PR adds a work around where we get the location of the bloom image in the Azure extension package by using the same MRT SHLoadIndirectString api that we use in Dev Home to get images from other packages. I'm copying over the same function here:
and reusing so we can get the absolute path to the bloom image thats located in the azure extensions package, then use the .NET file system api Storage.IO.File.ReadAllBytes to convert the file to an array of bytes which we return back to dev home just like before.
Here is a video of how it looks BEFORE this change when you build the azure extension using the official build script. I'm using the current Dev Home canary to test this
Here is a video of how it looks AFTER this change when you build the azure extension using the official build script. I'm using the current Dev Home canary to test this
Detailed description of the pull request / Additional comments
Validation steps performed
Build using official azure extension build script and then used current Dev Home canary to confirm that the bloom image is now correctly being sent for Dev Boxes
Summary of the pull request
When building the Azure extension in Visual studio there are no issues and the Dev Box providers bloom image is sent correctly to Dev Home. However, when building using the official build script and outside of Visual studio with
.\Build.cmd -Configuration release
trimming and ReadyToRun are enabled. I suspect that due to this combination somehow it is causing aSystem.InvalidCastException: Specified cast is not valid.
error when we attempt to use the StorageFile.OpenReadAsync method. This then returns a failureComputeSystemThumbnailResult
back to Dev Home who then shows the Dev Environments Default image instead of the Bloom image for Dev Boxes.This is the default image for environment:
but for Dev Boxes we should be showing this image:
This is an issue because the Hyper-V extension also uses that default image. So to the user it will look like all the images are the same and there is no distinction. Due to this being build related, and we're so close to the cut off date for bug fixes, I do not want to add anything that could destablize anything else. So, This PR adds a work around where we get the location of the bloom image in the Azure extension package by using the same MRT SHLoadIndirectString api that we use in Dev Home to get images from other packages. I'm copying over the same function here:
https://github.com/microsoft/devhome/blob/b871d3dbdb60f7effcc0c5ff0efaefed2ff6a72f/common/Services/StringResource.cs#L72
and reusing so we can get the absolute path to the bloom image thats located in the azure extensions package, then use the .NET file system api
Storage.IO.File.ReadAllBytes
to convert the file to an array of bytes which we return back to dev home just like before.Here is a video of how it looks BEFORE this change when you build the azure extension using the official build script. I'm using the current Dev Home canary to test this
https://github.com/microsoft/DevHomeAzureExtension/assets/105318831/2c1f9de6-0054-44bb-8a3b-5d1d8cb9381d
Here is a video of how it looks AFTER this change when you build the azure extension using the official build script. I'm using the current Dev Home canary to test this
https://github.com/microsoft/DevHomeAzureExtension/assets/105318831/91f6ec25-52c6-4259-b8b0-2dc1b474f345
References and relevant issues
Detailed description of the pull request / Additional comments
Validation steps performed
Build using official azure extension build script and then used current Dev Home canary to confirm that the bloom image is now correctly being sent for Dev Boxes
PR checklist