Saving collection using PhoneApplicationService.Current.State - c#

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).

Related

uwp mostrecentlyusedlist addition causes COM type exception

StackTrace
" at Windows.Storage.AccessCache.StorageItemMostRecentlyUsedList.Add(IStorageItem file, String metadata, RecentStorageItemVisibility visibility)\r\n at FluentVideoPlayer.Helpers.FileHelper.<>c__DisplayClass7_0.b__0()\r\n at Microsoft.Toolkit.Uwp.Helpers.DispatcherHelper.<>c__DisplayClass10_0`1.b__0()"
I am trying to add a StorageFile to MostRecentlyUsedList and as a result I am getting this exception.
Exception
HRESULT E_FAIL has been returned from a call to a COM component
Code
internal async static Task AddToHistory(StorageFile fileToBeAdded) => await DispatcherHelper.ExecuteOnUIThreadAsync(() => StorageApplicationPermissions.MostRecentlyUsedList.Add(fileToBeAdded, "", RecentStorageItemVisibility.AppAndSystem));
I have this static method to use within a static class so I can call it from any page in the app. I can verify that StorageFile object is not null and perfect I also tried to solve it by using DispatcherHelper as you can see in the code, but with or without it, exception occurs in both cases.
Update
I have tried to add to FutureAccessList as well instead of MostRecentlyUsedList and I am getting same error in both cases
Update 2
accessing the list normally doesn't cause any error, like I can access it with following code
var mlist = StorageApplicationPermissions.MostRecentlyUsedList;
var entries = mlist.Entries;
error only occurs when I try to add a storagefile to it.
The problem was in partial StorageFiles I was actually querying the files from KnownFolders.VideoLibrary as per following blog post.
https://blogs.msdn.microsoft.com/adamdwilson/2017/12/20/fast-file-enumeration-with-partially-initialized-storagefiles/
so when we use following indexing option it actually initializes partial storage files for us which causes exception when we try to add it to most recently used list or futureacceslist
IndexerOption = IndexerOption.OnlyUseIndexerAndOptimizeForIndexedProperties
So to solve this I am now using IndexerOption.UseIndexerWhenAvailable now I don't get any exception, but ofcourse I am sacrificing the speed I was getting before with partial storage files. Which is disappointing as when trying to do a job with full storagefile, it should automatically initialize the partial storagefile to full storagefile as per the blog post. but that is not the case here unfortunately.

Getting MissingMethodException when using Manatee.trello to get list of users

I have the following code which is intended to fetch a list of all the user of an organisation.
public static IEnumerable<Member> ListTrelloUsers()
{
var serializer = new ManateeSerializer();
TrelloConfiguration.Serializer = serializer;
TrelloConfiguration.Deserializer = serializer;
TrelloConfiguration.JsonFactory = new ManateeFactory();
TrelloConfiguration.RestClientProvider = new RestSharpClientProvider();
TrelloAuthorization.Default.AppKey = ApplicationKey;
TrelloAuthorization.Default.UserToken = GrandToken;
var myOrganization = Member.Me.Organizations.FirstOrDefault().Id; //Exception thrown here.
var orgToAddTo = new Organization(myOrganization);
return orgToAddTo.Members.AsEnumerable();
}
But I'm getting a
System.MissingMethodException
thrown on
RestSharp.IRestRequest RestSharp.RestRequest.AddFile(System.String, Byte[], System.String)
So why is this exception thrown and what should the correctly working code look like?
Clarifications
I will also accept working C#/ASP.Net MVC code that isn't based on Manatee.Trello as an answer. (Including pure API-calls.)
I have tried using the Organisation ID directly as
var orgToAddTo = new Organization(OrganisationId);
but that just caused the same exception to be thrown later when I make a call to the method's returned object (e.g. using Count()).
UPDATE: I tried setting the build to Release instead of Debug and now the (same) exception is instead thrown at
TrelloConfiguration.RestClientProvider = new RestSharpClientProvider();
This is an issue with RestSharp that I reported quite some time ago, though they deny that it's a problem. If you're using .Net 4.5+, you can try the Manatee.Trello.WebApi package instead of Manatee.Trello.RestSharp.
TrelloConfiguration.RestProvider = new WebApiClientProvider();
Here's my Trello card for tracking the issue. This and this are the RestSharp issues I created.
I have been able to recreate this as well, but have received no help from them to resolve it.
Apperently, the class with missing method is located in an assembly, which differ from the one, which you used while compiling the project. Double check and make sure both at compiling and at execution you use the same assembly with the aforementioned class.
That is my best clue based on the info you've provided.
basically, check project references and make sure, you use correct ones for the class-holding assembly.

