Main Site Documentation

'System.ObjectDisposedException' only when using Microsoft Emulator


#1

Hi All,

RE: NETMF 4.1

A) When I run my code on the FEZ Cobra 480x272 it works fine (no exceptions)
b) When I run using the Microsoft Emulator I get:

invoking randomly, and code always breaks on a Glide method.

I can’t see any useful hints from other forum topics on ‘System.ObjectDisposedException’

I am using the following references in the project:
GHIElectronics.NETMF.Glide
Microsoft.SPOT.Graphics
Microsoft.SPOT.Hardware
Microsoft.SPOT.Native
Microsoft.SPOT.Tinycore

My emulator settings are provided for 480x272 LCD below:
(C:\Program Files\Microsoft .NET Micro Framework\v4.1\Tools\Microsoft.SPOT.Emulator.Sample.SampleEmulator.exe.emulatorconfig )

<?xml version="1.0" encoding="utf-8"?>
<Emulator>
  <Types>
    <GpioPort>Microsoft.SPOT.Emulator.Gpio.GpioPort</GpioPort>
    <LcdDisplay>Microsoft.SPOT.Emulator.Lcd.LcdDisplay</LcdDisplay>
    <WinFS>Microsoft.SPOT.Emulator.FS.WindowsFileSystem</WinFS>
    <AsyncWinFS>Microsoft.SPOT.Emulator.FS.AsyncWindowsFileSystem</AsyncWinFS>
    <BSRegion>Microsoft.SPOT.Emulator.BlockStorage.Region</BSRegion>
    <BSBlockRange>Microsoft.SPOT.Emulator.BlockStorage.BlockRange</BSBlockRange>
    <BSDevice>Microsoft.SPOT.Emulator.BlockStorage.EmulatorBlockStorageDevice</BSDevice>
    <RemovableBSD>Microsoft.SPOT.Emulator.BlockStorage.EmulatorRemovableBlockStorageDevice</RemovableBSD>
    <NativeFS>Microsoft.SPOT.Emulator.FS.NativeFileSystem</NativeFS>
    <RamManager>Microsoft.SPOT.Emulator.Memory.RamManager</RamManager>
    <PhysicalSerialPort>Microsoft.SPOT.Emulator.Sample.PhysicalSerialPort, Microsoft.SPOT.Emulator.Sample.SampleEmulator</PhysicalSerialPort>
    <EmulatorSerialPort>Microsoft.SPOT.Emulator.Sample.EmulatorSerialPort, Microsoft.SPOT.Emulator.Sample.SampleEmulator</EmulatorSerialPort>
  </Types>

  <EmulatorComponents>
    <RamManager>
      <Size>8388608</Size>
    </RamManager>
      
    <LcdDisplay id="mydisplay">
      <Width>480</Width>
      <Height>272</Height>
      <BitsPerPixel>16</BitsPerPixel>
    </LcdDisplay>

    <PhysicalSerialPort id="COM1">
      <ComPortHandle>Usart1</ComPortHandle>
      <PhysicalPortName>COM1</PhysicalPortName>
      <BaudRate>38400</BaudRate>
    </PhysicalSerialPort>

    <GpioPort id="Pin_Select">
      <Pin>3</Pin>
      <ModesExpected>InputOutputPort</ModesExpected>
      <ModesAllowed>InputOutputPort</ModesAllowed>
      <Interrupt>EdgeLow</Interrupt>
      <Resistor>PullUp</Resistor>
      <VirtualKey>VK_SELECT</VirtualKey>
    </GpioPort>

    <GpioPort id="Pin_Left">
      <Pin>0</Pin>
      <ModesExpected>InputOutputPort</ModesExpected>
      <ModesAllowed>InputOutputPort</ModesAllowed>
      <Interrupt>EdgeLow</Interrupt>
      <Resistor>PullUp</Resistor>
      <VirtualKey>VK_LEFT</VirtualKey>
    </GpioPort>

    <GpioPort id="Pin_Right">
      <Pin>1</Pin>
      <ModesExpected>InputOutputPort</ModesExpected>
      <ModesAllowed>InputOutputPort</ModesAllowed>
      <Interrupt>EdgeLow</Interrupt>
      <Resistor>PullUp</Resistor>
      <VirtualKey>VK_RIGHT</VirtualKey>
    </GpioPort>

    <GpioPort id="Pin_Up">
      <Pin>2</Pin>
      <ModesExpected>InputOutputPort</ModesExpected>
      <ModesAllowed>InputOutputPort</ModesAllowed>
      <Interrupt>EdgeLow</Interrupt>
      <Resistor>PullUp</Resistor>
      <VirtualKey>VK_UP</VirtualKey>
    </GpioPort>

    <GpioPort id="Pin_Down">
      <Pin>4</Pin>
      <ModesExpected>InputOutputPort</ModesExpected>
      <ModesAllowed>InputOutputPort</ModesAllowed>
      <Interrupt>EdgeLow</Interrupt>
      <Resistor>PullUp</Resistor>
      <VirtualKey>VK_DOWN</VirtualKey>
    </GpioPort>

    <BSDevice id="OnBoardFlash">
      <MaxSectorWriteTime>500</MaxSectorWriteTime>
      <MaxBlockEraseTime>2000</MaxBlockEraseTime>
      <PersistanceFilename>OnBoardFlash.dat</PersistanceFilename>
      <BytesPerSector>2048</BytesPerSector>
      <Regions>
        <BSRegion>
          <BytesPerBlock>131072</BytesPerBlock>
          <BlockRanges>
            <BSBlockRange>
              <RangeType>Usage_Config</RangeType>
              <StartBlock>0</StartBlock>
              <BlockCount>1</BlockCount>
            </BSBlockRange>
            <BSBlockRange>
              <RangeType>Usage_Deployment</RangeType>
              <StartBlock>1</StartBlock>
              <BlockCount>10</BlockCount>
            </BSBlockRange>
            <BSBlockRange>
              <RangeType>Usage_Deployment</RangeType>
              <StartBlock>11</StartBlock>
              <BlockCount>10</BlockCount>
            </BSBlockRange>
            <BSBlockRange>
              <RangeType>Usage_Deployment</RangeType>
              <StartBlock>21</StartBlock>
              <BlockCount>10</BlockCount>
            </BSBlockRange>
            <BSBlockRange>
              <RangeType>Usage_Deployment</RangeType>
              <StartBlock>31</StartBlock>
              <BlockCount>10</BlockCount>
            </BSBlockRange>
            <BSBlockRange>
              <RangeType>Usage_Deployment</RangeType>
              <StartBlock>41</StartBlock>
              <BlockCount>10</BlockCount>
            </BSBlockRange>
            <BSBlockRange>
              <RangeType>Usage_FileSystem</RangeType>
              <StartBlock>51</StartBlock>
              <BlockCount>510</BlockCount>
            </BSBlockRange>
            <BSBlockRange>
              <RangeType>Usage_Storage_A</RangeType>
              <StartBlock>562</StartBlock>
              <BlockCount>1</BlockCount>
            </BSBlockRange>
            <BSBlockRange>
              <RangeType>Usage_Storage_B</RangeType>
              <StartBlock>563</StartBlock>
              <BlockCount>1</BlockCount>
            </BSBlockRange>
          </BlockRanges>
        </BSRegion>
      </Regions>
    </BSDevice>

    <NativeFS id="FATFS">
      <Namespace>ROOT</Namespace>
      <FileSystemName>FAT</FileSystemName>
      <BlockStorageDeviceComponentId>OnBoardFlash</BlockStorageDeviceComponentId>
      <VolumeId>0</VolumeId>
      <Label>FATFS</Label>
      <SerialNumber>100005</SerialNumber>
    </NativeFS>

    <RemovableBSD id="SD1">
      <Namespace>SD1</Namespace>
      <MaxSectorWriteTime>500</MaxSectorWriteTime>
      <MaxBlockEraseTime>2000</MaxBlockEraseTime>
    </RemovableBSD>

    <RemovableBSD id="SD2">
      <Namespace>SD2</Namespace>
      <MaxSectorWriteTime>500</MaxSectorWriteTime>
      <MaxBlockEraseTime>2000</MaxBlockEraseTime>
      
      
    </RemovableBSD>

    <WinFS id="WinFS">
      <Namespace>WINFS</Namespace>
      <BufferingStrategy>SyncIO</BufferingStrategy>
      <CanRead>true</CanRead>
      <CanWrite>true</CanWrite>
      <CanSeek>true</CanSeek>
      <Label>WinFS0</Label>
      <SerialNumber>100000</SerialNumber>
      <TotalSize>20000000</TotalSize>
    </WinFS>

  </EmulatorComponents>
</Emulator>

For the moment I am using try catch to continue test/developing but there’s something inherently wrong

Any thoughts welcome.