Error when adding new story with a non-administrative account

Jan 24, 2009 at 10:15 PM
Edited Jan 24, 2009 at 10:49 PM
I'm getting the error message 'System.NullReferenceException: Object reference not set to an instance of an object.' in SpamPostprocessor.Process line 37.

IStory approvingStory = _storyRepository.FindById(story.Id);
approvingStory.Approve(SystemTime.Now());

In StoryService.Create line 124 _spamPostprocessor.Process(source, isSpam, detailUrl, story) is called but only for non administrative accounts.   I added a check for null in SpamPostprocess.Process before setting the Approve property for now.
 

Update:

Just wanted to add that this is a very cool project and nicely done.
Coordinator
Feb 4, 2009 at 2:38 AM
I have just updated it RC 1 do let me know if you are still getting this error.
Developer
Feb 8, 2009 at 2:33 PM
Error still exists. To avoid error I add some check on null:

                if (approvingStory != null)
                    approvingStory.Approve(SystemTime.Now());

Coordinator
Feb 8, 2009 at 6:03 PM
@activekix : You should never reach that far with Admin. Spam is only checked when User is Public and has score below than 25 (This is the default behavior).

@XaocCPS: Pls do not do this, instead try to figure the issue with latest release there is different connection for doing this background Job, ensure you have the right configuration file.
Developer
Feb 10, 2009 at 4:27 PM
But I already have last release. And this error still exists. :-( After adding this part of code problem has gone.
What about configuration file? I have last web.config  (minimal) from 2.1 version.

Developer
Feb 10, 2009 at 4:29 PM
Here some info

Type : System.NullReferenceException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=
b77a5c561934e089
Message : Object reference not set to an instance of an object.
Source : Kigg.Core
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : Void Process(System.String, Boolean, System.String, Kigg.DomainObjects.IStory)
Stack Trace :    at Kigg.Infrastructure.SpamPostprocessor.Process(String source, Boolean isSpam, String storyUrl, IStory story) in C:\CPS\#Projects\progg.ru.2.1\Core\Infrastructure\Spam\SpamPostprocessor.cs:line 37
  at Kigg.Service.StoryService.<>c__DisplayClass6.<Create>b__4(String source, Boolean isSpam) in C:\CPS\#Projects\progg.ru.2.1\Core\Service\StoryService.cs:line 124
  at Kigg.Infrastructure.DefaultSpamProtection.<>c__DisplayClass6.<IsSpam>b__0(String response) in C:\CPS\#Projects\progg.ru.2.1\Core\Infrastructure\Spam\Default\DefaultSpamProtection.cs:line 99
  at Kigg.Infrastructure.CachingHttpForm.GetAsync(String url, Action`1 onComplete, Action`1 onError) in C:\CPS\#Projects\progg.ru.2.1\Core\Infrastructure\Http\Decorated\CachingHttpForm.cs:line 65
  at Kigg.Infrastructure.DefaultSpamProtection.IsSpam(SpamCheckContent spamCheckContent, Action`2 callback) in C:\CPS\#Projects\progg.ru.2.1\Core\Infrastructure\Spam\Default\DefaultSpamProtection.cs:line 81
  at Kigg.Service.StoryService.Create(IUser byUser, String url, String title, String category, String description, String tags, String userIPAddress, String userAgent, String urlReferer, NameValueCollection serverVariables, Func`2 buildDetailUrl) in C:\CPS\#Projects\progg.ru.2.1\Core\Service\StoryService.cs:line 124
  at Kigg.Web.StoryController.Submit(String url, String title, String category, String description, String tags) in C:\CPS\#Projects\progg.ru.2.1\Web\Controllers\StoryController.cs:line 456

Feb 10, 2009 at 10:32 PM
I'm still getting the same error as well on line 37 of SpamPostprocessor.cs.  As mentioned in the title of the post by 'non-administrative' account I mean an account that is not an administrator account that is new and logged in for the first time.   I'm running on the refresh of RC1 as well.
Coordinator
Feb 10, 2009 at 11:31 PM
Okay, I will check and get back to you. thanks for pointing that again.
Apr 14, 2009 at 8:13 PM
Has this been addressed yet in a release? or what is the actual fix?  I am have same problem.
Coordinator
Apr 14, 2009 at 10:21 PM
As I am using the RTM version with MVC v1 RTM I am not able to reproduce this exception!
I logged in with normal user, Role=User=0 and submitted a story (In Debug mode) and no exception was thrown!
I think this issue is resolved!