Jamie Dixon
Jamie Dixon

Reputation: 4302

Retrieving data from Azure Table Storage using Azure Cosmos Library in the FSI Fails

I am using Visual Studio 2019 with a F# script file.

I imported the latest nuget package to insert and retrieve an entity in Azure Table Storage

Install-Package Microsoft.Azure.Cosmos.Table -Version 1.0.5

The Insert works fine, but the retrieval fails with the following error:

val it : Collections.Generic.IEnumerable = Error: Method not found: 'System.Threading.Tasks.Task`1 Newtonsoft.Json.JsonReader.ReadAsync(System.Threading.CancellationToken)'.

Here is the script:

#r @"..\.nuget\packages\microsoft.azure.cosmos.table\1.0.5\lib\netstandard2.0\Microsoft.Azure.Cosmos.Table.dll"
#r @"..\.nuget\packages\microsoft.azure.documentdb.core\2.1.3\lib\netstandard1.6\Microsoft.Azure.DocumentDB.Core.dll"

open System
open Microsoft.Azure.Cosmos.Table

type Record(searchModule:string, documentId: Guid, extractDateTime: DateTime, uri: String) =
    inherit TableEntity(partitionKey=searchModule, rowKey=documentId.ToString())
    new() = Record(null,Guid.Empty,DateTime.MinValue,null)
    member val DocumentId = documentId with get, set
    member val ExtractDateTime = extractDateTime with get, set
    member val Uri = uri with get, set

let connectionString = "DefaultEndpointsProtocol=https;AccountName=XXX;AccountKey=XXX;EndpointSuffix=core.windows.net"
let tableName = "mytable"
let storageAccount = CloudStorageAccount.Parse(connectionString)
let tableClient = storageAccount.CreateCloudTableClient()
let table = tableClient.GetTableReference(tableName)

let searchTerm = "@http://www.microsoft.com"
let query = TableQuery<Record>().Where(TableQuery.GenerateFilterCondition("uri",QueryComparisons.Equal,searchTerm))
let searchResult = table.ExecuteQuery(query)
searchResult

Thanks in advance

Upvotes: 1

Views: 135

Answers (1)

Jamie Dixon
Jamie Dixon

Reputation: 4302

This seems to be a .FSI issue. When I run the same code in a console app, the results come back as expected.

Upvotes: 1

Related Questions