Large post model delays controller's action call - c#

I built a page that allows the user to edit all the information presented in a contract.
I separated all main parts of the contract in different forms (in the same page). This makes it possible to submit/save a section only, but also to save the whole contract. When I want to save all forms at once, I serialize the data and I post it to the controller using ajax.
var data = $("#ContractHeader").serialize();
data += $("ContractMandatoryItems").serialize();
...
I have an action (form receiver) for every part of the contract and those actions get called miliseconds after clicking "Save this section". However, when I save the whole contract it takes forever before my controller's action is called (5-10 seconds). This delays happens between the ajax "post" call in my browser and the breakpoint on the 1st line of my save action. As you may ask, here is the signature one action that is responsable of saving a section:
public ActionResult SaveConcreteItems(IList<PreparedConcreteContractItem> ConcreteItems, int ConcreteContractId)
Now, here is the signature of the "full save" action :
public ActionResult SaveContract(
PreparedConcreteContract contractHeader,
IList<PreparedConcreteContractItem> ConcreteItems,
IList<PreparedConcreteContractItem> ExtraItems,
IList<PreparedConcreteContractItem> AdjuvantItems,
IList<PreparedConcreteContractItem> OptionalItems,
IList<PreparedConcreteContractItem> ServiceItems,
IList<PreparedConcreteContractItem> NoteItems,
IList<PreparedConcreteContractNote> ContractNotes,
string SelectedAdditionalLocations)
I tried modifying this "SaveContract" action so it takes only 1 of it's actual parameter and every time the action is called in no time.
As soon as it has more than 1 parameter it takes a while to load (even if the added parameter contains nearly no information).
I also tested if the volume of data had an influence. It does not. I can save the "madatoryItems" section in no time even if has 50 items in it, while a small complete contract (about the same amount of data) will take about 10 seconds to hit the server.
All this happens in development. It's not a "database performance" or save logic issue. The whole delay happens before the action is called. It seems to be the parameters binding that is slow but I have no idea why.
I don't know if it might have an impact on your answer but I noticed a lot of "first time exception" when I have more than 1 section to save. Snipped below shows a few lines but there were 150+.
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll
A first chance exception of type 'System.FormatException' occurred in System.dll
A first chance exception of type 'System.InvalidOperationException' occurred in System.Web.Mvc.dll
Thanks in advance!
I've been asked to add post data for a given full save... I updated my question tu use the real save methods (instead of a simpler one I used to simplify my post). Here is the real data posted (as shown in chrome). Notice that this contract only had ConcreteItems).
StatusId_VI:N
StatusId:Soumission
StatusId_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
StatusId$DDD$L:N
CustomerId:1111
ProjectName:Name of my project
ShipToAddress1:AddressA
ShipToAddress2:AddressB
ShipToCity_VI:Vancouver
ShipToCity:Vancouver
ShipToCity_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
ShipToCity_DDD_LDeletedItems:
ShipToCity_DDD_LInsertedItems:
ShipToCity_DDD_LCustomCallback:
ShipToCity$DDD$L:Vancouver
ShipToState_VI:BC
ShipToState:British Columbia
ShipToState_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
ShipToState_DDD_LDeletedItems:
ShipToState_DDD_LInsertedItems:
ShipToState_DDD_LCustomCallback:
ShipToState$DDD$L:BC
ShipToZip:A2A 2A2
ProductionLocationNumber_VI:093
ProductionLocationNumber:ThisValueIsRemovedForS/OPost
ProductionLocationNumber_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
ProductionLocationNumber_DDD_LDeletedItems:
ProductionLocationNumber_DDD_LInsertedItems:
ProductionLocationNumber_DDD_LCustomCallback:
ProductionLocationNumber$DDD$L:093
DeliveryZone_VI:1
DeliveryZone:1 (0.00$)
DeliveryZone_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
DeliveryZone$DDD$L:1
SelectedAdditionalLocations:
LocationClosedFrom_Raw:N
LocationClosedFrom:
LocationClosedFrom_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
LocationClosedFrom_DDD_C_FNPWS:0:0:-1:-10000:-10000:0:0px:-10000:1:0:0:0
LocationClosedFrom$DDD$C:11/06/2013
LocationClosedTo_Raw:N
LocationClosedTo:
LocationClosedTo_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
LocationClosedTo_DDD_C_FNPWS:0:0:-1:-10000:-10000:0:0px:-10000:1:0:0:0
LocationClosedTo$DDD$C:11/06/2013
ShipToCellphone:
ContractId:9801
ContractNumber:9801
RiscContractNumber:
PurchaseOrderNumber:
StartDate_Raw:1356998400000
StartDate:2013-01-01
StartDate_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
StartDate_DDD_C_FNPWS:0:0:-1:-10000:-10000:0:0px:-10000:1:0:0:0
StartDate$DDD$C:01/01/2013:01/01/2013
EndDate_Raw:1356998400000
EndDate:2013-01-01
EndDate_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
EndDate_DDD_C_FNPWS:0:0:-1:-10000:-10000:0:0px:-10000:1:0:0:0
EndDate$DDD$C:01/01/2013:01/01/2013
IsGeneral:U
LanguageId_VI:FR
LanguageId:Français
LanguageId_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
LanguageId$DDD$L:FR
AttentionOf:
SalespersonNumber_VI:
SalespersonNumber:
SalespersonNumber_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
SalespersonNumber_DDD_LDeletedItems:
SalespersonNumber_DDD_LInsertedItems:
SalespersonNumber_DDD_LCustomCallback:
SalespersonNumber$DDD$L:
CreatedBy:
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22
DXMVCEditorsValues:{"StatusId_DDD_L":["N"],"StatusId":"N","ProjectName":"Name of my project","ShipToAddress1":"AddressA","ShipToAddress2":"AddressB","ShipToCity_DDD_L":["Vancouver"],"ShipToCity":"Vancouver","ShipToState_DDD_L":["BC"],"ShipToState":"BC","ShipToZip":"A2A 2A2","ProductionLocationNumber_DDD_L":["093"],"ProductionLocationNumber":"093","DeliveryZone_DDD_L":["1"],"DeliveryZone":"1","LocationClosedFrom_DDD_C":null,"LocationClosedFrom":null,"LocationClosedTo_DDD_C":null,"LocationClosedTo":null,"ShipToCellphone":null,"ContractNumber":"9801","RiscContractNumber":null,"PurchaseOrderNumber":null,"StartDate_DDD_C":new Date(2013,0,1),"StartDate":new Date(2013,0,1),"EndDate_DDD_C":new Date(2013,0,1),"EndDate":new Date(2013,0,1),"IsGeneral":false,"LanguageId_DDD_L":["FR"],"LanguageId":"FR","AttentionOf":null,"SalespersonNumber_DDD_L":[],"SalespersonNumber":null,"CreatedBy":null}ConcreteContractId
ConcreteProductTypeGroup:Concrete
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22ExtraContractId
ExtraProductTypeGroup:Extra
ExtraItems[0].ItemId:243123
ExtraItems[0].IncludeInContract:U
ExtraItems[0].IncludeInPrice:U
ExtraItems[0].NoCharge:U
ExtraItems[0].PriceNotAvailable:U
ExtraItems[0].UnitPrice:0.00
ExtraItems[0].UnitDiscount:0.00
ExtraItems[0].DiscountPercentage:0.00
ExtraItems[1].ItemId:243124
ExtraItems[1].IncludeInContract:U
ExtraItems[1].IncludeInPrice:U
ExtraItems[1].NoCharge:U
ExtraItems[1].PriceNotAvailable:U
ExtraItems[1].UnitPrice:0.00
ExtraItems[1].UnitDiscount:0.00
ExtraItems[1].DiscountPercentage:0.00
ExtraItems[2].ItemId:243125
ExtraItems[2].IncludeInContract:U
ExtraItems[2].IncludeInPrice:U
ExtraItems[2].NoCharge:U
ExtraItems[2].PriceNotAvailable:U
ExtraItems[2].UnitPrice:8.00
ExtraItems[2].UnitDiscount:0.00
ExtraItems[2].DiscountPercentage:0.00
ExtraItems[3].ItemId:243126
ExtraItems[3].IncludeInContract:U
ExtraItems[3].IncludeInPrice:U
ExtraItems[3].NoCharge:U
ExtraItems[3].PriceNotAvailable:U
ExtraItems[3].UnitPrice:45.00
ExtraItems[3].UnitDiscount:0.00
ExtraItems[3].DiscountPercentage:0.00
ExtraItems[4].ItemId:243127
ExtraItems[4].IncludeInContract:U
ExtraItems[4].IncludeInPrice:U
ExtraItems[4].NoCharge:U
ExtraItems[4].PriceNotAvailable:U
ExtraItems[4].UnitPrice:0.00
ExtraItems[4].UnitDiscount:0.00
ExtraItems[4].DiscountPercentage:0.00
ExtraItems[5].ItemId:243128
ExtraItems[5].IncludeInContract:U
ExtraItems[5].IncludeInPrice:U
ExtraItems[5].NoCharge:U
ExtraItems[5].PriceNotAvailable:U
ExtraItems[5].UnitPrice:0.00
ExtraItems[5].UnitDiscount:0.00
ExtraItems[5].DiscountPercentage:0.00
ExtraItems[6].ItemId:243129
ExtraItems[6].IncludeInContract:U
ExtraItems[6].IncludeInPrice:U
ExtraItems[6].NoCharge:U
ExtraItems[6].PriceNotAvailable:U
ExtraItems[6].UnitPrice:12.00
ExtraItems[6].UnitDiscount:0.00
ExtraItems[6].DiscountPercentage:0.00
ExtraItems[7].ItemId:243130
ExtraItems[7].IncludeInContract:U
ExtraItems[7].IncludeInPrice:U
ExtraItems[7].NoCharge:U
ExtraItems[7].PriceNotAvailable:U
ExtraItems[7].UnitPrice:18.00
ExtraItems[7].UnitDiscount:0.00
ExtraItems[7].DiscountPercentage:0.00
ExtraItems[8].ItemId:243131
ExtraItems[8].IncludeInContract:U
ExtraItems[8].IncludeInPrice:U
ExtraItems[8].NoCharge:U
ExtraItems[8].PriceNotAvailable:U
ExtraItems[8].UnitPrice:7.00
ExtraItems[8].UnitDiscount:0.00
ExtraItems[8].DiscountPercentage:0.00
ExtraItems[9].ItemId:243132
ExtraItems[9].IncludeInContract:U
ExtraItems[9].IncludeInPrice:U
ExtraItems[9].NoCharge:U
ExtraItems[9].PriceNotAvailable:U
ExtraItems[9].UnitPrice:15.00
ExtraItems[9].UnitDiscount:0.00
ExtraItems[9].DiscountPercentage:0.00
ExtraItems[10].ItemId:243133
ExtraItems[10].IncludeInContract:U
ExtraItems[10].IncludeInPrice:U
ExtraItems[10].NoCharge:U
ExtraItems[10].PriceNotAvailable:U
ExtraItems[10].UnitPrice:0.00
ExtraItems[10].UnitDiscount:0.00
ExtraItems[10].DiscountPercentage:0.00
ExtraItems[11].ItemId:243134
ExtraItems[11].IncludeInContract:U
ExtraItems[11].IncludeInPrice:U
ExtraItems[11].NoCharge:U
ExtraItems[11].PriceNotAvailable:U
ExtraItems[11].UnitPrice:100.00
ExtraItems[11].UnitDiscount:0.00
ExtraItems[11].DiscountPercentage:0.00
ExtraItems[12].ItemId:243135
ExtraItems[12].IncludeInContract:U
ExtraItems[12].IncludeInPrice:U
ExtraItems[12].NoCharge:U
ExtraItems[12].PriceNotAvailable:U
ExtraItems[12].UnitPrice:12.00
ExtraItems[12].UnitDiscount:0.00
ExtraItems[12].DiscountPercentage:0.00
ExtraItems[13].ItemId:243136
ExtraItems[13].IncludeInContract:U
ExtraItems[13].IncludeInPrice:U
ExtraItems[13].NoCharge:U
ExtraItems[13].PriceNotAvailable:U
ExtraItems[13].UnitPrice:0.00
ExtraItems[13].UnitDiscount:0.00
ExtraItems[13].DiscountPercentage:0.00
ExtraItems[14].ItemId:243137
ExtraItems[14].IncludeInContract:U
ExtraItems[14].IncludeInPrice:U
ExtraItems[14].NoCharge:U
ExtraItems[14].PriceNotAvailable:U
ExtraItems[14].UnitPrice:10.00
ExtraItems[14].UnitDiscount:0.00
ExtraItems[14].DiscountPercentage:0.00
ExtraItems[15].ItemId:243138
ExtraItems[15].IncludeInContract:U
ExtraItems[15].IncludeInPrice:U
ExtraItems[15].NoCharge:U
ExtraItems[15].PriceNotAvailable:U
ExtraItems[15].UnitPrice:0.00
ExtraItems[15].UnitDiscount:0.00
ExtraItems[15].DiscountPercentage:0.00
ExtraItems[16].ItemId:243139
ExtraItems[16].IncludeInContract:U
ExtraItems[16].IncludeInPrice:U
ExtraItems[16].NoCharge:U
ExtraItems[16].PriceNotAvailable:U
ExtraItems[16].UnitPrice:1.00
ExtraItems[16].UnitDiscount:0.00
ExtraItems[16].DiscountPercentage:0.00
ExtraItems[17].ItemId:243140
ExtraItems[17].IncludeInContract:U
ExtraItems[17].IncludeInPrice:U
ExtraItems[17].NoCharge:U
ExtraItems[17].PriceNotAvailable:U
ExtraItems[17].UnitPrice:2.00
ExtraItems[17].UnitDiscount:0.00
ExtraItems[17].DiscountPercentage:0.00
ExtraItems[18].ItemId:243141
ExtraItems[18].IncludeInContract:U
ExtraItems[18].IncludeInPrice:U
ExtraItems[18].NoCharge:U
ExtraItems[18].PriceNotAvailable:U
ExtraItems[18].UnitPrice:3.00
ExtraItems[18].UnitDiscount:0.00
ExtraItems[18].DiscountPercentage:0.00
ExtraItems[19].ItemId:243142
ExtraItems[19].IncludeInContract:U
ExtraItems[19].IncludeInPrice:U
ExtraItems[19].NoCharge:U
ExtraItems[19].PriceNotAvailable:U
ExtraItems[19].UnitPrice:35.00
ExtraItems[19].UnitDiscount:0.00
ExtraItems[19].DiscountPercentage:0.00
ExtraItems[20].ItemId:243143
ExtraItems[20].IncludeInContract:U
ExtraItems[20].IncludeInPrice:U
ExtraItems[20].NoCharge:U
ExtraItems[20].PriceNotAvailable:U
ExtraItems[20].UnitPrice:0.00
ExtraItems[20].UnitDiscount:0.00
ExtraItems[20].DiscountPercentage:0.00
ExtraItems[21].ItemId:243144
ExtraItems[21].IncludeInContract:U
ExtraItems[21].IncludeInPrice:U
ExtraItems[21].NoCharge:U
ExtraItems[21].PriceNotAvailable:U
ExtraItems[21].UnitPrice:0.00
ExtraItems[21].UnitDiscount:0.00
ExtraItems[21].DiscountPercentage:0.00
ExtraItems[22].ItemId:243145
ExtraItems[22].IncludeInContract:U
ExtraItems[22].IncludeInPrice:U
ExtraItems[22].NoCharge:U
ExtraItems[22].PriceNotAvailable:U
ExtraItems[22].UnitPrice:15.00
ExtraItems[22].UnitDiscount:0.00
ExtraItems[22].DiscountPercentage:0.00
ExtraItems[23].ItemId:243146
ExtraItems[23].IncludeInContract:U
ExtraItems[23].IncludeInPrice:U
ExtraItems[23].NoCharge:U
ExtraItems[23].PriceNotAvailable:U
ExtraItems[23].UnitPrice:0.00
ExtraItems[23].UnitDiscount:0.00
ExtraItems[23].DiscountPercentage:0.00
ExtraItems[24].ItemId:243147
ExtraItems[24].IncludeInContract:U
ExtraItems[24].IncludeInPrice:U
ExtraItems[24].NoCharge:U
ExtraItems[24].PriceNotAvailable:U
ExtraItems[24].UnitPrice:8.00
ExtraItems[24].UnitDiscount:0.00
ExtraItems[24].DiscountPercentage:0.00
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22
DXMVCEditorsValues:{"ExtraItems[0].IncludeInContract":false,"ExtraItems[0].IncludeInPrice":false,"ExtraItems[0].NoCharge":false,"ExtraItems[0].PriceNotAvailable":false,"ExtraItems[1].IncludeInContract":false,"ExtraItems[1].IncludeInPrice":false,"ExtraItems[1].NoCharge":false,"ExtraItems[1].PriceNotAvailable":false,"ExtraItems[2].IncludeInContract":false,"ExtraItems[2].IncludeInPrice":false,"ExtraItems[2].NoCharge":false,"ExtraItems[2].PriceNotAvailable":false,"ExtraItems[3].IncludeInContract":false,"ExtraItems[3].IncludeInPrice":false,"ExtraItems[3].NoCharge":false,"ExtraItems[3].PriceNotAvailable":false,"ExtraItems[4].IncludeInContract":false,"ExtraItems[4].IncludeInPrice":false,"ExtraItems[4].NoCharge":false,"ExtraItems[4].PriceNotAvailable":false,"ExtraItems[5].IncludeInContract":false,"ExtraItems[5].IncludeInPrice":false,"ExtraItems[5].NoCharge":false,"ExtraItems[5].PriceNotAvailable":false,"ExtraItems[6].IncludeInContract":false,"ExtraItems[6].IncludeInPrice":false,"ExtraItems[6].NoCharge":false,"ExtraItems[6].PriceNotAvailable":false,"ExtraItems[7].IncludeInContract":false,"ExtraItems[7].IncludeInPrice":false,"ExtraItems[7].NoCharge":false,"ExtraItems[7].PriceNotAvailable":false,"ExtraItems[8].IncludeInContract":false,"ExtraItems[8].IncludeInPrice":false,"ExtraItems[8].NoCharge":false,"ExtraItems[8].PriceNotAvailable":false,"ExtraItems[9].IncludeInContract":false,"ExtraItems[9].IncludeInPrice":false,"ExtraItems[9].NoCharge":false,"ExtraItems[9].PriceNotAvailable":false,"ExtraItems[10].IncludeInContract":false,"ExtraItems[10].IncludeInPrice":false,"ExtraItems[10].NoCharge":false,"ExtraItems[10].PriceNotAvailable":false,"ExtraItems[11].IncludeInContract":false,"ExtraItems[11].IncludeInPrice":false,"ExtraItems[11].NoCharge":false,"ExtraItems[11].PriceNotAvailable":false,"ExtraItems[12].IncludeInContract":false,"ExtraItems[12].IncludeInPrice":false,"ExtraItems[12].NoCharge":false,"ExtraItems[12].PriceNotAvailable":false,"ExtraItems[13].IncludeInContract":false,"ExtraItems[13].IncludeInPrice":false,"ExtraItems[13].NoCharge":false,"ExtraItems[13].PriceNotAvailable":false,"ExtraItems[14].IncludeInContract":false,"ExtraItems[14].IncludeInPrice":false,"ExtraItems[14].NoCharge":false,"ExtraItems[14].PriceNotAvailable":false,"ExtraItems[15].IncludeInContract":false,"ExtraItems[15].IncludeInPrice":false,"ExtraItems[15].NoCharge":false,"ExtraItems[15].PriceNotAvailable":false,"ExtraItems[16].IncludeInContract":false,"ExtraItems[16].IncludeInPrice":false,"ExtraItems[16].NoCharge":false,"ExtraItems[16].PriceNotAvailable":false,"ExtraItems[17].IncludeInContract":false,"ExtraItems[17].IncludeInPrice":false,"ExtraItems[17].NoCharge":false,"ExtraItems[17].PriceNotAvailable":false,"ExtraItems[18].IncludeInContract":false,"ExtraItems[18].IncludeInPrice":false,"ExtraItems[18].NoCharge":false,"ExtraItems[18].PriceNotAvailable":false,"ExtraItems[19].IncludeInContract":false,"ExtraItems[19].IncludeInPrice":false,"ExtraItems[19].NoCharge":false,"ExtraItems[19].PriceNotAvailable":false,"ExtraItems[20].IncludeInContract":false,"ExtraItems[20].IncludeInPrice":false,"ExtraItems[20].NoCharge":false,"ExtraItems[20].PriceNotAvailable":false,"ExtraItems[21].IncludeInContract":false,"ExtraItems[21].IncludeInPrice":false,"ExtraItems[21].NoCharge":false,"ExtraItems[21].PriceNotAvailable":false,"ExtraItems[22].IncludeInContract":false,"ExtraItems[22].IncludeInPrice":false,"ExtraItems[22].NoCharge":false,"ExtraItems[22].PriceNotAvailable":false,"ExtraItems[23].IncludeInContract":false,"ExtraItems[23].IncludeInPrice":false,"ExtraItems[23].NoCharge":false,"ExtraItems[23].PriceNotAvailable":false,"ExtraItems[24].IncludeInContract":false,"ExtraItems[24].IncludeInPrice":false,"ExtraItems[24].NoCharge":false,"ExtraItems[24].PriceNotAvailable":false}AdjuvantContractId
AdjuvantProductTypeGroup:Adjuvant
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22OptionalContractId
OptionalProductTypeGroup:Optional
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22ServiceContractId
ServiceProductTypeGroup:Service
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22contractNotes[0].NoteId
contractNotes[0].ItemId:9801
contractNotes[0].Value:
contractNotes[1].NoteId:0
contractNotes[1].ItemId:9801
contractNotes[1].Value:
contractNotes[2].NoteId:0
contractNotes[2].ItemId:9801
contractNotes[2].Value:
contractNotes[3].NoteId:0
contractNotes[3].ItemId:9801
contractNotes[3].Value:
contractNotes[4].NoteId:0
contractNotes[4].ItemId:9801
contractNotes[4].Value:
contractNotes[5].NoteId:0
contractNotes[5].ItemId:9801
contractNotes[5].Value:
contractNotes[6].NoteId:0
contractNotes[6].ItemId:9801
contractNotes[6].Value:
contractNotes[7].NoteId:0
contractNotes[7].ItemId:9801
contractNotes[7].Value:
contractNotes[8].NoteId:0
contractNotes[8].ItemId:9801
contractNotes[8].Value:
contractNotes[9].NoteId:0
contractNotes[9].ItemId:9801
contractNotes[9].Value:
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22
Edit #2
I finally found the problem.
In one word, using classic checkboxes instead of DevExpress' checkboxes solved the issue.
I still don't know why, but it seems that DevExpress' binder had some trouble with the following conditions were met:
Multiple objects are sent to the action (multiple action parameters)
One of the parameter is an array (IList) containing values from a DevExpress control (checkbox in my case)
As soon as I had more than one parameter to my form reciever action "first chance exception" were generated in the output console. Strangely, when only 1 parameter was posted (single section save) no exception was shown.
Now that I use classic checkboxes everything works fine and it's fast as lightning!

