{"id":4032,"date":"2014-03-30T07:19:35","date_gmt":"2014-03-30T07:19:35","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/can-reflection-be-used-in-compiletimeinitialize-in-postsharp-3-1-collection-of-common-programming-errors\/"},"modified":"2014-03-30T07:19:35","modified_gmt":"2014-03-30T07:19:35","slug":"can-reflection-be-used-in-compiletimeinitialize-in-postsharp-3-1-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/can-reflection-be-used-in-compiletimeinitialize-in-postsharp-3-1-collection-of-common-programming-errors\/","title":{"rendered":"Can Reflection be used in CompileTimeInitialize in PostSharp 3.1?-Collection of common programming errors"},"content":{"rendered":"<p>You can use reflection in <code>CompileTimeInitialize<\/code> method and, actually, <code>locationInfo<\/code> holds correct information during that method&#8217;s execution.<\/p>\n<p>However, the <code>locationInfo<\/code> field is then serialized, and later deserialized during runtime. This is where the problem happens &#8211; apparently, version 3.1 has introduced a bug related to serialization in this particular case. You can check this by saving only locationInfo.Name in the field, for example.<\/p>\n<p>It means you&#8217;d need to wait for a bug fix to be implemented in 3.1. You may also want to report the bugs directly on the PostSharp support forum.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can use reflection in CompileTimeInitialize method and, actually, locationInfo holds correct information during that method&#8217;s execution. However, the locationInfo field is then serialized, and later deserialized during runtime. This is where the problem happens &#8211; apparently, version 3.1 has introduced a bug related to serialization in this particular case. You can check this by [&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-4032","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4032","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=4032"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4032\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4032"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}