{"id":3903,"date":"2014-03-30T06:18:41","date_gmt":"2014-03-30T06:18:41","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/binding-exception-with-dynamic-keyword-in-c-collection-of-common-programming-errors\/"},"modified":"2014-03-30T06:18:41","modified_gmt":"2014-03-30T06:18:41","slug":"binding-exception-with-dynamic-keyword-in-c-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/binding-exception-with-dynamic-keyword-in-c-collection-of-common-programming-errors\/","title":{"rendered":"Binding exception with dynamic keyword in c#-Collection of common programming errors"},"content":{"rendered":"<p>I am loading my assemblies at run time and I am also using Instance Activator to get the code at the runtime. Following code will summerize what I am doing:<\/p>\n<pre><code>dynamic powerTool;\nSystem.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom(\n    @\"C:\\Users\\c_desaik\\Desktop\\PowerTool.exe\");\nType type = assembly.GetType(\"PowerTool.Automation\");\npowerTool = Activator.CreateInstance(type);    \n<\/code><\/pre>\n<p>Now, as you have noticed, Powertool has been declared as dynamic because I do not want my code to fail at Compile time and I want it to resolve all the operations at the Runtime.<\/p>\n<p>While I do that the code fails to execute down the line with the following error:<\/p>\n<blockquote>\n<p>An unexpected exception occurred while binding a dynamic operation<\/p>\n<\/blockquote>\n<p>Now I thought that the entire concept behind the dynamic keyword was to be abl eto resove all the members and operation at the run time. How can I resolve this error?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am loading my assemblies at run time and I am also using Instance Activator to get the code at the runtime. Following code will summerize what I am doing: dynamic powerTool; System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom( @&#8221;C:\\Users\\c_desaik\\Desktop\\PowerTool.exe&#8221;); Type type = assembly.GetType(&#8220;PowerTool.Automation&#8221;); powerTool = Activator.CreateInstance(type); Now, as you have noticed, Powertool has been declared as dynamic [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3903","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3903","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3903"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3903\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}