Related

Message read by OnEntryWritten are coming with parameters not set

I'm using the OnEntryWritten event in order to get events from the event log when they are fired.
The problem I started to see today is that some messages come with parameters unset.
For example:
The Windows Filtering Platform has permitted a bind to a local port. Application Information: Process ID:9852 Application Name:\device\harddiskvolume7\program files (x86)\google\chrome\application\chrome.exe Network Information: Source Address::: Source Port:51714 Protocol:17 Filter Information: Filter Run-Time ID:0 Layer Name:%%14608 Layer Run-Time ID:38
You can see the %%14608 parameter. This comes with a value if I see the same log in the Event Viewer.
I'm running a windows service as LocalSystem, so I don't know if this is a permission issue or this technology is not useful at all.
I have tried the rest offered on C# and they also don't meet my requirements.
UPDATE: this is the code I'm using to read the events.
1) First I subscribe to the corresponding Event log:
private void Subscribe()
{
_eventLog.EnableRaisingEvents = true;
var callbackFunction = new EntryWrittenEventHandler(OnEntryWritten);
_eventLog.EntryWritten += callbackFunction;
// Save a reference for callbackFunction
_eventHandler = callbackFunction;
}
2) Then on the callback method, I read data from the message:
public void OnEntryWritten(Object source, EntryWrittenEventArgs entryArgs)
{
// When overwrite policy is enabled, this will trigger for all elements when it starts writing new ones
try
{
var entry = entryArgs.Entry;
var timeWritten = entry.TimeWritten;
// This comes with %% values depending on the log
string message = entry.Message;
}
catch(Exception ex)
{
...
}
}
3) The event log variable is simply initialized as:
var eventLog = EventLog.GetEventLogs().FirstOrDefault(el => el.Log.Equals(logName, StringComparison.OrdinalIgnoreCase));
I need some help on this, honestly I don't know what else to try.
UPDATE
I'm adding some images here so everybody can understand the situation a little bit better. To be honest, it looks like there's no solution but to implement a dictionary and replace manually the required values, which appear to be always constants.
This is what I see on the Event Viewer for a given Event ID:
This is what I see on my program when I read that entry:
You can clearly see that the following values:
"Machine key." (Key type)
"Read persisted key from file." (Operation)
Are coming unmapped in the ReplacementStrings and the Message properties as: %%2499 and %%2458
This is the message value I get on the program:
"Key file operation.\r\n\r\nSubject:\r\n\tSecurity ID:\t\tS-1-5-18\r\n\tAccount Name:\t\tMyAccount$\r\n\tAccount Domain:\t\tWORKGROUP\r\n\tLogon ID:\t\t0x3e7\r\n\r\nProcess Information:\r\n\tProcess ID:\t\t6644\r\n\tProcess Creation Time:\t2019-04-03T12:17:24.587994400Z\r\n\r\nCryptographic Parameters:\r\n\tProvider Name:\tMicrosoft Software Key Storage Provider\r\n\tAlgorithm Name:\tUNKNOWN\r\n\tKey Name:\t816339d2-c476-4f1e-bc40-954f0aa0f851\r\n\tKey Type:\t%%2499\r\n\r\nKey File Operation Information:\r\n\tFile Path:\tC:\ProgramData\Microsoft\Crypto\Keys\6d55a45fd69327293e9ed3e7930f4565_5663a8bb-2d1d-4c0d-90c1-624beddabe9c\r\n\tOperation:\t%%2458\r\n\tReturn Code:\t0x0"
What can be done here? There also nothing in entry.Data that might help me out to obtain both values.
No, I believe you're mistaken, sorry that this answer is too late. I found a similar event that was raised by chrome and evaluated if there's anything missed by the event handler. There wasn't anything missed. The message I got in my console output exactly matched what I saw in my Event Viewer.
A better solution would be to
Use entry.Data to get the complete data instead of entry.Message
entry.Data will return a byte[] which you can convert to a string. Here's the link to all properties that an entry will have.

