I recently deployed a visual web part I created to my SharePoint 2013 dev environment. The visual web part included a list definition. Around that time I noticed that whenever I go to the list settings page for any list, I get the following error:
Server Error in '/' Application.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 14: }
Line 15: //spList = SPControl.GetContextWeb(Context).Lists.GetList(new Guid(strLists[0]), true);
Line 16: if (SPBaseType.Survey == spList.BaseType)
Line 17: {
Line 18: string redirectUrl = "survedit.aspx?List=" + strLists[0];
Source File: c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\listedit.aspx Line: 16
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
ASP._layouts_15_listedit_aspx.OnLoad(EventArgs e) in c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\listedit.aspx:16
System.Web.UI.Control.LoadRecursive() +67
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3810
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2053.0
I don't know if this is due to the list definition I deployed with the web part. Any help is appreciated.
Edit: I should clarify the code above is not mine, it is in SharePoint. The web part I created is mostly client-side, using restAPI to access list data. The only server-side code in the web part creates hidden fields for the web part properties so they can be accessed my javascript function. I am thinking that when I deployed the project, I somehow broke the SharePoint list settings page.
Edit: Below is my list definition in my visual web part project
Elements.xml file:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Do not change the value of the Name attribute below. If it does not match the folder name of the List project item, an error will occur when the project is run. -->
<ListTemplate
Name="MJBSynopsisList"
Type="100"
BaseType="0"
OnQuickLaunch="TRUE"
SecurityBits="11"
Sequence="410"
DisplayName="MJBSynopsisList"
Description="My List Definition"
Image="/_layouts/15/images/itgen.png"/>
</Elements>
Schema.xml file:
<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint" Title="MJBSynopsisList" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/MJBSynopsisList" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
<MetaData>
<ContentTypes>
<ContentType ID="0x010019e39774dd04447986f2a0289547604f" Name="ListFieldsContentType">
<FieldRefs>
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" />
<FieldRef ID="{7b29fd85-810b-4a1c-afda-c8e43042fb53}" Name="SynopsisUrl" />
<FieldRef ID="{0f71dc7b-0642-427c-8dc2-462fa0fd706f}" Name="SynopsisDetails" />
<FieldRef ID="{8ecb2fe3-0ac2-4b7c-90e0-0e610dc07394}" Name="ItemOrder" />
<FieldRef ID="{72c75154-7ef3-4216-bc61-81ad8488c039}" Name="ItemActive" />
</FieldRefs>
</ContentType>
<ContentTypeRef ID="0x01">
<Folder TargetName="Item" />
</ContentTypeRef>
<ContentTypeRef ID="0x0120" />
</ContentTypes>
<Fields>
<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Type="Text" Name="Title" DisplayName="$Resources:core,Title;" Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" MaxLength="255" />
<Field Name="SynopsisUrl" ID="{7b29fd85-810b-4a1c-afda-c8e43042fb53}" DisplayName="Synopsis Url" Type="URL" />
<Field Name="SynopsisDetails" ID="{0f71dc7b-0642-427c-8dc2-462fa0fd706f}" DisplayName="Synopsis Details" Type="Note" RichText="TRUE" RichTextMode="FullHtml" Required="TRUE" />
<Field Name="ItemOrder" ID="{8ecb2fe3-0ac2-4b7c-90e0-0e610dc07394}" DisplayName="Item Order" Type="Number" />
<Field Name="ItemActive" ID="{72c75154-7ef3-4216-bc61-81ad8488c039}" DisplayName="Item Active" Type="Boolean" Required="TRUE">
<Default>1</Default>
</Field>
</Fields>
<Views>
<View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE">
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<RowLimit Paged="TRUE">30</RowLimit>
<ViewFields>
<FieldRef Name="LinkTitleNoMenu"></FieldRef>
</ViewFields>
<Query>
<OrderBy>
<FieldRef Name="Modified" Ascending="FALSE"></FieldRef>
</OrderBy>
</Query>
<ParameterBindings>
<ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" />
<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" />
</ParameterBindings>
</View>
<View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/15/images/generic.png?rev=23" Url="AllItems.aspx">
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<JSLink>clienttemplates.js</JSLink>
<RowLimit Paged="TRUE">30</RowLimit>
<ViewFields>
<FieldRef Name="ID" />
<FieldRef Name="LinkTitle"></FieldRef>
<FieldRef Name="SynopsisUrl" />
<FieldRef Name="SynopsisDetails" />
<FieldRef Name="ItemOrder" />
<FieldRef Name="Modified" />
<FieldRef Name="Editor" />
<FieldRef Name="Created" />
<FieldRef Name="Author" />
<FieldRef Name="ItemActive" />
</ViewFields>
<Query>
<OrderBy>
<FieldRef Name="ID"></FieldRef>
</OrderBy>
</Query>
<ParameterBindings>
<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
</ParameterBindings>
</View>
</Views>
<Forms>
<Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
<Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
<Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
</Forms>
</MetaData>
</List>