c# XNA Cannot access a disposed object. Object name: 'Texture2D'. But im not disposing it

Error: Cannot access a disposed object. Object name: 'Texture2D'

Why is this happening! Nowhere in the whole of my code does it tell it to dispose! This is occuring on the LoadContent() in my XNA c# game. Code where i get this error, ive highlighted the Texture2D were this occurs.

 protected override void LoadContent()
    {
        SoundEffect.DistanceScale = 20;
        SetUpPlain();
        SetUpWalls();
        // Walls
        wallsEffect = new BasicEffect(graphics.GraphicsDevice);
        wallsEffect.World = Matrix.Identity;
        wallsEffect.Projection = vars.projection;
        wallsEffect.TextureEnabled = true;
        wallsEffect.Texture = Content.Load<**Texture2D**>("Textures\\Fence");
        // Set-up Player Options
        Player1.PlayerModel = Content.Load<Model>("PlayerA");
        Player1.BoundingSphere = new BoundingSphere(new Vector3(Player1.Position.X, Player1.Position.Y - 2, Player1.Position.Z), Player1.PlayerModel.Meshes[0].BoundingSphere.Radius * 0.04f);
        Player2.PlayerModel = Content.Load<Model>("PlayerA");
        Player2.BoundingSphere = new BoundingSphere(new Vector3(Player2.Position.X, Player2.Position.Y - 2, Player2.Position.Z), Player2.PlayerModel.Meshes[0].BoundingSphere.Radius * 0.04f);
        //
        loadStaticModel(Content, "Radio", null, 11, 4, -2, 0, 180, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "AmmoCrate", null, 10, 1, 0, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "AmmoCrate", null, 12, 1, 0, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "AmmoCrate", null, 11, 3, 0, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "Forklift", null, 15, 0, -5, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "PepsiMachine", null, 25, 0, -5, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "Chest", null, 10, 0, -20, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "PalletBoard", "Cork", 10, 0, -20, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "Table", "Cork", 15, 0, -20, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "Cylinder", "Cork", 15, 0, -40, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "Wall", "Cork", 184, 0, -196, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "WallTop", "Cork", 184, 0, -188, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "Wall", "Cork", 184, 0, -180, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "Door1", "MetalA", 184, 0, -188, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "Door1", "MetalA", 184, 0, -184, 0, 0, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "Wall", "Cork", 188, 0, -176.15f, 0, 90, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        loadStaticModel(Content, "Wall", "Cork", 196, 0, -176.15f, 0, 90, 0, CollisionType.Default, LightingType.AmbientDirectional, true, false);
        for (int i = 1; i <= MapSize / 8; i++)
        {
            loadStaticModel(Content, "Fence", "Fence", i * 8.12f - 4, 0, 0, 0, 270, 0, CollisionType.None, LightingType.AmbientDirectional, false, false);
            loadStaticModel(Content, "Fence", "Fence", 0, 0, -(i * 8.12f - 4), 0, 180, 0, CollisionType.None, LightingType.AmbientDirectional, false, false);
            loadStaticModel(Content, "Fence", "Fence", MapSize, 0, -(i * 8.12f - 4), 0, 0, 0, CollisionType.None, LightingType.AmbientDirectional, false, false);
            loadStaticModel(Content, "Fence", "Fence", i * 8.12f - 4, 0, -MapSize, 0, 90, 0, CollisionType.None, LightingType.AmbientDirectional, false, false);
        }
        // Sound
        vars.soundEffect[0] = Content.Load<SoundEffect>("Sounds\\NormalStep");
        vars.soundEffect[1] = Content.Load<SoundEffect>("Sounds\\Enter Sandman");
        vars.soundEffect[2] = Content.Load<SoundEffect>("Sounds\\PlayerJoinGame");
        vars.soundEffect[3] = Content.Load<SoundEffect>("Sounds\\JumpLand");
        vars.soundEffectInstance[0] = vars.soundEffect[1].CreateInstance();
        soundEffectPosition[0] = new Vector3(0, 200, 200);
        soundEffectEmitter[0] = new AudioEmitter();
        soundEffectEmitter[0].Position = soundEffectPosition[1];
        soundEffectListener[0] = new AudioListener();
        soundEffectListener[0].Position = Player1.Position;
        vars.soundEffectInstance[0].Apply3D(soundEffectListener[0], soundEffectEmitter[0]);
        vars.isSoundPlaying[0] = false;
        // Menu's
        vars.menuBackground = Content.Load<Texture2D>("Textures\\menuBackground");
        PauseMenu.screenShotHighlight = Content.Load<Texture2D>("Textures\\ScreenShotViewerHighlight");
        vars.MenuFont = Content.Load<SpriteFont>("Fonts//MenuFont");
        // Death HUD
        deathBackground = Content.Load<Texture2D>("Textures\\deathBackground");
        //
        chatBackground = Content.Load<Texture2D>("Textures\\chatBackground");
        plainTexture = Content.Load<Texture2D>("Textures\\Grass");
        // Tank
        tank = Content.Load<Model>("tank");
        tankTransforms = new Matrix[tank.Bones.Count];
        // Sky Dome
        skyDome = Content.Load<Model>("SkyDome");
        skyDomeTexture = Content.Load<Texture2D>("Textures\\skyBox");
        skyDomeTransforms = new Matrix[skyDome.Bones.Count];
        //
        font = Content.Load<SpriteFont>("Fonts//PCFont1");
        chatFont = Content.Load<SpriteFont>("Fonts//chatFont");
        xboxButtons = Content.Load<SpriteFont>("Fonts//xboxControllerSpriteFont");
        xboxFont = Content.Load<SpriteFont>("Fonts//MenuFont");
        spriteBatch = new SpriteBatch(graphics.GraphicsDevice);
        TextureEffect = Content.Load<Effect>("TextureEffect");
        // Viewports
        leftViewport = GraphicsDevice.Viewport;
        rightViewport = GraphicsDevice.Viewport;
        leftViewport.Width = leftViewport.Width / 2;
        rightViewport.Width = rightViewport.Width / 2;
        rightViewport.X = leftViewport.Width;
        // 
    }

Answers


skyDomeTexture = Content.Load("Textures\skyBox");

try this

skyDomeTexture = Content.Load(@"Textures/skyBox");


Need Your Help

Perl file copy duplicating output

regex perl file-io duplicates

I'm attempting to write a menu driven modular perl script that will capture user input and automate the network configuration process. This script has to be able to install required Arch packages,

input and thread problem, python

python multithreading

I am doing something like this in python

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.