I have build on development server a reporting page(full trust) that loads dynamically the Form dll (partially trusted if it matters) from a library xsn and use it to get some data from the form document for report.

Everything works fine on development server but not on production! The method Assembly.Load(byte[]) throws NullReferenceException! The web.config-s are practically the same except debug mod, stack trace and custom error.

I have tried to load that assembly from a console application(using sharepoint objects), I even put that dll in the bin and GAC forlders and added it on safe control in web config. The same error, on test works but on production not.

Is that something relating to some hidden policy? Could that be something related to account that application pool uses?(on test it is member of admins group) or maybe that has something relating to another trust setting inherited from machine.config?

In 2 days I din't find any clue and that keeps me sad :( Please help. (I work with Sharepoint 2010 enterprise)

  • 1
    Is you byte[] array realy not null? – Ruslan Dayanov Nov 1 '14 at 17:56
  • really not null, I have measured its length. My intuition says it must be something with politics of that full trust. – Markmd4 Nov 2 '14 at 1:08
  • Is load the user profile in IIS Application Pool configuration (Application Pools > Advanced Settings) enabled? – Ruslan Dayanov Nov 2 '14 at 2:16
  • Yes, Ruslan, that is also enabled, thanks for your interest – Markmd4 Nov 3 '14 at 8:37
  • Then the last idea - enable fusion logging and look what asssemblies are loading into the application domain. – Ruslan Dayanov Nov 3 '14 at 9:16

That is embarrassing but that error has nothing to do with Assembly.Load(), it was a null reference exception just the line below, somehow I managed to skip it when tried to isolate the problem and that lead me to a wrong path. Now it works the way it should be.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.