|
Thursday, August 23, 2007(UTC)
|
|
Monday, August 30, 2010 12:08:24 PM(UTC)
|
21 [0.06% of all post / 0.02 posts per day] |
|
0
(View Thanks)
|
|
0
|
|
0
|
View All Posts by User
I reduced the rule list again. The globalization warnings came mostly from toUpper() / toLower() calls. I have randomly checked this warnings, all came from harcoded strings. As you can see in my bottom analysis, many warnings came from exception handling and then from string testing. I will not fix the exception handling, because one has to introduce a new YAFException class ... Here you can download the report file (works only in IE correct)New analysis: Code:Issue count TypeName # issues DoNotInitializeUnnecessarily 114 DoNotCatchGeneralExceptionTypes 63 DoNotDeclareVisibleInstanceFields 57 TestForEmptyStringsUsingStringLength 47 DoNotRaiseReservedExceptionTypes 34 ReviewUnusedParameters 34 UseLiteralsWhereAppropriate 20 DoNotExposeGenericLists 19 DoNotCastUnnecessarily 18 ConsiderPassingBaseTypesAsParameters 17 ImplementIDisposableCorrectly 13 RemoveUnusedLocals 13 AptcaMethodsShouldOnlyCallAptcaMethods 10 PropertiesShouldNotBeWriteOnly 10 CollectionPropertiesShouldBeReadOnly 8 CallGCSuppressFinalizeCorrectly 7 NonConstantFieldsShouldNotBeVisible 6 PropertiesShouldNotReturnArrays 5 AvoidUncalledPrivateCode 4 DoNotIgnoreMethodResults 4 InterfaceMethodsShouldBeCallableByChildTyp 4 DoNotHardcodeLocaleSpecificStrings 3 ReviewVisibleEventHandlers 3 UseEventsWhereAppropriate 3 AvoidUnusedPrivateFields 2 DeclareEventHandlersCorrectly 2 DoNotDeclareReadOnlyMutableReferenceTypes 2 DoNotDeclareStaticMembersOnGenericTypes 2 OverrideLinkDemandsShouldBeIdenticalToBase 2 DoNotCallOverridableMethodsInConstructors 1 InitializeReferenceTypeStaticFieldsInline 1 MembersShouldNotExposeCertainConcreteTypes 1 ================================================= Total 529
|
Ok, you are right, not all rules are useful After the first run over all assebmlies an the compiled page the tool found over 14000 issues. Then I disabled a few rules  "only" 1500. As you can see in my analysis of the report file, the most problems came from Globalization rules Code: Issue count TypeName # of issues SpecifyIFormatProvider 727 DoNotInitializeUnnecessarily 114 SpecifyCultureInfo 107 DoNotCatchGeneralExceptionTypes 63 DoNotDeclareVisibleInstanceFields 57 TestForEmptyStringsUsingStringLength 47 SpecifyStringComparison 41 DoNotRaiseReservedExceptionTypes 34 ReviewUnusedParameters 34 UsePropertiesWhereAppropriate 31 SetLocaleForDataTypes 23 UseLiteralsWhereAppropriate 20 DoNotExposeGenericLists 19 DoNotCastUnnecessarily 18 ConsiderPassingBaseTypesAsParameters 17 DoNotPassTypesByReference 17 GenericMethodsShouldProvideTypeParameter 17 OperatorOverloadsHaveNamedAlternates 16 ImplementIDisposableCorrectly 13 RemoveUnusedLocals 13 AptcaMethodsShouldOnlyCallAptcaMethods 10 PropertiesShouldNotBeWriteOnly 10 CollectionPropertiesShouldBeReadOnly 8 EventsShouldNotHaveBeforeOrAfterPrefix 8 CallGCSuppressFinalizeCorrectly 7 ParameterNamesShouldMatchBaseDeclaration 7 NonConstantFieldsShouldNotBeVisible 6 PropertiesShouldNotReturnArrays 5 AvoidUncalledPrivateCode 4 DoNotIgnoreMethodResults 4 InterfaceMethodsShouldBeCallableByChildTyp 4 DoNotHardcodeLocaleSpecificStrings 3 ReviewVisibleEventHandlers 3 UseEventsWhereAppropriate 3 AvoidOutParameters 2 AvoidUnusedPrivateFields 2 DeclareEventHandlersCorrectly 2 DoNotDeclareReadOnlyMutableReferenceTypes 2 DoNotDeclareStaticMembersOnGenericTypes 2 OverrideLinkDemandsShouldBeIdenticalToBase 2 PropertyNamesShouldNotMatchGetMethods 2 DoNotCallOverridableMethodsInConstructors 1 IdentifiersShouldHaveCorrectSuffix 1 InitializeReferenceTypeStaticFieldsInline 1 MembersShouldNotExposeCertainConcreteTypes 1 Total for YAF 1528 Give me 3 months of hollidays, stop your developement of YAF and I will make a very big patch Sorry I can not upload the report file in this forum
|
Hello, when I look over the code I found many things like this: if (text.Length > 0) or if(returnUrl == string.Empty) and so on. I use YAF with master pages as a part of an online game and sometimes I had the case that these strings were Null. To get my portal run, I fixed 3 or 4 of these issues with String.IsNullOrEmpty(). But I think that there are a lots of many other hidden issues in the code, they will come critical when someone not uses YAF as a standalone forum. Do you know the FXCop tool from Microsoft? http://msdn.microsoft.com/en-us...ary/bb429476(VS.80).aspx I used this tool over my assemblies and compiled pages to make my own code safer and stronger. MrData
|
|
Hello,
is it enough if I use the patch function from WinMerge to create such a patch?
MrData
|
Hello, I found following issues in the 1.9.4 beta 1)When you use: <add key="YAF.Root" value="~/forum"/> the UrlBuilder produces URLs like this: ...domain.com/app/forum //default.aspx?... A little workaround: Code:public string BuildUrl(string url) { // escape & to & url = url.Replace("&", "&");
// return URL to current script with URL from parameter as script's parameter return String.Format("{0}{1}?{2}", UrlBuilder.BaseUrl, UrlBuilder.ScriptName, url).Replace(@"//", @"/"); } 2)The "comment" is not updated in yaf_prov_updateuser Code:ALTER PROCEDURE [dbo].[yaf_prov_updateuser] ( @ApplicationName nvarchar(256), @UserKey nvarchar(64), @UserName nvarchar(256), @Email nvarchar(256), @Comment text, @IsApproved bit, @LastLogin datetime, @LastActivity datetime, @UniqueEmail bit ) AS BEGIN DECLARE @ApplicationID uniqueidentifier
EXEC [dbo].[yaf_prov_CreateApplication] @ApplicationName, @ApplicationID OUTPUT -- Check UserKey IF (@UserKey IS NULL) RETURN(1) --
-- Check for UniqueEmail IF (@UniqueEmail = 1) BEGIN IF (EXISTS (SELECT 1 FROM [dbo].[yaf_prov_Membership] m WHERE m.UserID != @UserKey AND m.EmailLwd=LOWER(@Email) AND m.ApplicationID=@ApplicationID) ) RETURN (2) END UPDATE [dbo].[yaf_prov_Membership] SET Username = @Username, UsernameLwd = LOWER(@Username), Email = @Email, EmailLwd = LOWER(@Email), IsApproved = @IsApproved, LastLogin = @LastLogin, LastActivity = @LastActivity, Comment = @Comment -- [color=red]<-- Missing![/color] WHERE ApplicationID = @ApplicationID AND UserID = @UserKey;
-- Return successful RETURN(0) END MrData
|
|
Hello,
if you find my changes useful, please add this to SVN
Thank you Mr Data
|
|
Hello,
I updated the german language file to version 1.9.4 beta.
Little improvements for:
1) Smilie Import When you import smilies from a pak file, the smilies now provided with a serial number and if necessary ordered rear appended to the list. Some time ago I downloaded the MSN smilies from this site here. In the pak file the smilies are already sorted
2) Private Messages I added new functions to PMList - Delete all messages in the actual box (inbox/outbox/archive) - Archive all messages - Mark all messages "as read"
|
Hello, I have found a problem in adminpage.cs Steps to reproduce this issue: - open YAF (for example in the IE) and login as an Admin (close the admin browser window) - open an other browser (for example firefox), login as an other user and send some private messages to Admin - Restart the web application (for example kill the webdev.webserver and restart debugging in VWD) - open with the "Admin" browser http://.../default.aspx?g=admin_eventlog as Admins first page everytime you will get the following exception: Code:Ausnahmedetails: System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Quellfehler:
Zeile 89: if ( _doc != null ) Zeile 90: { Zeile 91: _pagePointer = _doc.SelectSingleNode( string.Format( "//page[@name='{0}']", Page.ToUpper() ) ); Zeile 92: _currentPage = Page; Zeile 93: }
Quelldatei: C:\projekte\OnlineGame\OnlineGame\YAF\YAF.Classes\YAF.Classes.Utils\Localization\Localizer.cs Zeile: 91
Stapelüberwachung:
[NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.] YAF.Classes.Utils.Localizer.SetPage(String Page) in C:\projekte\OnlineGame\OnlineGame\YAF\YAF.Classes\YAF.Classes.Utils\Localization\Localizer.cs:91 YAF.Classes.Utils.YafLocalization.GetLocalizedTextInternal(String page, String tag) in C:\projekte\OnlineGame\OnlineGame\YAF\YAF.Classes\YAF.Classes.Utils\Localization\Localization.cs:164 YAF.Classes.Utils.YafLocalization.GetText(String page, String tag) in C:\projekte\OnlineGame\OnlineGame\YAF\YAF.Classes\YAF.Classes.Utils\Localization\Localization.cs:193 YAF.Classes.Utils.YafLocalization.GetText(String text) in C:\projekte\OnlineGame\OnlineGame\YAF\YAF.Classes\YAF.Classes.Utils\Localization\Localization.cs:94 YAF.Classes.Base.ForumPage.GetText(String text) in C:\projekte\OnlineGame\OnlineGame\YAF\YAF.Classes\YAF.Classes.Base\ForumPage.cs:626 YAF.Classes.Base.ForumPage.ForumPage_Init(Object sender, EventArgs e) in C:\projekte\OnlineGame\OnlineGame\YAF\YAF.Classes\YAF.Classes.Base\ForumPage.cs:192 System.Web.UI.Control.OnInit(EventArgs e) +99 System.Web.UI.UserControl.OnInit(EventArgs e) +77 YAF.Pages.Admin.eventlog.OnInit(EventArgs e) in c:\projekte\OnlineGame\OnlineGame\Game\Forum\pages\admin\eventlog.ascx.cs:213 System.Web.UI.Control.InitRecursive(Control namingContainer) +333 System.Web.UI.Control.AddedControl(Control control, Int32 index) +198 System.Web.UI.ControlCollection.Add(Control child) +80 YAF.Forum.Forum_Load(Object sender, EventArgs e) in c:\projekte\OnlineGame\OnlineGame\Game\App_Code\YAF\Forum.cs:108 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
The reason of this exception is that YAF wants to show the notification of new received private messages reason in adminpage.cs Code:/// <summary> /// Summary description for AdminPage. /// </summary> public class AdminPage : ForumPage { /// <summary> /// Creates the Administration page. /// </summary> public AdminPage() : base( null ) <---------- Transpage is Null by default in Adminpages { ... in Localizer.cs the call of Page.ToUpper() will raise the exception please change: public AdminPage(): base( null ) to public AdminPage(): base( "" ) the same issues are also in ~\pages\help\index.ascx.cs - (41, 20) : public index() : base(null) ~\pages\help\recover.ascx.cs - (41, 22) : public recover() : base(null)
|
|
Hello,
I have updated the german laguage file to YAF version V1.9.3 RC2 (Rev 2222). I also merged the old 1.9.3 translation with Tuju's 1.9.1.8 translation into this new file.
Please add it to SVN.
|
Jaben wrote:Quote: YAF tries to load the TimeZones in StaticData.cs from the Database. When I go back to StaticData.cs Rev 2139 everything works fine. The reason Localization.cs Line 106
TimeZones are not loaded from the database. They are loaded from the XML language file. You might not have the proper language specifications. Take a look at the english.xml for the time zones. I have used the correct language files, because after the "manual" setup everything works fine with the "old" files from rev 2222. During the first setup step YAF tries to call this in Localization.cs Line 106: filename = YafContext.Current.BoardSettings.Language; In this case the BoardSettings object is null and will be created with --> = new YafBoardSettings( PageBoardID ); . Then in BoardSettings.cs 41 the call of dt = YAF.Classes.Data.DB.board_list( boardID ); fails, because the the database is empty. Up to this step a xml-file was never touched.
|
|