Acumatica 6.10.0010: ARSalesPriceMaint.CalculateSalesPrice not working from Extension BLC - acumatica

My Acumatica upgrade to 6.10.0010 is giving me an error when ARSalesPriceMaint.CalculateSalesPrice is called from an Extension class.
I cannot tell if the Singleton approach to ARSalesPriceMaint leads to this error when called thru an Extension class such as SOOrderEntry, ARCashSaleEntry, others:
Index was out of range. Must be non-negative and less than the size of
the collection.
Parameter name: index
at
System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument
argument, ExceptionResource resource)
at System.Collections.Generic.List`1.InsertRange(Int32 index,
IEnumerable`1 collection)
at
PX.Data.PXCache.AlteredDescriptor..ctor(PXEventSubscriberAttribute[]
attributes, HashSet`1 fields, _CacheAttachedDelegate method, Type
cacheType)
at PX.Data.PXGraph.b(Type A_0)
at PX.Data.PXGraph.CreateInstance(Type graphType, String prefix)
at PX.Data.PXGraph.CreateInstance(Type graphType)
at PX.Data.PXGraph.CreateInstance[Graph]()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at PX.Objects.AR.ARSalesPriceMaint.get_SingleARSalesPriceMaint()
at PX.Objects.AR.ARSalesPriceMaint.CalculateSalesPrice(PXCache sender, String custPriceClass, Nullable`1 customerID, Nullable`1 inventoryID, CurrencyInfo currencyinfo, String UOM, Nullable`1 quantity, DateTime date, Nullable`1 currentUnitPrice)
...
I am using VS2013 and hope to upgrade to VS2015 soon.
Has anyone encountered this error type and know how to work around?
Thank you.

This upgrade error type ended up being from my customization code, specifically from an older DAC extension of ARSalesPrice for a custom field called PriceCode (note the lack of the 'usr' prefix). A secondary problem for lack of SOShipLineSplits was related to an older Cst_SOLine class I had from ACE customization. By moving its 3 custom fields into a new CacheExtension class, the problem was resolved.

Related

Kentico upgrade 10 to 11 - CMSDataVersion upgrade failure

I used the upgrade100_110.exe tool to upgrade my Kentico 10 CMS solution. The solution and database schema were successfully upgraded, but upon accessing the site's admin portal in a web browser, the expected data upgrade did not occur.
To clarify, the CMSSettingsKey KeyValue for CMSDBVersion is 11.0, but the CMSSettingsKey KeyValue for CMSDataVersion is still 10.0.
The only UPGRADE events in the Kentico event log are the following:
Message: 'system' is a duplicate attribute name. Line 1, position 5202.
Exception type: System.Xml.XmlException Stack trace: at
System.Xml.XmlTextReaderImpl.Throw(Exception e) at
System.Xml.XmlTextReaderImpl.AttributeDuplCheck() at
System.Xml.XmlTextReaderImpl.ParseAttributes() at
System.Xml.XmlTextReaderImpl.ParseElement() at
System.Xml.XmlTextReaderImpl.ParseElementContent() at
System.Xml.XmlTextReaderImpl.Read() at
System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) at
System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) at
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean
preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader
reader) at System.Xml.XmlDocument.LoadXml(String xml) at
CMS.FormEngine.FormHelper.MergeFormDefinitions(String original, String
alternative, Boolean includeAllAltFields) at
UpgradeProcedure.UpdateAlternativeForms() at
UpgradeProcedure.UpgradeApplication(Func`1 versionSpecificMethod,
String newVersion, String packageName) at UpgradeProcedure.Update()
and
Message: 'system' is a duplicate attribute name. Line 1, position
5202.
Exception type: System.Xml.XmlException Stack trace: at
System.Xml.XmlTextReaderImpl.Throw(Exception e) at
System.Xml.XmlTextReaderImpl.AttributeDuplCheck() at
System.Xml.XmlTextReaderImpl.ParseAttributes() at
System.Xml.XmlTextReaderImpl.ParseElement() at
System.Xml.XmlTextReaderImpl.ParseElementContent() at
System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) at
System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) at
System.Xml.XmlDocument.Load(XmlReader reader) at
System.Xml.XmlDocument.LoadXml(String xml) at
CMS.FormEngine.FormHelper.MergeFormDefinitions(String original, String
alternative, Boolean includeAllAltFields) at
UpgradeProcedure.UpdateAlternativeForms() at
UpgradeProcedure.UpgradeApplication(Func`1 versionSpecificMethod,
String newVersion, String packageName) at UpgradeProcedure.Update()
I'm looking for suggestions on how to troubleshoot this problem. Any suggestions on where to start would be helpful!
Are there any custom modules or modules from marketplace? I've seen an issue where this error had been caused by the URL Redirection module. https://devnet.kentico.com/articles/url-redirection
Or, another idea: MergeFormDefinitions will merge upgraded form definitions with previous ones to transfer custom fields to new forms.
It seems like one of the old forms is not stored correctly and the XML definitions are containing system elements twice. Or, it contains a field called like this which could be a reserved word.
You can check the definitions in the CMS_Calss table to see it contains a element.
Alternatively, you can add a breakpoint into the upgrade procedure to catch the temp table. Then you will be able to see the new definitions and compare them. These two are being merged later and it seems the issue occurs at that time.

Windows azure redis cache migration issue

We are hosting our site on windows azure where site is running on multiple instances.Due to multiple instances we were using shared cache for storing session values. As Microsoft is going to stop shared cache and recommended to use redis cache to store session. I modified project to use redis cache and it worked for most of the pages. My problem is that, we have a very important page "search page" (we are using lucene.net for search functionality) in our site which stores a lot of data in session and this page is not working. After hitting search button, it shows connecting status in address bar for a long time and goes to oops page of website. We are recording error messages in DB so after looking at there we found following error message.
System.Runtime.Serialization.SerializationException: Type 'myWeb.clsSearchCriteria+ContentCriteria' in Assembly 'HelmBriscoeWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at Microsoft.Web.Redis.RedisUtility.GetBytesFromObject(Object data)
at Microsoft.Web.Redis.RedisUtility.AppendUpdatedOrNewItemsInList(ChangeTrackingSessionStateItemCollection sessionItems, List`1 list)
at Microsoft.Web.Redis.RedisConnectionWrapper.TryUpdateIfLockIdMatchPrepare(Object lockId, ISessionStateItemCollection data, Int32 sessionTimeout, String[]& keyArgs, Object[]& valueArgs)
at Microsoft.Web.Redis.RedisConnectionWrapper.TryUpdateIfLockIdMatch(Object lockId, ISessionStateItemCollection data, Int32 sessionTimeout)
at Microsoft.Web.Redis.RedisSessionStateProvider.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem)
at System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs)
at System.Web.SessionState.SessionStateModule.OnEndRequest(Object source, EventArgs eventArgs)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I am not sure if this is related to my problem but seems if this is fixed, page will work properly. Has anyone any idea why this error occurred and how can I fix it?
Thanks
I solved this problem myself by adding serialization attribute to class like below.
<Serializable()> _
Public Class clsSearchCriteria
Thanks

ServiceStack.OrmLite equivalent of Single/SingleOrDefault from Entity Framework

Currently when using OrmLite library from ServiceStack if I want single entity selected I do:
AppUser user = db.First<AppUser>(q => q.Id == id);
However since Single is more precise (obviously I want exception thrown if somehow multiple users with same id ended up in database) I was wondering if there is overload that I can use. Currently when I do db.Single I just get that overload with manual filtering:
public static T SingleOrDefault<T>(this IDbConnection dbConn, string filter);
OK, I found what the issue is - the version I'm using (3.9.71) doesn't have that overload - it was added later:
https://github.com/ServiceStack/ServiceStack.OrmLite/commit/f2f5f80f150f27266bdcaf81b77ca60b62897719#diff-e9a84724e6a8315ec7f7fc5a5512a44b
Seems I'll need to extend that class from within my code.

Mapping DayOfWeek from the System namespace using Fluent Nhibernate

I'm currently working on an MVC 3 project which uses Fluent NHibernate. I utilise the System.DayOfWeek enum but when mapping this I received the following error -
Stack Trace:
[MappingException: Could not determine type for: DayOfWeek, for columns: NHibernate.Mapping.Column(WeekStart)]
NHibernate.Mapping.SimpleValue.get_Type() +456
NHibernate.Mapping.SimpleValue.IsValid(IMapping mapping) +40
NHibernate.Mapping.PersistentClass.Validate(IMapping mapping) +123
NHibernate.Mapping.RootClass.Validate(IMapping mapping) +24
NHibernate.Cfg.Configuration.ValidateEntities() +280
NHibernate.Cfg.Configuration.BuildSessionFactory() +43
FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() +54
[FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory.
Check PotentialReasons collection, and InnerException for more detail.
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET
Version:4.0.30319.272
Example usage -
Map(x => x.WeekStart).CustomType(typeof(DayOfWeek));
I've seen this specific question asked on mailing lists and on stackoverflow but the nuances of it never seemed to be fully grasped and the person asking the question is referred to how to use a custom type mapping.
I am well aware of how to use the customtype functionality on fluent maps and frequently make use of it. However I don't understand why this enum in particular cannot be mapped. I presume it has something to do with the System namespace to which it belongs?
If anyone can shed any light on this I'd be most happy.
Thanks
I got the mapping of DayOfWeek enum to work with this mapping.
mapping.Map(x => x.DayOfWeek);
and its maps fine to a nvarchar(255) in my mssql database.
My property looklikes this
public virtual DayOfWeek DayOfWeek { get; set; }
I use NHibernate version: 3.3.1.4000 and Fluent Nhibernate version: 1.3.0.733
As with any enum mapping with NHibernate, save yourself some grief (dirty reads which cause unnecessary writes, different type specified in database, etc.) and just always use a PersistentEnumType.
In this example, create your PersistentEnumType:
public class NHibernateDayOfWeekEnumMapper : global::NHibernate.Type.PersistentEnumType
{
public NHibernateDayOfWeekEnumMapper()
: base(typeof(DayOfWeek))
{
}
}
Then use it to do your mapping:
Map(x => x.DayOfWeek).CustomType<NHibernateDayOfWeekEnumMapper>().Not.Nullable();
Now you've got the entity that doesn't dirty read (and so no unnecessary writes) and a correct type mapping in the database (when you use SchemaExport to generate your schema).
For more information see an oldie but goody at http://eashi.wordpress.com/2008/08/19/mapping-enumeration-of-type-int-in-nhibernate/

null reference exceptions when adding

I discovered SubSonic this evening, and after a little bit of playing with it and MySQL Connector versions, I finally got it to accept my connection string setting up a simple repository.
So I created a simple class, and went to town adding some data to the class then creating a repo, and trying to save the record.
All I can seem to get out of it is null exception errors when I call:
repo.Add(user);
No idea what's null though, and the error isn't very clear.
At one point, I changed the type of my ID field in my User class to a long and got another error out of SubSonic (saying it couldn't tell what field was my ID field, telling me to name it ID or put a tag on it, but it was already named ID)
I've put data in every field in the class, even those that are not required per the database, but nothing.
I spent the rest of the evening googling for information on my error, but no luck, and the documentation on the site didn't get me anywhere either.
Any idea what I'm doing wrong, or how I could possibly diagnose this?
Thanks in advance for any help...
Here's the exception details
System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=MySql.Data
StackTrace:
at MySql.Data.MySqlClient.MySqlConnection.get_ServerThread()
at MySql.Data.MySqlClient.MySqlConnection.Abort()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at SubSonic.DataProviders.DbDataProvider.ExecuteReader(QueryCommand qry)
at SubSonic.Query.Insert.ExecuteReader()
at SubSonic.Repository.SimpleRepository.Add[T](T item)
at gc_ss.Program.Main(String[] args) in C:\Users\Michaelm\Desktop\Subsonic_Demo\gc_ss\gc_ss\Program.cs:line 27
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Another Update
I'm noticing that if I change the class (User) and modify one of the properties, that the property changes get reflected in the database. Also if I drop the table, it gets constructed based on my Class. So the migrations part is working, it's something happening after that.
Final Update
Okay, I deleted the table, and changed the class to use a long as the ID field. Set to RunMigrations, and ran again, and it failed because of no default value for ID. I set the column in MySQL to AutoIncrement and all is working fine now. Not sure how it's different than setting it to long yesterday (unless changes weren't getting applied like I thought they were).
Anyway, so I guess this question is closed...
This is a issue with the mysql.data provider. Normally the connector would throw a meaningful exception but has an internal nullreference exception itself before that happens.
Look at my answer here: Subsonic 3.0.0.4 ActiveRecord Template for MySQL error on inserting new record
That explains how to work around that.

Resources