SmartAssembly error - System.InvalidOperationException

pjagadeesanpjagadeesan Posts: 4
edited April 2, 2012 7:03AM in SmartAssembly
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.

Comments

  • 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
  • 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!
  • 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)
  • 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)
  • codecuttercodecutter Posts: 5 Bronze 2
    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
  • 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.
  • codecuttercodecutter Posts: 5 Bronze 2
    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
  • 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.
Sign In or Register to comment.