EXCEPTION: Object reference not set to an instance of an obj

Using Microsoft Windows Presentation Foundation and Syncfusion WPF Libraries

EXCEPTION: Object reference not set to an instance of an obj

Postby PGilbert on Tue Sep 29, 2015 5:02 pm

If you define the variable 'xaml' with the following in a )CLEAR WS:
Code: Select all
<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
        Title="MainWindow"
        Height="350"
        Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="167*"/>
            <RowDefinition Height="153*"/>
        </Grid.RowDefinitions>
        <syncfusion:SfMaskedEdit HorizontalAlignment="Left" Margin="32,69,0,68"  Text="SfMaskedEdit"  Width="100"/>
        <syncfusion:DoubleTextBox HorizontalAlignment="Left" Margin="32,66,0,0"  Grid.Row="1" Value="0"  Width="100"/>
    </Grid>
</Window>


And then if you execute the following:
Code: Select all
 ⎕USING←'' 'System.IO' 'System.Xml,system.xml.dll'
 ⎕USING,←'System.Windows,WPF/PresentationFramework.dll' 'System.Windows.Markup'
 ⎕USING,←⊂'Syncfusion.Windows.Controls.Input,Syncfusion/4.5/Syncfusion.SfInput.WPF.dll'
 ⎕USING,←⊂',Syncfusion/4.5/Syncfusion.SfShared.Wpf.dll'
 ⎕USING,←⊂'Syncfusion.Windows.Shared,Syncfusion/4.5/Syncfusion.Shared.WPF.dll'

 rootObj←XamlReader.Load ⎕NEW XmlTextReader(⎕NEW StringReader(⊂xaml))

 rootObj.Show

You will get the following error:
Code: Select all
      rootObj.Show
EXCEPTION: Object reference not set to an instance of an object.
      rootObj.Show
     ∧

but if you type again in the session rootObj.Show it will work.

Question: Why it did not work the first time ?

Thanks in advance,

Pierre Gilbert
User avatar
PGilbert
 
Posts: 362
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: EXCEPTION: Object reference not set to an instance of an

Postby Vince|Dyalog on Wed Sep 30, 2015 2:38 pm

Hi Pierre,

I can reproduce this odd behaviour and I've logged it as 12732.

We will investigate.

Regards,

Vince
Vince|Dyalog
 
Posts: 300
Joined: Wed Oct 01, 2008 9:39 am

Re: EXCEPTION: Object reference not set to an instance of an

Postby PGilbert on Thu Oct 01, 2015 11:29 am

Thanks Vince, looking more into it I realized that the SfMaskedEdit is not working at all and is probably the culprit giving us this problem.
User avatar
PGilbert
 
Posts: 362
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: EXCEPTION: Object reference not set to an instance of an

Postby PGilbert on Sun Oct 04, 2015 12:04 am

Following a discussion with Morten I have tried the following and now it is working:

Code: Select all
 ⎕USING←'' 'System.IO' 'System.Xml,system.xml.dll'
 ⎕USING,←'System.Windows,WPF/PresentationFramework.dll' 'System.Windows.Markup'
 ⎕USING,←⊂'Syncfusion.Windows.Controls.Input,Syncfusion/4.5/Syncfusion.SfInput.WPF.dll'
 ⎕USING,←⊂',Syncfusion/4.5/Syncfusion.SfShared.Wpf.dll'
 ⎕USING,←⊂'Syncfusion.Windows.Shared,Syncfusion/4.5/Syncfusion.Shared.WPF.dll'

 rootObj←XamlReader.Load ⎕NEW XmlTextReader(⎕NEW StringReader(⊂xaml))

 app←⎕NEW Application

 {}app.Run rootObj


Looks like some of the Syncfusion controls are expecting to run under an 'Application' object instead of the methods .Show or .ShowDialog

I cannot add some .Resources to the 'Application' object but that will be the subject of another thread.

Thanks Morten
User avatar
PGilbert
 
Posts: 362
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada


Return to WPF & Syncfusion

Who is online

Users browsing this forum: No registered users and 1 guest