fsprojects / AzureStorageTypeProvider

An F# Azure Type Provider which can be used to explore Blob, Table and Queue Azure Storage assets and easily apply CRUD operations on them.
http://fsprojects.github.io/AzureStorageTypeProvider/
The Unlicense
84 stars 34 forks source link

Calling Delete with an empty collection throws an Argument Exception #86

Closed isaacabraham closed 7 years ago

isaacabraham commented 7 years ago

If you try to call delete and supply an empty collection, the TP pops. Probably a simple fix with a pattern match or similar can fix this: -

System.ArgumentException: The input sequence was empty.
Parameter name: source
   at Microsoft.FSharp.Collections.SeqModule.Head[T](IEnumerable`1 source)
   at FSharp.Azure.StorageTypeProvider.Table.TableRepository.splitIntoBatches(FSharpFunc`2 createTableOp, IEnumerable`1 entities) in c:\\Users\\Isaac\\Source\\Repos\\AzureStorageTypeProvider\\src\\FSharp.Azure.StorageTypeProvider\\Table\\TableRepository.fs:line 156
   at FSharp.Azure.StorageTypeProvider.Table.TableRepository.executeBatchOperation(FSharpFunc`2 createTableOp, CloudTable table, IEnumerable`1 entities) in c:\\Users\\Isaac\\Source\\Repos\\AzureStorageTypeProvider\\src\\FSharp.Azure.StorageTypeProvider\\Table\\TableRepository.fs:line 213
   at FSharp.Azure.StorageTypeProvider.Table.TableRepository.deleteEntities[a](String connection, String tableName, a[] entities) in c:\\Users\\Isaac\\Source\\Repos\\AzureStorageTypeProvider\\src\\FSharp.Azure.StorageTypeProvider\\Table\\TableRepository.fs:line 223

Steps to reproduce:

  1. Build solution running build.fsx
  2. Create a new script as follows: -
#r @"bin\FSharp.Azure.StorageTypeProvider.dll"
#r @"bin\Microsoft.WindowsAzure.Storage.dll"
open FSharp.Azure.StorageTypeProvider
open System
type Local = AzureTypeProvider<"Local">

Local.Tables.employee.Delete []

Write a unit test in the test project as well to prove that this is fixed.