Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encrypted SQL objects causing issue.. #16

Open
vidhyashankarkm opened this issue Jan 16, 2017 · 5 comments
Open

Encrypted SQL objects causing issue.. #16

vidhyashankarkm opened this issue Jan 16, 2017 · 5 comments

Comments

@vidhyashankarkm
Copy link

If any of my SP's/Functions are created as Encrypted, while stopping it gives me error as.
(as a work around deleting encrypted objects.)

Exception calling "Stop" with "0" argument(s): "Unable to cast object of type 'System.DBNull' to type 'System.String'."
At C:\Tools\SQLCover.ps1:106 char:17

  •             $coverageResults = $coverage.Stop()
    
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

Thanks
Vidhyashankar

@GoEddie
Copy link
Owner

GoEddie commented Feb 23, 2017

Hi,

Thanks for reporting this, the problem is that we can't ask sql for the definition as it is purposely hidden/encrypted.

I will add a check so that it doesn't crash and fail everything so it is at least handled gracefully and any unencrypted procs are covered.

Ed

@GoEddie
Copy link
Owner

GoEddie commented Feb 24, 2017

Hi - this should stop it crashing, we can't decode encrypted procs but at least any unencrypted code will be seen:

https://github.com/GoEddie/SQLCover/releases/tag/v0.4-test

@GoEddie GoEddie closed this as completed Feb 24, 2017
@vidhyashankarkm
Copy link
Author

vidhyashankarkm commented Mar 6, 2017

Hi, still v0.4 does not solve the issue

with encrypted object still we are getting same error

Exception calling "Stop" with "0" argument(s): "Unable to cast object of type 'System.DBNull' to type 'System.String'."
At D:\SQLCC\PS\SQLCover.0.4\SQLCover.ps1:141 char:17

  •             $coverageResults = $coverage.Stop()
    
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : InvalidCastException

@GoEddie
Copy link
Owner

GoEddie commented Mar 8, 2017

Hi,

There are only two places that could cause this - I fixed one of them with that release and the other would mean you have an object in sql that doesn't have a name.

If you run:

select object_id, '[' + object_schema_name(object_id) + '].[' + object_name(object_id) + ']' as object_name, definition, uses_quoted_identifier from sys.sql_modules where object_id not in (select object_id from sys.objects where type = 'IF')

do you have a value in every object_name column?

ed

@GoEddie GoEddie reopened this Mar 8, 2017
@vidhyashankarkm
Copy link
Author

Hi Ed, thanks for the quick response, yes the above query returns my encrypted object_name.
and FYI , encrypted object is a function.
thanks
Vidhyashankar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants