57
Views
6
Comments
Solved
[Generic Connector for Multipart/form-data request] [BUG]Object reference not set to an instance of an object
Question
Application Type
Service

Hello there!

I tried to use your component but i get the following error from the extension:

"Object reference not set to an instance of an object." Any idea what i'm doing wrong? 

2020-04-17 08-41-30
Tim Timperman
Solution

There's a bug in the (logging part of the) exception handling, which causes another exception. If there is no "innerException" in the original exception, the catch block will always throw the famous "Object reference ..." exception. And since there is no additional logging, you won't be able to figure out the real issue.

2022-07-07 18-45-50
Niels Favreau

After the changes from Tim, i was able to get more information. I had to remove the header parameter"Content-Type" since the extension was building it.

2025-12-15 12-14-19
Ajay Sharma

Sorry for the delayed response  Hope it resolved!!
Is there any change needed in the component, I will do it?

2020-04-17 08-41-30
Tim Timperman

Yes, in the catch block of the MssUpload method, there is a line (LogMessage) that uses "exp.InnerException.Message". And when there is no InnerException, the code crashes and throws another exception.

So in the catch block, there should be a check around the LogMessage call, where you validate "exp.InnerException == null". In that case, you make a simple LogMessage that doesn't use the innerexception.

UserImage.jpg
Manoj Kumar M

Is this issue resolved? I am still facing the same issue.. 

Any workaround or help will be of great help...

Thanks

UserImage.jpg
Wendy Tromp

Could you please add better logging to this extension? I a getting the same error which turns out to be a HTTP 503 - Service unavailable on the other side. I had to get this information by using postman to make the very same call, which is fine because it was a DEV environment, but for production environments this is of course possible. 

Can you at least somehow log the HTTP code somewhere? 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.