In 4.0 GetService<IOrderStore>() fails

Discussions related to SoftPro Select user interface development.

Moderator: Phil Barton

Post Reply
joe.mag
Posts: 122
Joined: Thu Aug 04, 2011 3:11 pm

In 4.0 GetService<IOrderStore>() fails

Post by joe.mag »

I'm working on a Shell package in a brand new 4.0 installation where my migrated 2.6 database is loaded (Select version 4.0.30302.9) and calling IOrderStore os = ss.GetService<IOrderStore>(); using the sample code (i.e. I've instantiated a SelectServer, confirmed connection with TryAuthenticate and then attempted to get the IOrderStore service) with the goal of saving the currently active Order. The call throws an exception. The outer exception's message is "Exception has been thrown by the target of an invocation" while the inner exception's message reads "Ambiguous handler provided for extension 'NextAvailableCDFLine'.\r\nParameter name: d". The call is made in response to a button click on one of my custom ribbon buttons.

I'm quite at a loss and any assistance would be appreciated.

Code: Select all

                NetworkCredential creds = new NetworkCredential("admin", "<actual pwd removed>", "[SERVER]");
                using (SelectServer sps = new SelectServer(new Uri("http://localhost:8080"), creds))
                {
                    string reason;
                    if (!sps.TryAuthenticate(out reason))
                    {
                        // Write login failure reason to console and exit.
			[error handling code removed for brevity]
                    }
                    else
                    {
                        IOrderStore os = ss.GetService<IOrderStore>();

                        // Save the order in the database.
                        os.ApplyChanges(order);
                    }

                }
Melissa McBerkowitz
Posts: 91
Joined: Wed Sep 10, 2008 3:33 pm
Location: Raleigh, NC
Contact:

Re: In 4.0 GetService<IOrderStore>() fails

Post by Melissa McBerkowitz »

This is a bug, Joe - it was identified earlier this week and is a scenario that affects only API integrations, not Select client use. This has been resolved for the v4.0.1 update that is being released later today. I'll let our Impl team know that you'll need a copy of that new version transferred.

Sorry for the confusion!
Melissa McBerkowitz
VP of Product Strategy, SoftPro
joe.mag
Posts: 122
Joined: Thu Aug 04, 2011 3:11 pm

Re: In 4.0 GetService<IOrderStore>() fails

Post by joe.mag »

Update: with 4.0.30302.25 installed I can now get past the call to GetService<IOrderStore>() but by calling ApplyChanges(order) the code throws an exception. The outer exception is the rather generic "Object reference is not set to an instance of an object" while the inner exception is null. I confirmed that both the service object and my order object are not themselves null. The order I'm calling ApplyChanges on has had no operations performed on it--either by me in the UI or in the code preceding the ApplyChanges call in the package's button handler--I just open it and then press my
custom button whose code then attempts the ApplyChanges. Just in case the order needs to be dirty for ApplyChanges to work I also tried with
an order I did change slightly. Note: I can save the order from the UI just fine (i.e. if I click the Save button manually).

Also, in my shell package, when I use the IOrderStore object to attempt to register an OrderSaving handler I'm getting the same "Object reference not set...." which means I can't do any save-time validation in my shell package (I'd prefer having to implement this in a server package since there's a lot of shared code between my save-time processing and my button handlers).
BobRichards
Posts: 1377
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: In 4.0 GetService<IOrderStore>() fails

Post by BobRichards »

Can you send some example code that isolates the problem?
Bob Richards, Senior Software Developer, SoftPro
Post Reply