<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hello,<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">I&#8217;m experiencing a rather weird issue when using the ESL libraries for .NET.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">When running the below code outside of Visual Studio in its own executable(Console Application) I&#8217;m receiving the below exception.<o:p></o:p></p>
<p class="MsoNormal">When the code is run inside Visual Studio, it works perfect.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Using ESL library contained in Freeswitch 1.2.13.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.<o:p></o:p></p>
<p class="MsoNormal">&nbsp;&nbsp; at CSharp_ESLevent_Serialize(Void* jarg1, SByte* jarg2) in c:\users\gb\downloads\freeswitch-1.2.13\freeswitch-1.2.13\libs\esl\managed\esl_wrap.cpp:line 413<o:p></o:p></p>
<p class="MsoNormal">&nbsp;&nbsp; at ManagedEsl.ESLPINVOKE.ESLevent_Serialize(HandleRef jarg1, String jarg2)<o:p></o:p></p>
<p class="MsoNormal">&nbsp;&nbsp; at VoiceEventSocketDemoClient.Program.Main(String[] args) in c:\Users\gb\Documents\Visual Studio 2012\Projects\VoiceEventSocketDemoClient\VoiceEventSocketDemoClient\Program.cs:line 26<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal" style="background:#1E1E1E"><span style="font-size:10.0pt;font-family:Consolas;color:#4EC9B0">TcpListener</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:white">server</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:#B4B4B4">=</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:#569CD6">new</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:#4EC9B0">TcpListener</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">(</span><span style="font-size:10.0pt;font-family:Consolas;color:#4EC9B0">IPAddress</span><span style="font-size:10.0pt;font-family:Consolas;color:#B4B4B4">.</span><span style="font-size:10.0pt;font-family:Consolas;color:white">Parse</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">(</span><span style="font-size:10.0pt;font-family:Consolas;color:#D69D85">&quot;LISTEN.IP.GOES.HERE&quot;</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">),&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:#B5CEA8">5000</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">);<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#1E1E1E"><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#1E1E1E"><span style="font-size:10.0pt;font-family:Consolas;color:white">server</span><span style="font-size:10.0pt;font-family:Consolas;color:#B4B4B4">.</span><span style="font-size:10.0pt;font-family:Consolas;color:white">Start</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">();<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#1E1E1E"><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro"><o:p></o:p></span></p>
<p class="MsoNormal" style="background:#1E1E1E"><span style="font-size:10.0pt;font-family:Consolas;color:#4EC9B0">TcpClient</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:white">eslClient</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:#B4B4B4">=</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:white">server</span><span style="font-size:10.0pt;font-family:Consolas;color:#B4B4B4">.</span><span style="font-size:10.0pt;font-family:Consolas;color:white">AcceptTcpClient</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">();<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#1E1E1E"><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro"><o:p></o:p></span></p>
<p class="MsoNormal" style="background:#1E1E1E"><span style="font-size:10.0pt;font-family:Consolas;color:#4EC9B0">ESLconnection</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:white">eslConnection</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:#B4B4B4">=</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:#569CD6">new</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:#4EC9B0">ESLconnection</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">(</span><span style="font-size:10.0pt;font-family:Consolas;color:white">eslClient</span><span style="font-size:10.0pt;font-family:Consolas;color:#B4B4B4">.</span><span style="font-size:10.0pt;font-family:Consolas;color:white">Client</span><span style="font-size:10.0pt;font-family:Consolas;color:#B4B4B4">.</span><span style="font-size:10.0pt;font-family:Consolas;color:white">Handle</span><span style="font-size:10.0pt;font-family:Consolas;color:#B4B4B4">.</span><span style="font-size:10.0pt;font-family:Consolas;color:white">ToInt32</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">());<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#1E1E1E"><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro"><o:p></o:p></span></p>
<p class="MsoNormal" style="background:#1E1E1E"><span style="font-size:10.0pt;font-family:Consolas;color:#4EC9B0">ESLevent</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:white">e</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:#B4B4B4">=</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">&nbsp;</span><span style="font-size:10.0pt;font-family:Consolas;color:white">eslConnection</span><span style="font-size:10.0pt;font-family:Consolas;color:#B4B4B4">.</span><span style="font-size:10.0pt;font-family:Consolas;color:white">GetInfo</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">();<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#1E1E1E"><span style="font-size:10.0pt;font-family:Consolas;color:#4EC9B0">Console</span><span style="font-size:10.0pt;font-family:Consolas;color:#B4B4B4">.</span><span style="font-size:10.0pt;font-family:Consolas;color:white">WriteLine</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">(</span><span style="font-size:10.0pt;font-family:Consolas;color:white">e</span><span style="font-size:10.0pt;font-family:Consolas;color:#B4B4B4">.</span><span style="font-size:10.0pt;font-family:Consolas;color:white">Serialize</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">(</span><span style="font-size:10.0pt;font-family:Consolas;color:#D69D85">&quot;json&quot;</span><span style="font-size:10.0pt;font-family:Consolas;color:gainsboro">));<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Does anyone know why this is happening? Maybe someone can reproduce the problem on their own PC using the above code example.
<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Thank you!<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Grant<o:p></o:p></p>
</div>
</body>
</html>