Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

CLR Solution failing

I have an assembly on a customer SQL Server that has been working for a year flawlessly
It passes data to a web service
Their server is a SQL 2008R2

I have the SAME Assembly loaded on a SQL 2008R2 of our own

Neither have been changed
All of a sudden the customer is timing out with the attached error

I can run the same process on my server virtually instantaneously

Any ideas?

Msg 6522, Level 16, State 2, Line 2
A .NET Framework error occurred during execution of user-defined routine or aggregate "EverywareGTG": 
System.NullReferenceException: Object reference not set to an instance of an object.
System.NullReferenceException: 
   at HelloEveryware.PassIn.GTG(String user, String token, String PID, String OID, String TSW_ID, String FirstName, String LastName, String IsOwner, String EmailAddress, String AccomName, String AccomAddress, String AccomState, String CheckinDate, String CheckinTime, String CheckoutTime, String AccomNights, String TourDate_Disp, String TourWave, String TourLocation, String ContactUsPhone, String DateAdded, String SendNow, String AccomCreationDate, String AccomPhone, String ActivitySeason, String CampaignName, String CancellationPeriod, String CheckinDate_Disp, String CheckInDayOfWeek, String CheckoutDate, String CheckoutDate_Disp, String ContactUsEmail, String ContactUsSignature, String OpenDate, String OpenExpirationDate, String OpenExpirationDate_Unix, String OpenMonths, String OwnerAgentName, String OwnerLottoPreferenceLevel, String OwnerLottoRequest, String OwnerLottoUse, String OwnerNumber, String OwnershipSeason, String OwnershipUnitSize, String OwnershipWeekType, String OwnershipWeekUse, String PackageAmount, String PackageValue, String PetFriendly, String Phone, String PremiumMessage, String ProgramName, String RescheduleByDate, String RescheduleDays, String ReservationStatus, String ReservationSubType, String ReservationSuperType, String ReservationType, String RoomType, String SiteName, String SitesOwned, String State, String TourCreationDate, String TourDate, String TourLocation_Disp, String TourStatus, String UpdatedDate, String UserKey, String Variable1, String Variable2, String Variable3, String Variable4, String Variable5, String Variable6, String WeekEndNight, String OpenAccomNights)

Open in new window

Avatar of Nakul Vachhrajani
Nakul Vachhrajani
Flag of India image

The object reference error indicates that the code is trying to access a NULL object. I would begin by trying to figure out the data being passed to the HelloEveryware.PassIn.GTG() method.

Once you have the parameters, see which ones are NULL and whether you have appropriate (string.IsNullOrEmpty) checks in the place to handle NULL values in the code.
Avatar of Larry Brister

ASKER

I run the exact same function from a parallel server with exactly same setup

Works on one

And out of the blue does not work on the customers
Also
It stopped working at a specific time
With the exact same data? This is a data condition that is causing the code to fail. Maybe some data was cleaned up which has caused a core object to become NULL.

For example, if you have a Students object with the StudentName field on it and the StudentName is NULL, trying to access Students.StudentName will result in a NULL reference exception/object reference error.
As Nakul mentioned, it would be related to passing Null values to an object causing NullReferenceException.
Since it is working correctly in one machine, kindly try exporting the CLR from the working Server to the others and try once.
Steps to export CLR and deploy again below:
https://www.exacthelp.com/2012/02/how-to-transfer-or-create-clr-stored.html
Folks,
 I understand what you are saying... and I would normally agree...
But... watch the progression

I unloaded the assembly on each of the two MS SQL Server 2008R2 instances
I reloaded on each exactly the same

On our server it executes perfectly

On the customers it returns the error

In addition...
On BOTH operating systems I can load the web service they are posting to directly in a browser and invoke directly

I have no explanation for that.  Do you?

DECLARE @tourConfirmation NCHAR(255)
SET @tourConfirmation = ( SELECT dbo.EverywareGTG('ew6F98', 'DB8E0DE3', '000','010','TSW_ID','FirstName','LastName','IsOwner',
										'lrbrister@myweb.com','AccomName','AccomAddress','AccomState','CheckinDate','CheckinTime','CheckoutTime',
										'AccomNights','TourDate_Disp','TourWave','TourLocation', 'ContactUsPhone','DateAdded','837',
										'AccomCreationDate','AccomPhone','ActivitySeason','CampaignName','CancellationPeriod','CheckinDate_Disp',
										'CheckInDayOfWeek','CheckoutDate', 'CheckoutDate_Disp','ContactUsEmail','ContactUsSignature',
										'OpenDate','OpenExpirationDate', 'OpenExpirationDate_Unix','OpenMonths','OwnerAgentName',
										'OwnerLottoPreferenceLevel','OwnerLottoRequest', 'OwnerLottoUse','OwnerNumber','OwnershipSeason',
										'OwnershipUnitSize','OwnershipWeekType', 'OwnershipWeekUse','PackageAmount','PackageValue','PetFriendly',
										'Phone','PremiumMessage', 'ProgramName','RescheduleByDate','RescheduleDays','ReservationStatus',
										'ReservationSubType','ReservationSuperType','ReservationType','RoomType','SiteName','SitesOwned','State',
										'TourCreationDate','TourDate','TourLocation_Disp','TourStatus','UpdatedDate','UserKey','Variable1','Variable2',
										'Variable3','Variable4','Variable5','Variable6','WeekEndNight', 'OpenAccomNights')
         )
SELECT  @tourConfirmation

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of EugeneZ
EugeneZ
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That did it!
No ide why that was needed but it worked. Thanks