Way to interrupt method to get additional input from user?

I'm working in ASP.net Core and have a situation where I'm importing a large list of swimming results from a previous meet. The list contains swimmer name and location so I'm doing a lookup to find that swimmerID in the database which I have previously imported. HOWEVER, I've found that many of the previous sheets have names misspelled or names that were not included in my original import.
I'm looking for a way to change the below code:
//Get SwimmerId and check for an existing entry in the db
var swimmerId = await _swimmerRepo.GetSwimmerByNameAndLocation(lookupObj.FirstName,
lookupObj.LastName,
lookupObj.LocationCode);
if (swimmerId == 0) throw new Exception($"Swimmer {lookupObj.LocationCode}: {lookupObj.FirstName} {lookupObj.LastName} not found.");
What I really want to do here instead of throwing an exception is to popup a modal or whatever to the user that allows them to choose from a swimmer that has a similar name/location (possible spelling error) or enter a new swimmer and then push that selected/new swimmerId back and continue processing the import.
I have no idea how I can do that. Any direction is appreciated.
A few notes:
Again, asp.net core with EFCore.
SQL server database
Import is currently in a controller
Import is from a csv file

Getting the calling function in a custom ExcelDNA exception handler without MacroType

I'm aware that there is the method shown in the ErrorHAndler.dna example:
private object ErrorHandler(object exceptionObject)
{
ExcelReference caller = (ExcelReference)XlCall.Excel(XlCall.xlfCaller);
// Calling reftext here requires all functions to be marked IsMacroType=true, which is undesirable.
// A better plan would be to build the reference text oneself, using the RowFirst / ColumnFirst info
// Not sure where to find the SheetName then....
string callingName = (string)XlCall.Excel(XlCall.xlfReftext, caller, true);
[...]
}
But has anyone determined how the issue described in the comment might be resolved? I.e. is there a way to do this without setting IsMacroType=true?
You don't need IsMacroType=true to get the caller (the first line in your sample works fine without it). As the comment in your sample indicates, if you want to build a text description for the range, you need to build it yourself from the Row/Column info in the ExcelReference. You can get the sheet name with a call to XlCall.Excel(XlCall.xlSheetNm, caller).

