login about faq

Is is possible to place the call to Chilkat.Global's UnlockBundle() method somewhere in a c# class library, where it is guaranteed to be executed at least once prior to any other Chilkat related code?

I prefer to not include the call to UnlockBundle() in all the methods, so that it clutters up the code unnecessarily. I could of course put the unlocking logic in a separate method and call that from all other methods, but I would like to avoid that if possible.

An example would be during unit testing of various methods implementing Chilkat functionality. There is no main application at this point and each method is tested independently.

I just want to make sure that I did not overlook an obvious approach.

asked Jan 28 '16 at 07:57

roan98dk's gravatar image


Yes, this is exactly what you should do: Call Chilkat.Global.UnlockBundle once at the beginning of your program, and then all subsequently instantiated Chilkat objects will be created already unlocked. You don't even need to keep the instance of the Chilkat.Global object around. Just instantiate a Chilkat.Global object, call UnlockBundle, and then discard the Chilkat.Global instance.


answered Jan 28 '16 at 08:09

chilkat's gravatar image

chilkat ♦♦

I know that, but there isn't really a start of a program in an independent class library, right?

Say e.g. that I forget to unlock it once in the main application. I do not want to remember to do that, but maybe there is no better way?

(Jan 28 '16 at 08:17) roan98dk

And as I mentioned this also does not solve the problem while I do unit testing inside the class library project. Then I would have to add the unlocking logic during ClassInitialize() or similar place. And what if there are many test classes? Would I then have to add this to each of them?

(Jan 28 '16 at 08:20) roan98dk

Matt, sometimes it seems that you only get notified about answers and questions, but not comments. Please correct me if I am wrong. So just in case I will post this answer, so that you can respond to my comments.


answered Jan 28 '16 at 11:18

roan98dk's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Jan 28 '16 at 07:57

Seen: 1,786 times

Last updated: Jan 28 '16 at 11:18

powered by OSQA