Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8372433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:25:51+00:00 2026-06-09T14:25:51+00:00

when i run my app i have this exception Cannot create instance of ‘MainWindow’

  • 0

when i run my app i have this exception

Cannot create instance of 'MainWindow' defined in assembly 'MediaTransferTester, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation.  Error in markup file 'MainWindow.xaml' Line 1 Position 9.

this is my xaml code

<Window x:Class="MediaTransferTester.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow"
        Width="878"
        Height="588">
    <Grid Width="853" Height="525">
        <GroupBox Name="groupBox1"
                  Width="504"
                  Margin="12,12,0,316"
                  HorizontalAlignment="Left"
                  Header="EndPoint Config">

            <Grid Width="468" Height="139">
                <Label Name="label1"
                       Width="108"
                       Height="28"
                       Margin="6,12,0,0"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       Content="Loal IPs" />
                <Label Name="label2"
                       Width="108"
                       Height="28"
                       Margin="6,46,0,0"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       Content="Remote IP" />
                <Label Name="label3"
                       Width="58"
                       Margin="183,12,0,116"
                       HorizontalAlignment="Left"
                       Content="RTP Port" />
                <Label Name="label4"
                       Width="58"
                       Height="28"
                       Margin="183,47,0,0"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       Content="RTP Port" />
                <Label Name="label5"
                       Height="28"
                       Margin="6,84,0,0"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       Content="TransportType" />
                <RadioButton Name="rbUDP"
                             Height="16"
                             Margin="112,89,0,0"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Top"
                             Content="UDP"
                             GroupName="TransportType"
                             IsChecked="True" />
                <RadioButton Name="rbMSTP"
                             Height="16"
                             Margin="165,89,0,0"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Top"
                             Content="MSTP"
                             GroupName="TransportType" />
                <RadioButton Name="rbTCPConnect"
                             Height="16"
                             Margin="226,89,0,0"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Top"
                             Content="TCP Connect"
                             GroupName="TransportType" />
                <RadioButton Name="rbTcpListen"
                             Width="76"
                             Height="16"
                             Margin="317,89,0,0"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Top"
                             Content="TCP Listen"
                             GroupName="TransportType" />
                <ListBox Name="listBoxEndPointAddress"
                         Width="102"
                         Height="37"
                         Margin="75,11,0,0"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Top"
                         ScrollViewer.HorizontalScrollBarVisibility="Auto"
                         ScrollViewer.VerticalScrollBarVisibility="Visible" />
                <TextBox Name="TBRemoteEndpointIP"
                         Width="102"
                         Height="23"
                         Margin="75,52,0,0"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Top"
                         LostFocus="TBRemoteEndpointIP_LostFocus" />
                <TextBox Name="LocalrtpPort"
                         Width="38"
                         Height="23"
                         Margin="247,12,0,0"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Top"
                         LostFocus="LocalrtpPort_LostFocus"
                         MaxLength="4" />
                <TextBox Name="RemotertpPort"
                         Width="38"
                         Height="23"
                         Margin="247,46,0,0"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Top"
                         LostFocus="RemotertpPort_LostFocus"
                         MaxLength="4" />
                <TextBox Name="localTcpPort"
                         Width="37"
                         Height="23"
                         Margin="0,12,75,0"
                         HorizontalAlignment="Right"
                         VerticalAlignment="Top"
                         LostFocus="localTcpPort_LostFocus"
                         MaxLength="4" />
                <TextBox Name="RemoteTcpPort"
                         Width="37"
                         Height="23"
                         Margin="356,46,0,0"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Top"
                         LostFocus="RemoteTcpPort_LostFocus"
                         MaxLength="4" />
                <Label Name="label9"
                       Width="57"
                       Margin="291,11,0,117"
                       HorizontalAlignment="Left"
                       Content="TCP Port" />
                <Label Name="label11"
                       Width="57"
                       Height="28"
                       Margin="291,49,0,0"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       Content="TCP Port" />
            </Grid>

        </GroupBox>
        <GroupBox Name="groupBox2"
                  Width="504"
                  Height="269"
                  Margin="12,215,0,0"
                  HorizontalAlignment="Left"
                  VerticalAlignment="Top"
                  Header="AudioConfig">
            <Grid Width="486"
                  Height="245"
                  HorizontalAlignment="Stretch"
                  VerticalAlignment="Stretch">
                <Label Name="label6"
                       Width="90"
                       Height="28"
                       Margin="15,30,0,0"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       Content="Source Devices" />
                <Label Name="label7"
                       Width="108"
                       Height="28"
                       Margin="15,89,0,0"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       Content="Sink Devices" />
                <Label Name="label10"
                       Height="28"
                       Margin="15,150,0,0"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       Content="Send Audio Codecs" />
                <ListBox Name="SourceDeviceList"
                         Width="229"
                         Height="52"
                         Margin="150,6,0,0"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Top"
                         ScrollViewer.HorizontalScrollBarVisibility="Auto"
                         ScrollViewer.VerticalScrollBarVisibility="Visible" />
                <ListBox Name="SinkDeviceList"
                         Width="229"
                         Height="53"
                         Margin="150,64,0,0"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Top"
                         ScrollViewer.HorizontalScrollBarVisibility="Auto"
                         ScrollViewer.VerticalScrollBarVisibility="Visible" />
                <Label Name="label8"
                       Width="122"
                       Height="28"
                       Margin="15,211,0,0"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       Content="Receive Audio Codecs" />
                <ListBox Name="SendCodecsNamelistBox"
                         Width="229"
                         Height="55"
                         Margin="150,123,0,0"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Top"
                         ScrollViewer.HorizontalScrollBarVisibility="Auto"
                         ScrollViewer.VerticalScrollBarVisibility="Visible" />
                <ListBox Name="ReceiveCodecsNamelistBox"
                         Width="229"
                         Height="56"
                         Margin="150,183,0,0"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Top"
                         ScrollViewer.HorizontalScrollBarVisibility="Auto"
                         ScrollViewer.VerticalScrollBarVisibility="Visible" />
            </Grid>
        </GroupBox>

        <Button Name="btnStartSend"
                Width="75"
                Height="23"
                Margin="12,490,0,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Top"
                Click="btnStartSend_Click"
                Content="Start Send" />
        <Button Name="btnSaveConfig"
                Width="109"
                Height="23"
                Margin="195,490,0,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Top"
                Click="btnSaveConfig_Click"
                Content="Save Configration" />
        <TextBox Name="StatTextBox"
                 Width="319"
                 Height="461"
                 Margin="522,23,0,0"
                 HorizontalAlignment="Left"
                 VerticalAlignment="Top"
                 Background="Black"
                 FontFamily="Consolas"
                 FontSize="9"
                 Foreground="White"
                 IsEnabled="True"
                 IsReadOnly="True"
                 ScrollViewer.HorizontalScrollBarVisibility="Auto"
                 ScrollViewer.VerticalScrollBarVisibility="Auto" />
        <Button Name="btnStartReceve"
                Width="75"
                Height="23"
                Margin="93,490,0,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Top"
                Click="btnStartReceve_Click"
                Content="Start Receve" />
    </Grid>
</Window>

and this is the exception details

System.Windows.Markup.XamlParseException was unhandled
Message=Cannot create instance of ‘MainWindow’ defined in assembly ‘MediaTransferTester, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Exception has been thrown by the target of an invocation. Error in markup file ‘MainWindow.xaml’ Line 1 Position 9.
Source=PresentationFramework
LineNumber=1
LinePosition=9
StackTrace:
at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)
at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)
at System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message, Exception innerException)
at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
at System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object& element, ReaderFlags& flags, Type& delayCreatedType, Int16& delayCreatedTypeId)
at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()
at System.Windows.Markup.TreeBuilder.Parse()
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at MediaTransferTester.App.Main() in C:\Users\t.said\documents\visual studio 2010\Projects\MediaTransferTester\MediaTransferTester\obj\x86\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Reflection.TargetInvocationException
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
InnerException: System.NullReferenceException
Message=Object reference not set to an instance of an object.
Source=MediaTransferTester
StackTrace:
at MediaTransferTester.MainWindow.RegisterHandlers() in C:\Users\t.said\documents\visual studio 2010\Projects\MediaTransferTester\MediaTransferTester\MainWindow.xaml.cs:line 48
at MediaTransferTester.MainWindow..ctor() in C:\Users\t.said\documents\visual studio 2010\Projects\MediaTransferTester\MediaTransferTester\MainWindow.xaml.cs:line 39
InnerException:

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:25:53+00:00Added an answer on June 9, 2026 at 2:25 pm

    look at the bottom of your inner exception:

    InnerException: System.NullReferenceException Message=Object reference not set to an instance of an object. Source=MediaTransferTester StackTrace: at MediaTransferTester.MainWindow.RegisterHandlers() in C:\Users\t.said\documents\visual studio 2010\Projects\MediaTransferTester\MediaTransferTester\MainWindow.xaml.cs:line 48 at MediaTransferTester.MainWindow..ctor() in C:\Users\t.said\documents\visual studio 2010\Projects\MediaTransferTester\MediaTransferTester\MainWindow.xaml.cs:line 39 InnerException: 
    

    Right there, it looks like your problem is a null reference in your code-behind. MainWindow.xaml.cs line 48. Include your code-behind for that section if you need more help than that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this error in eclipse helios: Exception occurred executing command line. Cannot run
I have this wonderful music library app: beets. When I run beet ls somequery
I have this very unpeculiar exception.The thing is have i have this app that
I'm testing my application as grails run-app. I have read How to remove app
I'm developing an app and have run into a problem with asynchronous calls... Here's
Im trying to develop my first ASP.NET MVC web app and have run into
I have an app that is run from a compiled DLL on a web
So I have an app (tool) that uses .NET 3.0. When run on a
I want do run migration on my app that I have on heroku but
I have a web app I'm making to run off a CMS that is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.