Stanford POS tagger error when trying to read the tagger file from URL

I am using POS tagger for a project and it works successfully when it reads the tagger file from my computer (project's folder).
But I need to upload the tagger file first and read the tagger file from a URL.
To do so, I have uploaded the POS tagger file and I am trying to read the tagger file by giving the URL to the constructor of the MaxentTagger method: (my code is in C# and I have overridden the MaxentTagger class so it's constructor looks like this:
public Tagger ()
{
java.io.ByteArrayInputStream inputStream = new java.io.ByteArrayInputStream(System.IO.File.ReadAllBytes(#"C:\models\english-left3words-distsim.tagger"));
base.readModelAndInit(null, new java.io.DataInputStream(inputStream), false);
}
However I get this error when I run my code:
"An unhandled exception of type 'java.lang.RuntimeException' occurred in stanford-postagger.dll
Additional information: java.io.FileNotFoundException: Could not find a part of the path 'C:\u\nlp\data\pos_tags_are_useless\egw4-reut.512.clusters'."
Does anybody know why this happens and how I can resolve this? I appreciate any sort of help very much!
This error comes from the program trying to load a file which gives the distributional similarity mapping from words to clusters. It's trying to get it from the location that is specified in the training properties file (and you naturally don't have a file at that location). This happened because you don't have a properly initialized TaggerConfig object at the time readModelAndInit() is called. The way it gets initialized is unintuitive (was badly architected), but you're only encountering this because you're trying to use a non-public API.
Why can't you just use the public API as follows?
MaxentTagger base = new MaxentTagger("http://my.url.com/models/english-left3words-distsim.tagger");

Large post model delays controller's action call

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!

Windows Service Webbrowser object invalid cast exception error

I'm having a bit of trouble with a Windows Service webbrowser object. It's attempting to load in values of username and password to a site but keeps failing and throwing the following error:
System.InvalidCastException: Specified cast is not valid.
at System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument2.GetLocation()
at System.Windows.Forms.WebBrowser.get_Document()
at MyWindowsService.MyDataProcessor.login()
The code that I'm using to make this call is:
MyWebBrowser.Document.All["Login"].SetAttribute("Value", username);
MyWebBrowser.Document.All["Password"].SetAttribute("Value", password);
MyWebBrowser.Document.All["submit"].InvokeMember("Click");
Any ideas as to why it keeps failing? Thanks in advance for the help.
I'm not sure if this solves the problem, but you can check InvokeRequired property on the current object, or WebBrowser.InvokeRequired, and use something like MethodInvoker to call your function or a helper function to access WebBrowser.Document.
http://www.megasolutions.net/cSharp/(WebBrowser_Document-==-null)-throws-InvalidCastException-43126.aspx
I had a similar problem using SHDocVW.WebBrowserClass. I got an InvalidCastException when I tried to access Document.all from an instance of SHDocVW.WebBrowserClass (from the main thread) and I was able to fix it by casting to IHTMLDocument2 instead of HTMLDocument. This took me a long time to figure out because casting to HTMLDocument works most of the time.
SHDocVW.WebBrowserClass Explorer = [instance of IE];
((IHTMLDocument2)Explorer.Document).all // works all the time
((HTMLDocument)Explorer.Document).all // works some times
I hope this helps someone.

Categories

Resources