System.NullReferenceException was unhandled by user code [duplicate]

-1

When compiling my application I received this error from the image below, would anyone know how I could solve it?

    
asked by anonymous 27.03.2018 / 14:47

1 answer

0

"Check to determine if the object is null before calling the method". The program itself answers your question.

Your method tries to return a session without even checking for an initialized instance, that is, without knowing whether a session was created or not. You need to perform an exception check, and only if there is a session, then return it.

    
27.03.2018 / 15:10