Note that there are some explanatory texts on larger screens.

plurals
  1. POc# generic method crash
    primarykey
    data
    text
    <p>I have an application which is hosted somewhere (webhostingworld.net) and I have a dilemma. I have a tool (simple plain exe in .net 4 anycpu) that performs some offline stuff and it is started as a 'scheduled task' by 'Parallel Plesk Panel 11.0.9'. Everything went fine until I added a generic method.</p> <ul> <li>basically, it's just a dummy method that reads a json string from database and returns it;</li> <li>the process just dies, there is no exception thrown - I had to put logging from place to place and the last thing I did was putting logging before calling this method and the first thing inside it. The logging before calling this method is there, the one inside the method is not;</li> <li>the method declaration looks like this:</li> </ul> <p><code>public T Get&lt;T&gt;(string id);</code></p> <ul> <li>I contacted them to ask for some feedback - maybe they have seen something in system logs but I doubt they will bring some light;</li> <li>on my computer works fine (don't it always happen like this?);</li> <li>tried to compile in all cpu flavours: x86, x64, anyCPU and have the same behaviour ...</li> </ul> <p>I ran out of ideeas. I can always try to use the generic object (maybe this could be a better ideea from code size pov - but this is another subject) ... but it's quite frustrating because I wasn't able to find a good reason why this is happening ... So, any ideeas on what's happening?</p> <p>Thanks!</p> <p><strong>Update:</strong> The code looks like this:</p> <pre><code>public T Get&lt;T&gt;(string id) { Log.Debug("mary still has that little lamb"); string jsonString = GetASimpleStringFromDatabase(id); // id has values like "ID", "TEMPPATH", "MAIL", etc; DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(T)); using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(jsonString))) { return ser.ReadObject(ms); } } </code></pre> <p>And the call looks like this:</p> <pre><code>Log.Debug("Let's check if Mary has that little lamb"); MyClass c = deserializer.Get&lt;MyClass&gt;(stuff); </code></pre> <p>The first logging statement appears ("Let's check"), the second one ("still has") does not. The .net framework is identical with the one on my machine (at least in what concerns the version). I am wondering if there is some flag I need to check, something ... </p> <p><strong>Update</strong>: I am sorry, but the guys at the support are very slow with their responses. I have no answer on this. I will leave it without 'templates'. :-(</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload