BugNET

Open source issue tracking & project management
| Login

Import Update!

We are currently in transition and have moved our discussions to CodePlex. These forums will remain as reference until we launch of our new site in the upcoming weeks. After that they will be removed.

Thank you for your patience during our transition.

Forums

HomeHomeSupportSupportGeneral SupportGeneral Support/Application Error - /BugNET/...  (Issue/Bug)/Application Error - /BugNET/... (Issue/Bug)
Previous
 
Next
New Post
12/5/2008 1:02 PM
 


***************************************************************************************************************************************
*NOTE: I posted this as a bug but wanted to include it here because this is the first place I searched when I ran into the issue
***************************************************************************************************************************************

My users started experiencing  "/Application Error" in mulitple scenarios that had nothing to do with server configuration because it was working fine for months then all of sudden started happening.

I tracked down the issue and discovered  the problem, a user account was deleted that had bugs created by the user. Future releases the code should be changed so that users with records can not be deleted, but here is the fix.

Run the followin query to update the BugsView view and the problem will go away. The code was unable to handle a NULL reference in the view, specifically in the stored procedure :

 

Found In Version: 0.7.921.0

-----------------------------

ALTER VIEW [dbo].[BugsView]
AS
SELECT     dbo.Bug.BugID, dbo.Bug.Summary, dbo.Bug.Description, dbo.Bug.ReportedDate, dbo.Bug.StatusID, dbo.Bug.PriorityID, dbo.Bug.TypeID, 
                      dbo.Bug.ComponentID, dbo.Bug.ProjectID, dbo.Bug.ResolutionID, dbo.Bug.VersionID, dbo.Bug.LastUpdate, dbo.Bug.ReporterUserId, 
                      dbo.Bug.AssignedToUserId, dbo.Bug.LastUpdateUserId, dbo.Status.Name AS StatusName, dbo.Component.Name AS ComponentName, 
                      dbo.Priority.Name AS PriorityName, dbo.Project.Name AS ProjectName, dbo.Project.Code AS ProjectCode, dbo.Resolution.Name AS ResolutionName, 
                      dbo.Type.Name AS TypeName, ISNULL(dbo.Version.Name, 'Unassigned') AS VersionName, ISNULL(LastUpdateUsers.UserName, N'none') 
                      AS LastUpdateUserName, ISNULL(ReportedUsers.UserName, N'none') AS ReporterUserName, ISNULL(AssignedUsers.UserName, 'Unassigned') 
                      AS AssignedToUserName, dbo.Bug.DueDate, dbo.Bug.FixedInVersionId, ISNULL(FixedInVersion.Name, 'Unassigned') AS FixedInVersionName, 
                      dbo.Bug.Visibility, ISNULL
                          ((SELECT     SUM(Duration) AS Expr1
                              FROM         dbo.BugTimeEntry AS BTE
                              WHERE     (BugId = dbo.Bug.BugID)), 0.00) AS TimeLogged, dbo.Bug.Estimation
FROM         dbo.Bug LEFT OUTER JOIN
                      dbo.Component ON dbo.Bug.ComponentID = dbo.Component.ComponentID LEFT OUTER JOIN
                      dbo.Priority ON dbo.Bug.PriorityID = dbo.Priority.PriorityID LEFT OUTER JOIN
                      dbo.Project ON dbo.Bug.ProjectID = dbo.Project.ProjectID LEFT OUTER JOIN
                      dbo.Resolution ON dbo.Bug.ResolutionID = dbo.Resolution.ResolutionID LEFT OUTER JOIN
                      dbo.Status ON dbo.Bug.StatusID = dbo.Status.StatusID LEFT OUTER JOIN
                      dbo.Type ON dbo.Bug.TypeID = dbo.Type.TypeID LEFT OUTER JOIN
                      dbo.Version ON dbo.Bug.VersionID = dbo.Version.VersionID LEFT OUTER JOIN
                      dbo.aspnet_Users AS AssignedUsers ON dbo.Bug.AssignedToUserId = AssignedUsers.UserId LEFT OUTER JOIN
                      dbo.aspnet_Users AS ReportedUsers ON dbo.Bug.ReporterUserId = ReportedUsers.UserId LEFT OUTER JOIN
                      dbo.aspnet_Users AS LastUpdateUsers ON dbo.Bug.LastUpdateUserId = LastUpdateUsers.UserId LEFT OUTER JOIN
                      dbo.Version AS FixedInVersion ON dbo.Bug.FixedInVersionId = FixedInVersion.VersionID

