Updated SP DLLs to 4.2.41213.12 now we get Error

Discussions concerning general integration topics.

Moderator: Phil Barton

danhat
Posts: 34
Joined: Wed Feb 11, 2015 2:09 pm

Updated SP DLLs to 4.2.41213.12 now we get Error

Post by danhat »

Exception "Exception has been thrown by the target of an invocation."
Inner Exception: "The type initializer for 'SoftPro.Select.Client.Formula.FormulaCompilationConfiguration' threw an exception."

Line where exception is thrown:

Code: Select all

var os = server.GetService<IOrderStore>();
This code has always worked through many different Softpro upgrades, and is now failing. Any help would be appreciated.

Thanks,
-Dan
Phil Barton
Posts: 54
Joined: Wed Sep 24, 2008 2:37 pm
Location: Raleigh, NC
Contact:

Re: Updated SP DLLs to 4.2.41213.12 now we get Error

Post by Phil Barton »

Can I get a bit more context information from you:

What version did you upgrade from?
Can you provide more from the code snippet so that I can try and repro this in-house?
Can you provide the stack traces from the outer and inner exceptions and/or any event viewer entries around this exception?
Phil Barton
Software Architect
SoftPro
danhat
Posts: 34
Joined: Wed Feb 11, 2015 2:09 pm

Re: Updated SP DLLs to 4.2.41213.12 now we get Error

Post by danhat »

Hi Phil,

Thanks for the response. Here is the full stack trace:

Code: Select all

Encountered an exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'SoftPro.Select.Client.Formula.FormulaCompilationConfiguration' threw an exception. ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.Assembly.GetTypes()
   at SoftPro.Select.Client.Formula.FormulaCompilationConfiguration.AddPreconfiguredProviders()
   at SoftPro.Select.Client.Formula.FormulaCompilationConfiguration..ctor()
   at SoftPro.Select.Client.Formula.FormulaCompilationConfiguration..cctor()
   --- End of inner exception stack trace ---
   at SoftPro.Select.Client.Formula.FormulaCompilationConfiguration.get_Instance()
   at SoftPro.OrderTracking.Client.Orders.OrderStoreProvider..ctor(IServiceProvider site, Uri uri, Boolean profilerEnabled)
   at SoftPro.OrderTracking.Client.Orders.OrderStore..ctor(IServiceProvider site)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
   at SoftPro.ClientModel.Server.CreateService(IServiceContainer container, Type serviceType)
   at System.ComponentModel.Design.ServiceContainer.GetService(Type serviceType)
   at SoftPro.ClientModel.Server.GetService(Type serviceType, Boolean ensureAuthenticated)
   at SoftPro.Select.Client.SelectServer.GetService(Type serviceType)
   at SoftPro.Select.Client.SelectServer.GetService[T]()
This is just a test app we use to read orders, here is the code that is setting up the call:

Code: Select all

            var apiurl = ConfigurationManager.AppSettings["SPSApi.Url"];
            using (var server = new SelectServer(null, new Uri(apiurl)))
            {
                try
                {
                    string reason;
                    if (!server.TryAuthenticate(out reason))
                    {
                        sbOutput.AppendLine(reason);
                    }

                    server.EnsureAuthenticated();
                    var os = server.GetService<IOrderStore>();
it breaks on the last line there.

Our previous version of the Dlls we were upgrading from was version # 4.1.40908.9
danhat
Posts: 34
Joined: Wed Feb 11, 2015 2:09 pm

Re: Updated SP DLLs to 4.2.41213.12 now we get Error

Post by danhat »

Additional info: We are using .net framework 4.6.1, output type is windows application, platform = Active(x86)
Phil Barton
Posts: 54
Joined: Wed Sep 24, 2008 2:37 pm
Location: Raleigh, NC
Contact:

Re: Updated SP DLLs to 4.2.41213.12 now we get Error

Post by Phil Barton »

From the looks of it, it appears that an assembly is possibly not being found when this method queries for types. On the inner exception (the RelfectionTypeLoadException), there are two properties: LoaderExceptions and Types. The first is of type Exception[] and the second of type Type[]. These should align, where the null values in Types align with entries in LoaderExceptions. If you can break on that exception and look at/post those values, we should be able to determine which assemblies are missing.
Phil Barton
Software Architect
SoftPro
danhat
Posts: 34
Joined: Wed Feb 11, 2015 2:09 pm

Re: Updated SP DLLs to 4.2.41213.12 now we get Error

Post by danhat »

LoaderExceptions:{System.Exception[2]}
Types: {System.RuntimeType[1543]}
Source: SoftPro.Select.Client -> mscorlib

I've included all of the SoftPro dll's (name starts with SoftPro) into my project, were there others I should include?
Phil Barton
Posts: 54
Joined: Wed Sep 24, 2008 2:37 pm
Location: Raleigh, NC
Contact:

Re: Updated SP DLLs to 4.2.41213.12 now we get Error

Post by Phil Barton »

What are the contents of the two elements in the LoaderExceptions property?
Phil Barton
Software Architect
SoftPro
danhat
Posts: 34
Joined: Wed Feb 11, 2015 2:09 pm

Re: Updated SP DLLs to 4.2.41213.12 now we get Error

Post by danhat »

Sorry, I had to change my exception settings.
Here are the loading exceptions:
{"Could not load file or assembly 'Microsoft.ApplicationInsights, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.":"Microsoft.ApplicationInsights, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"}

types: {Name = "<>f__AnonymousType0`2" FullName = "<>f__AnonymousType0`2"}
danhat
Posts: 34
Joined: Wed Feb 11, 2015 2:09 pm

Re: Updated SP DLLs to 4.2.41213.12 now we get Error

Post by danhat »

So I added the microsoft.ApplicationInsights using nuget, and now I see this in LoaderExceptions:
{"Could not load file or assembly 'IronPython, Version=2.7.0.40, Culture=neutral, PublicKeyToken=7f709c5b713576e1' or one of its dependencies. The system cannot find the file specified.":"IronPython, Version=2.7.0.40, Culture=neutral, PublicKeyToken=7f709c5b713576e1"}
danhat
Posts: 34
Joined: Wed Feb 11, 2015 2:09 pm

Re: Updated SP DLLs to 4.2.41213.12 now we get Error

Post by danhat »

I've added IronPython package through nuget, and it appears to get through loading the IOrderStore....

Are there any other packages required that I may need to include in my project that you can think of?
Post Reply