How to get random strings from JSON Object? For example when first time program is run on when I click on button a1 button1.Text should be "SUVO",when click on button b3 button8.Text should be "TRIJUMFALNA KAPIJA" and so on...
When clicked button that is called "new game" buttons should have this text: And now when clicked on button a1 button1.Text now should be "hudini",when click on button b3 button8.Text should now be "zid" and so on...
Check out his other questions and you'll find he doesn't know, and doesn't appear to be trying to learn anything. At a guess, he has conned his way into a job he has no idea how to do, and is trying to use Google and us to keep him getting paid.
A help vampire, in fact.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
Since Task.Exception is an AggregateException you've gotta worry about multiple inner exceptions in addition to the current exception the AggregateException represents unless you know precisely how many exceptions can be thrown. My ideas:
Log current exception, flatten (in the case of nested AggregateExceptions), and re-throw:
_hubProxy.Invoke("SomeMethodName", model).ContinueWith((t) =>
if (t.Exception != null && t.Exception.InnerException != null)
//Log the current exceptionthrow t.Exception.Flatten();
Handle exceptions you know how to handle, re-throw the rest:
You can avoid Flatten() if you're absolutely sure there are no tasks inside your task. Also the reason I used Handle() is because it conveniently re-wraps all exceptions that did not return true (not handled) in an AggregateException and re-throws them. If you can handle everything or are sure of exactly what exceptions can be thrown you could iterate over the AggregateException.InnerExceptions collection instead and re-throw as you desire.
EDIT: Quick addendum: If you're using C#6 you can simply the if-statement to:
".45 ACP - because shooting twice is just silly" - JSOP, 2010 - You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 - When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
I am trying to keep thread/process active, when application is minimized to tray. As i want some tasks to be performed in background in app state = minimize.
As I have defined a asyncdelegate to capture a callback for an event, when the app is minimized the process is completed and the app is supposed to listen forevent fire, but when the app is minimized the app does not reports to the event, and the callback to the delegate doesn't occurs but the following event fire and all the respective tasks are performed when app is maximized.
Please guide and help me.
Hi! I have published a Microsoft Dynamics NAV page as an OData web service V4. I used Odata v4 Client Code Genrator ver 2.4.0 to create the Client side proxy classes for my C# project. When I make a simple call to "myhost/.../Company" everything works like a charm using simple code like this:
NAVCient = new NAVEntities.NAV(new Uri("myhost/.../ODataV4"));
NAVCient.Credentials = new Net.NetworkCredential("usr", "psw");
List<NAVEntities.Company> company = NAVCient.Company.ToList;
I get my list of available Companies. Now I want to get the CustomerCards for my selected Company. I do like this:
NAVCient = new NAVEntities.NAV(new Uri("myhost/.../ODataV4/Company('MyTest')"));
NAVCient.Credentials = new Net.NetworkCredential("usr", "psw");
List<NAVEntities.Customer_Card> Customers = NAVCient.Customer_Card.ToList;
The uri genrated is correct and I can see the response comming back correct using fiddler with all my data. Code gets an exception trying to parse the information. At first i thought the backend had some issues but clearly its the client producing this error bec in fiddler I can see my result and nothing else as a response from server :
"An unhandled exception of type 'Microsoft.OData.Core.ODataException' occurred in Microsoft.OData.Core.dll
Additional information: When writing a JSON response, a user model must be specified and the entity set and entity type must be passed to the ODataMessageWriter.CreateODataEntryWriter method or the ODataFeedAndEntrySerializationInfo must be set on the ODataEntry or ODataFeed that is being written."
Any suggestions/advice? I have tried other sources and they work as it seem. Thanks for your help // henrik Tags:
The execution seem ok. Problem is when I start enumerating through the list that shold have been produced. I can clearly see in fiddler that result comming back to me is ok. Something is happening on clientside. Maybe the call itself to the service is doing something wierd. But why should it do that when it works on the query for Company.
Can this has to do with child/relations spec maybe?
Gives me this object and I can see in fiddler that response is received and correct but accoring to error TotalCount is missing: https://postimg.org/image/eyv1hglnj/ However I got the objext I am supposed to.
If I try to call .ToList it first makes call to .Execute and then try to create :
Microsoft.OData.Core.ODataException was unhandled
Message=When writing a JSON response, a user model must be specified and the entity set and entity type must be passed to the ODataMessageWriter.CreateODataEntryWriter method or the
ODataFeedAndEntrySerializationInfo must be set on the ODataEntry or ODataFeed that is being written.
at Microsoft.OData.Core.ODataFeedAndEntryTypeContext.ValidateAndReturn[T](T value)
at Microsoft.OData.Client.Materialization.FeedAndEntryMaterializerAdapter.TryReadEntry(MaterializerEntry& entry)
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Data.WebServices.ODataTestApp.MainModule.Main() in Data.WebServices.OData.TestApp\MainModule.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String args)
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
Update : I Have error on TotalCount on the Company-call that worked so thats not the case.
modified 5-Jan-17 1:26am.
Last Visit: 31-Dec-99 19:00 Last Update: 22-Jan-17 8:22