MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Obscure error in modules  (Mono Support )

Viewed 11197 time(s), 4 post(s) 11/2/2011 3:11:52 AMby grant.stone007
grant-stone007

grant.stone007

11/2/2011 3:11:52 AM
I get the error shown below when using the MonoX SilverlightUpload control in a custom portal page of mine. The error is obscure in that it does not happen all of the time. It seems to only happen inconsistently whenever a page is refreshed or reloaded (not a postback) and after some period of time of no activity as if something has expired. I have experienced a similar error on other custom portal pages of mine and with other MonoX controls so it leads me to believe I am doing something fundamentally wrong. I have included some excerpts from the page and the codebehind file that pertains to the specific error message shown below.

I would greatly appreciate any advice as to the possible root cause of this error.

--------------------------------------------------
Error Message...
--------------------------------------------------
Object reference not set to an instance of an object.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 107: <br /><br />
Line 108: <asp:Label ID="Label4" runat="server" AssociatedControlID="ctlUpload" Text="Upload Photos to the Album:" CssClass="label-bold" ToolTip="Select oneor more photos to upload." ></asp:Label>
Line 109: <MonoX:SilverlightUpload runat="server" ID="ctlUpload"
Line 110: UploadVisibleOnInit="true" EnableFileGallery="false"
Line 111: OnFilesUploaded="OnFilesUploaded" />
Source File: G:\FOCZY\foczy.com\a\myGalleryEditor.aspx Line: 109

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
MonoSoftware.Web.Workspace.Lookup`1.GetAdapter() +60
MonoSoftware.LLBLGen.LookupBase`1.InitializeData() +693
MonoSoftware.Web.Workspace.Lookup`1.GetInstance(LookupDefinition lookupDefinition, IEntityField2 displayField, String displayMember, LookupUIType preferredUIType) +152
MonoSoftware.MonoX.DAL.EntityClasses.PrivacyLevelEntity.get_PrivacyLevelFriends() +138
MonoSoftware.MonoX.ModuleGallery.SilverlightUploadModule..ctor() +300
ASP.monox_modulegallery_silverlightuploadmodule_ascx..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\5cda477f\b013df81\App_Web_fjwpbo5p.8.cs:0
ASP.a_mygalleryeditor_aspx.__BuildControlctlUpload() in G:\FOCZY\foczy.com\a\myGalleryEditor.aspx:109
ASP.a_mygalleryeditor_aspx.__BuildControl__control14(Control __ctrl) in G:\FOCZY\foczy.com\a\myGalleryEditor.aspx:68
System.Web.UI.UpdatePanel.CreateContents() +184
ASP.a_mygalleryeditor_aspx.__BuildControlalbums_updpnl() in G:\FOCZY\foczy.com\a\myGalleryEditor.aspx:68
ASP.a_mygalleryeditor_aspx.__BuildControlRadPageView1() in G:\FOCZY\foczy.com\a\myGalleryEditor.aspx:66
ASP.a_mygalleryeditor_aspx.__BuildControlRadMultiPage1() in G:\FOCZY\foczy.com\a\myGalleryEditor.aspx:64
ASP.a_mygalleryeditor_aspx.__BuildControlmainForm() in G:\FOCZY\foczy.com\a\myGalleryEditor.aspx:30
ASP.a_mygalleryeditor_aspx.__BuildControlTree(a_mygalleryeditor_aspx __ctrl) in G:\FOCZY\foczy.com\a\myGalleryEditor.aspx:1
ASP.a_mygalleryeditor_aspx.FrameworkInitialize() in G:\FOCZY\foczy.com\a\myGalleryEditor.aspx.vb:912308
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +71
System.Web.UI.Page.ProcessRequest() +268
System.Web.UI.Page.ProcessRequest(HttpContext context) +139
ASP.a_mygalleryeditor_aspx.ProcessRequest(HttpContext context) +50
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +532
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +255

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225


--------------------------------------------------------------
Excerpt of aspx page...
--------------------------------------------------------------
<%@ Page Language="VB"
AutoEventWireup="false"
CodeFile="myGalleryEditor.aspx.vb"
Inherits="a_myGalleryEditor"
Theme="Default"
%>
<%@ Import Namespace="MonoSoftware.MonoX.Resources" %>
<%@ Register TagPrefix="MonoX" TagName="SilverlightUpload" Src="/MonoX/ModuleGallery/SilverlightUploadModule.ascx" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
...
<asp:Label ID="Label4" runat="server" AssociatedControlID="ctlUpload" Text="Upload Photos to the Album:" CssClass="label-bold" ToolTip="Select one or more photos to upload." ></asp:Label>
<MonoX:SilverlightUpload runat="server" ID="ctlUpload"
UploadVisibleOnInit="true" EnableFileGallery="false"
OnFilesUploaded="OnFilesUploaded" />
...
--------------------------------------------------------------
Excerpt from codebehide file
--------------------------------------------------------------
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Telerik.Web.UI
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Common
Imports MonoSoftware.MonoX.API
Imports MonoSoftware.MonoX.Repositories


Partial Class a_myGalleryEditor
Inherits MonoSoftware.MonoX.BasePage
...

Private Sub AlbumEdit_DataBind()

' called on page load and each and every postback

ctlUpload.EntityType = MonoSoftware.MonoX.Utilities.SnEntityType.Album
ctlUpload.EntityId = Guid.Parse(albumID)
ctlUpload.OverwriteExistingFiles = True
ctlUpload.UserReputationNewFileScore = 5
ctlUpload.PrefixFileNamesWithHash = False
ctlUpload.DefaultPrivacyLevelId = Guid.Parse("9762CB50-0FF3-4DC5-9942-56033CD2D021")
ctlUpload.TargetFolder = UserPath

End Sub
This content has not been rated yet. 
647 Reputation 69 Total posts
khorvat

khorvat

11/2/2011 9:15:20 AM
Hi,

this was a know issue in earlier MonoX versions and it is fixed, can you please tell us which version of MonoX are you using ?

BTW: this only happens when application pool is restarted (either by manual restart, application is recompile or by process idle time-our has been reached) and user tries to upload a file with Silverlight upload. When user refreshed the page or any other user access the Web site this error goes away.

Thanks
This content has not been rated yet. 
15993 Reputation 2214 Total posts
grant-stone007

grant.stone007

11/2/2011 2:22:57 PM
My current version is 4.5.3129.40. It makes sense that it may be related to application pool.

This content has not been rated yet. 
647 Reputation 69 Total posts
khorvat

khorvat

11/2/2011 3:01:59 PM
Hi,

to overcome this issue please use the below code on the WebPart constructor

//MonoSoftware.Web.Workspace WebContext registration (used for lookups, etc.)
CustomWebContext.InitLookupWebContext();

Let me know if this has solved the issue.

Regards
Rated 4.00, 1 vote(s). 
15993 Reputation 2214 Total posts