Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6622721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:26:39+00:00 2026-05-25T21:26:39+00:00

I’m trying to deploy a .NET assembly to SQL Server 2008 R2 database, but

  • 0

I’m trying to deploy a .NET assembly to SQL Server 2008 R2 database, but I’m just hitting this error:

Deploy error SQL01268: .Net SqlClient Data Provider: Msg 6509, Level 16, State 31, Line 1 An error occurred while gathering metadata from assembly ‘Assembly’ with HRESULT 0x80004005.

Now the tricky part is that I’ve made sure that the framework version is correct, and I have a separate trivial CLR database project from which I add and test things to see if I can isolate the issue (I can’t). I’ve even written a tool which uses Mono.Cecil and PEVerify to ensure that I adhere to the programming model restrictions that apply to CLR projects in the database. I’m obviously missing something but I don’t know how to debug this, why can’t SQL Server just tell me why it fails?

Isn’t there something I can do to get more verbose output why SQL Server rejects the assembly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:26:40+00:00Added an answer on May 25, 2026 at 9:26 pm

    After two days of debugging this is what I did.

    Drawing from experience I used Cecil to rewrite the assembly, cancelling out methods by just replacing all method bodies with simply throw new NotImplementedException ignoring all constructors (initialization is a bit tricky and just can’t just kill the method body of a constructor). After doing this the assembly was installed successfully. I didn’t know what was the problem but I knew it had something to do with code. This was my assumption all along.

    To find the actual method, I used a binary search. I replaced half of the methods in the assembly and if the error was not there I went left, otherwise right as long as I had a problem until I found the smallest set of methods that were responsible for the error. Given that it was more than 2000 methods and I took about 1-2 seconds to test each configuration, it saved a lot of time.

    I managed to zero down on a single method rather easily and here it is (from what I could tell of my findings, this had to be in a generic class as well).

    class Hashtable<K, V>
    {
        IEnumerable<KeyValuePair<K, V>> GetEnumerator()
        {
            var hashtable = new Hashtable();
            return hashtable
                .Cast<DictionaryEntry>()
                .Select(x => new KeyValuePair<K, V>((K)x.Key, (V)x.Value))
                .GetEnumerator();
        }
    }
    

    Nothing in this code really results in any IL that’s invalid, even though there’s plenty of transformations applied by the compiler. If you put this in a database CLR assembly it will reject the assembly with an access denied error with without any further information.

    Eventually, I’m gonna file this as a bug with Microsoft, the error message should not be access denied and furthermore this code is actually allowed because it doesn’t do anything which isn’t allowed under the safe permission set.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.