Active Directory custom attribute can not be seen by it's owner on some computers

A added a custom attribute to the Active Directory Schema. On one machine when I try to query the attribute I get errors back from my code.
Here is the C# version to test this out.
static class Program
{
static void Main()
{
Console.ReadLine();
DirectoryEntry directoryEntry = (DirectoryEntry)UserPrincipal.Current.GetUnderlyingObject();
//Execption on this line
var allowedDatabases = directoryEntry.Properties["vwDBAccess"];
foreach (var record in allowedDatabases.OfType<String>())
{
Console.WriteLine(record);
}
Console.ReadLine();
}
}
System.Runtime.InteropServices.COMException was unhandled
Message=Unknown error (0x8000500c)
Source=System.DirectoryServices
ErrorCode=-2147463156
StackTrace:
at System.DirectoryServices.PropertyValueCollection.PopulateList()
at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName)
at System.DirectoryServices.PropertyCollection.get_Item(String propertyName)
at Sandbox_Console.Program.Main() in C:\Users\srchamberlain.VW\documents\visual studio 2010\Projects\Sandbox Console\Sandbox Console\Program.cs:line 16
InnerException:
The Error Code 0x8000500c represents E_ADS_CANT_CONVERT_DATATYPE. This only happens on one machine. I have 3 other computers (all part of the same domain as the first computer) and those behave correctly when running the exact same code for the exact same user and give the the content of the attribute. Also if I run as a different user, on the same box, but query the bad user's attributes I can pull up the information correctly when connecting as another user.
I have tried refreshing the schema on the box using the technique from this KB article but the issue is still happening.
What is going wrong on this one computer?
Clarification:
vwDBAccess is a multivalued string, so when it works directoryEntry.Properties["vwDBAccess"] return a string with there is one item, sting[] when there is more than one, and null when there are no items. This account has 3 items set. When I run as a different user and query the bad user I correctly get string[3] returned.
Typically if something is only happening on one machine in a network then it boils down to service pack and update levels of the OS or interaction with other software on the system (A/V is the worst offender).
The first thing I would do is look at the SP and updates applied to the working machines, then compare that to the non-working one. You should see one of two situations:
If the working machines are more up to date, then apply whatever updates are necessary to the non-working machine.
If the working machines are less up to date, then update one and see if it starts failing. If that's the case, you might need to contact MS.
My gut says that the non-working machine is simply out of date.

Saving collection using PhoneApplicationService.Current.State

I'm trying to save a collection where a store a diagnostic log temporarily when navigating away from my app - I've looked at other sample code and it seems pretty basic as I've done below:
Saving:
PhoneApplicationService.Current.State["DiagnosticLog"] = DiagnosticLog;
Loading:
if (PhoneApplicationService.Current.State.ContainsKey("DiagnosticLog"))
DiagnosticLog = (ObservableCollection<DiagnosticLogEntry>)
PhoneApplicationService.Current.State["DiagnosticLog"];
However I get this error:
A first chance exception of type
'System.Runtime.Serialization.InvalidDataContractException' occurred
in System.Runtime.Serialization.dll
Any suggestions please?
Usually, when this happens, it means you do not have a default public constructor on your Diagnostic class (or one of it's contained classes).

Categories

Resources