Red Gate forums :: View topic - System.InvalidProgramException
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 6
SmartAssembly 6 forum

System.InvalidProgramException

Search in SmartAssembly 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
gordan



Joined: 20 Jan 2012
Posts: 4

PostPosted: Thu Apr 26, 2012 10:04 pm    Post subject: System.InvalidProgramException Reply with quote

Hello,

I have used the SA version 6.0 for a while and now I have installed the latest version. After I have obfuscate my code code I start seeing very strange exception.

EDITED:

After obfuscation the folowing code throws System.InvalidProgramException - Common Language Runtime detected an invalid program.

Code:

public class Test()
{
   private static volatile bool _IsCurrentlyExecuting;
        private static readonly object LockObject = new object();


        public static bool IsCurrentlyExecuting
        {
            get
            {
           
                lock (LockObject)
                {

                    return _IsCurrentlyExecuting;
                }
            }

            private set
            {
                lock (LockObject)
                {
                    _IsCurrentlyExecuting = value;
                }
            }
        }
}


It fails when it tries to get the IsCurrentlyExecuting property. When I remove the volatile keyword it works fine.


Could someone tell me what can be the problem? I'm need this very urgently since the release is already done and this was working with the older SA that I was having.

Thanks in advance.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6667

PostPosted: Mon Apr 30, 2012 11:10 am    Post subject: Reply with quote

Sorry, I have never seen this problem before. However, the usual advice is to change some of the SmartAssembly options - some are incompatible with some kinds of coding.

In particular, I suspect Control Flow obfuscation, you may want to try a lower level there. Also, member refs proxy is probably going to violate the rules when it comes to volatile variables.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6667

PostPosted: Wed May 02, 2012 12:57 pm    Post subject: Reply with quote

Using your simple example, I cannot reproduce the issue.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group