When I running DotNetNuke 4.0.2, I sometimes (not always !?) receive System.NullReferenceException exceptions in the area related to GetSupportedLocales.
1. I've changed in DNNLibrary\Components\Localization\Localization.vb GetResource(ByVal ResourceFileRoot As String, ByVal objPortalSettings As PortalSettings, ByVal strLanguage As String) function the code to use local variable
Dim locale As Locale = GetSupportedLocales(userLanguage) 'mnf 17/1/2006 second call returns Nothing
'If (Not GetSupportedLocales(userLanguage) Is Nothing) AndAlso (GetSupportedLocales(userLanguage).Fallback.ToLower <> "") Then
If (Not locale Is Nothing) AndAlso (locale.Fallback.ToLower <> "") Then
fallbackLanguage = locale.Fallback.ToLower 'GetSupportedLocales(userLanguage).Fallback.ToLower
End If
2. In DNNLibrary\Components\Shared\PageBase.vb PageCulture function I've also added check (Not enabledLocales Is Nothing ) around For Each block
If
Not enabledLocales Is Nothing Then 'MNF 18/1/2005
For
Each _localeCode As String In enabledLocales.AllKeys
....
Next
End If ''MNF 18/1/2005
I found that the similar errors are also posted at DNN Forum here and here.
UPDATE: I was about to post the fix for the DataCache.GetCache pattern when found that it's already done and fixed in the core code 30/1/2006.
posted @ Wednesday, January 18, 2006 7:57 AM