Use Microphone in ViewModel, Error NullReferenceException

Topics: Bugs
May 12, 2014 at 10:58 AM
i use a pattern MVVM Caliburn Micro (Windows phone 8) and in my ViewModel i have this code

private Microphone microphone;
private byte[] buffer;
private MemoryStream stream;

public MainViewModel()
{

    microphone = Microphone.Default;
    stream = new MemoryStream();

    DispatcherTimer dt = new DispatcherTimer();
    dt.Interval = TimeSpan.FromMilliseconds(50);
    dt.Tick += delegate
    {
        try
        {
            FrameworkDispatcher.Update();
        }
        catch { }
    };
    dt.Start();
    microphone.BufferReady += new EventHandler<EventArgs>(microphone_BufferReady);


}

 void microphone_BufferReady(object sender, EventArgs e)
    {
    }
on this microphone.BufferReady += new EventHandler(microphone_BufferReady);

receive error => System.NullReferenceException: Object reference not set to an instance of an object

WHY?