Question

Listing Script.fsx:

 #load "AccountDetails.fs"
 #r @"..\packages\FSharpx.Core.1.4.120207\lib\FSharpx.Async.dll"
 #r @"C:\Program Files\Windows Azure SDK\v1.6\ServiceBus\ref\Microsoft.ServiceBus.dll"
 #load "AzureServiceBus.fs"

 open AccountDetails
 open FSharp.Control

 open Microsoft.ServiceBus
 open Microsoft.ServiceBus.Messaging

 // Let's do some service bus hacking
 let tp = TokenProvider.CreateSharedSecretTokenProvider(issuer_name, key)
 let asb_uri = ServiceBusEnvironment.CreateServiceUri("sb", ns, "")
 let mf = MessagingFactory.Create(asb_uri, tp)
 let nm = NamespaceManager(asb_uri, NamespaceManagerSettings(TokenProvider = tp))

 module Queue =
   let queueDescription name = async {
     let! exists = Async.FromBeginEnd(name, nm.BeginQueueExists, nm.EndQueueExists)
     return! if exists then Async.FromBeginEnd(name, nm.BeginGetQueue, nm.EndGetQueue)
             else Async.FromBeginEnd(name, nm.BeginCreateQueue, nm.EndCreateQueue)
     }

And am getting this error: Script.fsx(22,43): error FS0503: The member or object constructor 'BeginCreateQueue' taking 3 arguments are not accessible from this code location. All accessible versions of method 'BeginCreateQueue' take 3 arguments.

So it's telling me that the method with 3 arguments is inaccessible, but that there's an accessible version with 3 arguments?

Was it helpful?

Solution

There are two public overloads of BeginCreateQueue. My guess is type inference is having trouble guessing which one you want. Try adding a type annotation:

Async.FromBeginEnd(name, 
  nm.BeginCreateQueue : string * AsyncCallback * obj -> IAsyncResult, 
  nm.EndCreateQueue)

If that's not the overload you want, try substituting QueueDescription for string.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top