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 6185407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:42:18+00:00 2026-05-24T01:42:18+00:00

My application contains references to an external library (the SQL Server Management Objects). Apparently,

  • 0

My application contains references to an external library (the SQL Server Management Objects). Apparently, if the library is not present on the run-time system, the application still works as long as no methods are called that use classes from this library.

Question 1: Is this specified behaviour or just a (lucky) side effect of the way the CLR loads libraries?

To detect whether the reference is accessible, I currently use code like this:

Function IsLibraryAvailable() As Boolean
    Try
        TestMethod()
    Catch ex As FileNotFoundException
        Return False
    End Try
    Return True
End Function

Sub TestMethod()
    Dim srv As New Smo.Server()  ' Try to create an object in the library
End Sub

It works, but it seems to be quite ugly. Note that it only works if TestMethod is a separate method, otherwise the exception will be thrown at the beginning of IsLibraryAvailable (before the try-catch, even if the object instantiation occurrs within the try-catch block).

Question 2: Is there a better alternative?

In particular, I’m afraid that optimizations like function inlining could stop my code from working.

  • 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-24T01:42:21+00:00Added an answer on May 24, 2026 at 1:42 am

    That is expected, since the JIT is lazy at the per-method level. Note that inlining isn’t an issue here, since that is also a JIT concern, not a compiler concern.

    Better options:

    • make sure the app is installed with everything it needs
    • using ilmerge or similar to create a single assembly (if possible)

    Personally, I’d just use the first option.

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

Sidebar

Related Questions

On our Dev box, our application module contains references to the file:/apps/WebSphere61/systemApps/isclite.ear/ jar files
Background: My application has a main window which contains a few smaller NSView objects,
I've built my application in Netbeans 6.8. The application contains various references to third
My application contains a piece of code that executes inside of Component Services, so
My Facebook application contains Javascript that works in Firefox and IE, but aborts in
We have a windows application that contains an ActiveX WebBrowser control. As part of
I have a console application that contains quite a lot of threads. There are
We currently have a quite complex business application that contains a huge lot of
I'm working profesionally on a php web application which contains contacts, among other data.
I am working on an ASP.NET MVC application that contains a header and menu

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.