title: Sharepoint Webpart custom properties get default values on server reboot
body: <p>I have noticed that the custom properties of a webpart I developed return to their default values when I reboot my machine.</p>
  
  <p>Is that a normal behavior? are the properties saved as far as the server is up, or there is some parameters I am missing.</p>
  
  <p>Thank you.</p>
  
  <p>EDIT: code:</p>
  
  <pre><code>namespace TestWebpart
  {
      [ToolboxItemAttribute(false)]
      [XmlRoot(Namespace = "TestWebpart")]
      public class GraphWebpart : Microsoft.SharePoint.WebPartPages.WebPart
      {
          // Visual Studio might automatically update this path when you change the Visual Web Part project item.
          private const string _ascxPath = @"~/_CONTROLTEMPLATES/Test_Graph/TestWebpart/GraphWebpartUserControl.ascx";
  
          protected override void CreateChildControls()
          {
              ReloadElements();
          }
  
          protected void ReloadElements()
          {
              Controls.Clear();
              GraphWebpartUserControl control = (GraphWebpartUserControl)Page.LoadControl(_ascxPath);
  
              control.xmlDataUrl = XMLFileUrl;
  
              Controls.Add(control);
          }
  
          private static string _xmlFileUrl;
          [WebBrowsable(true),
          Personalizable(PersonalizationScope.Shared),
          DefaultValue(""),
          Description("xml"),
          DisplayName("xml"),
          WebDisplayName("xml")]
          public string XMLFileUrl
          {
              get { return _xmlFileUrl; }
              set { 
                  _xmlFileUrl = value;
                  ReloadElements();
              }
          }
  }
  }
  </code></pre>
  
  <p><strong>EDIT2:</strong> 
  Deleting static from the fields throws the flowing exception:           </p>
  
  <pre><code>Web Part Error: An error occurred while setting the value of this property: TestWebpart:XMLFileUrl - Exception has been thrown by the target of an invocation.
  Hide Error Details
  
  [WebPartPageUserException: An error occurred while setting the value of this property: Blue_Graph.GraphWebpart.GraphWebpart:XMLFileUrl - Exception has been thrown by the target of an invocation.]
    at Microsoft.SharePoint.WebPartPages.BinaryWebPartDeserializer.ApplyPropertyState(Control control) 
    at Microsoft.SharePoint.WebPartPages.BinaryWebPartDeserializer.Deserialize() 
    at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)
  </code></pre>