willsam100 / FShaper

FShaper - a tool to make the process of converting C# to F# much easier
MIT License
44 stars 11 forks source link

Failure to translate BLOB sample #9

Closed MaxWilson closed 3 years ago

MaxWilson commented 3 years ago

No Curly raises error "The match cases were incomplete" when translating Tutorial: Access Azure Storage from a web app. Reproducing code here for convenience:

using System;
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;
using System.IO;
using Azure.Identity;

// Some code omitted for brevity.

static public async Task UploadBlob(string accountName, string containerName, string blobName, string blobContents)
{
    // Construct the blob container endpoint from the arguments.
    string containerEndpoint = string.Format("https://{0}.blob.core.windows.net/{1}",
                                                accountName,
                                                containerName);

    // Get a credential and create a client object for the blob container.
    BlobContainerClient containerClient = new BlobContainerClient(new Uri(containerEndpoint),
                                                                    new DefaultAzureCredential());

    try
    {
        // Create the container if it does not exist.
        await containerClient.CreateIfNotExistsAsync();

        // Upload text to a new block blob.
        byte[] byteArray = Encoding.ASCII.GetBytes(blobContents);

        using (MemoryStream stream = new MemoryStream(byteArray))
        {
            await containerClient.UploadBlobAsync(blobName, stream);
        }
    }
    catch (Exception e)
    {
        throw e;
    }
}
willsam100 commented 3 years ago

@MaxWilson thanks for raising the bug.

An update has been pushed that fixes the immediate issue of the code not rendering. (No Curly will translate the C# to F# on this page).

Note that the comments are in the try/catch are not yet carried over, so I will leave the issue open until fixed.

willsam100 commented 3 years ago

@MaxWilson an update has been pushed that now carries all comments over.

Closing as the issue has been fixed. Please raise (or re-open) if there is something else that needs fixing