Can't load System.Resources.Extensions - in .Net Framework

2

I am suddenly getting an error in my code which is a Forms app compiled for .Net Framework 4.6.1. It occurs when I go to create an object that inherits from the TreeView object.

It does very little on top of TreeView.

The exception is:

System.IO.FileNotFoundException
  HResult=0x80070002
  Message=Could not load file or assembly 'System.Resources.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

It has this code:

protected override void OnHandleCreated(EventArgs e)
    {
    SendMessage(this.Handle, TVM_SETEXTENDEDSTYLE, (IntPtr)TVS_EX_DOUBLEBUFFER, (IntPtr)TVS_EX_DOUBLEBUFFER);
    base.OnHandleCreated(e);
    }

And does the following in setup:

private void InitializeComponent()
{
    this.SuspendLayout();
    // 
    // LinkTreeView
    // 
    this.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText;
    this.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.LinkTreeView_DrawNode);
    this.MouseEnter += new System.EventHandler(this.LinkTreeView_MouseEnter);
    this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.LinkTreeView_MouseMove);
    this.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.LinkTreeView_NodeMouseClick);
    this.MouseLeave += new System.EventHandler(this.LinkTreeView_MouseLeave);
    this.ResumeLayout(false);
}

It has member variables, but they're all standard Forms classes:

private Brush disabledBrush;
private Brush foregroundBrush;
private Brush linkBrush;
private Brush visitedBrush;
private Brush backGroundBrush;

private Pen activeLinkPen;
private Pen linkPen;
private Pen visitedLinkPen;

private StringFormat format;

// the delete bitmap out at the end.
private static readonly Bitmap deleteActive;
private static readonly Bitmap deleteDisabled;
private static readonly Rectangle rectDeleteBitmap;

Any idea what is going wrong?

winforms
exception
typeinitializationexception
asked on Stack Overflow Oct 10, 2020 by David Thielen

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0