Steps to repeat:

1) Create a user account and give them access to a project to add new issues
2) Login as that user and create a new issue
3) Logout and then Login as admin and delete the new user account.
4) Navigate back through the project and you will see errors everywhere the stored procedure "BugNET_Bug_GetRecentlyAddedBugsByProject" is called.

This happens cause the view returns NULL for the ReportedUser

 
New Post
1/23/2009 12:10 AM
 

I detected a similar problem in V0.7.921.0 by using a category (DB table Component) for a bug and then deleting that category. Everywhere where that bug would be shown, the user gets that ugly error message.

I suggest to strictly setup foreign key constraints in the database to prevent deletion of referenced records. This solves the problem on the source rather then on the symptom.

Here a script to add the foreign key constraints for table Bug:

 

 

 

 

ALTER

TABLE Bug ADD CONSTRAINT FK_Bug_Status FOREIGN KEY ( StatusID ) REFERENCES dbo.Status ( StatusID )

ALTER

TABLE Bug ADD CONSTRAINT FK_Bug_Priority FOREIGN KEY ( PriorityID ) REFERENCES dbo.Priority ( PriorityID )

ALTER

TABLE Bug ADD CONSTRAINT FK_Bug_Type FOREIGN KEY ( TypeID ) REFERENCES dbo.Type ( TypeID )

ALTER

TABLE Bug ADD CONSTRAINT FK_Bug_Component FOREIGN KEY ( ComponentID ) REFERENCES dbo.Component ( ComponentID)

ALTER

TABLE Bug ADD CONSTRAINT FK_Bug_ProjectID FOREIGN KEY ( ProjectID ) REFERENCES dbo.Project( ProjectID )

ALTER

TABLE Bug ADD CONSTRAINT FK_Bug_Resolution FOREIGN KEY ( ResolutionID ) REFERENCES dbo.Resolution ( ResolutionID )

ALTER

TABLE Bug ADD CONSTRAINT FK_Bug_Version FOREIGN KEY ( VersionID ) REFERENCES dbo.Version ( VersionID )

ALTER

TABLE Bug ADD CONSTRAINT FK_Bug_Profile_ReporterUserId FOREIGN KEY ( ReporterUserId ) REFERENCES dbo.aspnet_Profile ( UserId )

ALTER

TABLE Bug ADD CONSTRAINT FK_Bug_Profile_LastUpdateUserId FOREIGN KEY ( LastUpdateUserId ) REFERENCES dbo.aspnet_Profile ( UserId )

--ALTER TABLE Bug ADD CONSTRAINT FK_Bug_FixedInVersionId FOREIGN KEY ( FixedInVersionId ) REFERENCES dbo.Version ( VersionID )

--FixedInVersionId is a problem, because the default value of -1 is obviously set by the application

--this should never be done -> instead:

-- - make the field nullable and setup null as default

-- - or have a record in the referenced table and make that the default by setting up a default constraint

-- (even for this, you can make the field nullable)

----show usage of Version for FixedInVersionId

--select b.FixedInVersionId, v.Name, [# Bugs] = COUNT( * )

--from Bug b left join Version v on b.FixedInVersionId = v.VersionID

--group by b.FixedInVersionId, v.Name

--select *

--from Bug

--where FixedInVersionId not in( select distinct VersionID from Version )

 

 
Previous
 
Next
HomeHomeSupportSupportGeneral SupportGeneral Support/Application Error - /BugNET/...  (Issue/Bug)/Application Error - /BugNET/... (Issue/Bug)


Forum Policy

These Discussion Forums are dedicated to the discussion of the BugNET issue tracker.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:
1. No Advertising.
2. No Flaming or Trolling.
3. No Profanity, Racism, or Prejudice.
4. Site Moderators have the final word on approving/removing a thread or post or comment.
5. English language posting only, please.