Red Gate forums :: View topic - SmartAssembly error - System.InvalidOperationException
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

SmartAssembly error - System.InvalidOperationException

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



Joined: 13 Mar 2012
Posts: 3

PostPosted: Tue Mar 13, 2012 8:47 pm    Post subject: SmartAssembly error - System.InvalidOperationException Reply with quote

I am trying to obfuscate my web application code. The individual dll's like App_Code and App_global are not an issue. But my application has a merged assembly (App_Web_xxx files merged using aspnet_merge) which is causing an error.

Build Failed:
System.InvalidOperationException: Unknown constant type object

Any ideas and what would cause the error on the merged file. Any help will be appreciated. Thanks.
Back to top
View user's profile Send private message
Simon C



Joined: 26 Feb 2008
Posts: 140
Location: Red Gate Software

PostPosted: Wed Mar 14, 2012 10:31 am    Post subject: Reply with quote

Sorry you're seeing this problem. We got the exception report you sent in.

This exception is thrown when there is a value in the Constant metadata table of a type we don't expect. From information in your exception report, it looks like it's a constant specified on a parameter of the EnterData.saveSubCategoryData method in the OESReporting assembly. If you have access to the source code of that assembly, could you post (or send us) the definition of that method and information on how you compiled it, or information on where you got the assembly from?

thanks
SimonC
Back to top
View user's profile Send private message Send e-mail
pjagadeesan



Joined: 13 Mar 2012
Posts: 3

PostPosted: Wed Mar 14, 2012 4:05 pm    Post subject: Thanks Reply with quote

Thanks for the info. It helped me to resolve the issue.

The method definition was

Protected Function saveSubCategoryData(Optional ByVal selectedIndex = Nothing) As Boolean

I was able to change it to the following, compile and obfuscate.

Protected Function saveSubCategoryData(Optional ByVal selectedIndex As String = Nothing) As Boolean

Thanks again!
Back to top
View user's profile Send private message
Simon C



Joined: 26 Feb 2008
Posts: 140
Location: Red Gate Software

PostPosted: Wed Mar 14, 2012 6:02 pm    Post subject: Reply with quote

Out of interest, which version of the VB compiler are you using? The compilers in VS 2010 and VS 2008 both produce constants that match up with the CLR specification (the Object type breaks the specification, hence the error message)
Back to top
View user's profile Send private message Send e-mail
pjagadeesan



Joined: 13 Mar 2012
Posts: 3

PostPosted: Thu Mar 15, 2012 3:23 pm    Post subject: Reply with quote

I am using the VS2008 compiler.

FYI - SmartAssembly did not throw an error when the compiled App_Code dll was obfuscated separately.
It only threw an error when I tried to obfuscate the merged assembly
(merged all my App_Web, App_Code dlls to one assembly using aspnet_merge)
Back to top
View user's profile Send private message
codecutter



Joined: 04 Jul 2007
Posts: 4

PostPosted: Mon Apr 02, 2012 11:22 am    Post subject: Reply with quote

I'm also trying to run a project that was running in earlier versions of SmartAssembly. However, I am also getting a similar error. I have also upgraded to VS 2010. Error reports should have been sent.

Is there anything else I can do to help track this problem. I have not been able to obfuscate our software for sometime and have resorted to sending out 'unprotected' code.
_________________
Doug Krawec
Back to top
View user's profile Send private message
Simon C



Joined: 26 Feb 2008
Posts: 140
Location: Red Gate Software

PostPosted: Mon Apr 02, 2012 11:40 am    Post subject: Reply with quote

We've got your error reports.

In your case, the input assembly is invalid. The exception table type for one of the methods in the DeployLX.Licensing.V4 assembly is an invalid value (0x2a). The allowed values according to the CLR spec are 0x1, 0x2, 0x40, or 0x80.

This is probably due to existing obfuscation on that assembly. As a workaround, you could try embedding that assembly instead of merging it, or distribute it separately.
Back to top
View user's profile Send private message Send e-mail
codecutter



Joined: 04 Jul 2007
Posts: 4

PostPosted: Mon Apr 02, 2012 11:55 am    Post subject: Reply with quote

Thank you for the quick reply.

I am getting this error when trying to open the SmartAssembly project. Therefore, I am unable to modify the SmartAssembly project without recreating it from scratch (which I am not keen to do). Is there any way of removing this 'merged' assembly by another method?
_________________
Doug Krawec
Back to top
View user's profile Send private message
Simon C



Joined: 26 Feb 2008
Posts: 140
Location: Red Gate Software

PostPosted: Mon Apr 02, 2012 12:03 pm    Post subject: Reply with quote

You could edit the saproj in a text editor and simply remove the <Assembly> xml element for that assembly, then try and reload the project.
Back to top
View user's profile Send private message Send e-mail
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