Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting System.NullReferenceException: Object reference not set to an instance of an object. at XamlConversion.Parsers.ParserBase.GetTypeFromXName(XName xName) #4

Open
smithah opened this issue Feb 12, 2023 · 1 comment

Comments

@smithah
Copy link

smithah commented Feb 12, 2023

Hi,

Using this source as a reference for converting the .xaml to c#, the xaml string given in the demo app works perfectly , but when i change the xaml string to any other xaml string as given below. Get the null reference error for XAML Type, is it related to dll files that are being loaded by default from GAC ?

Please let me know .

//
string xaml = @"<Activity mc:Ignorable=""sap sap2010"" x:Class=""DisplayMessage_Chash"" sap2010:ExpressionActivityEditor.ExpressionActivityEditor=""C#"" sap:VirtualizedContainerService.HintSize=""721.6,610.4"" sap2010:WorkflowViewState.IdRef=""ActivityBuilder_1"" xmlns=""http://schemas.microsoft.com/netfx/2009/xaml/activities"" xmlns:mc=""http://schemas.openxmlformats.org/markup-compatibility/2006"" xmlns:sap=""http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"" xmlns:sap2010=""http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"" xmlns:scg=""clr-namespace:System.Collections.Generic;assembly=System.Private.CoreLib"" xmlns:sco=""clr-namespace:System.Collections.ObjectModel;assembly=System.Private.CoreLib"" xmlns:ui=""http://schemas.uipath.com/workflow/activities"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"">
<TextExpression.NamespacesForImplementation>
<sco:Collection x:TypeArguments=""x:String"">
<x:String>System.Activities</x:String>
<x:String>System.Activities.Statements</x:String>
<x:String>System.Activities.Expressions</x:String>
<x:String>System.Activities.Validation</x:String>
<x:String>System.Activities.XamlIntegration</x:String>
<x:String>Microsoft.VisualBasic</x:String>
<x:String>Microsoft.VisualBasic.Activities</x:String>
<x:String>System</x:String>
<x:String>System.Collections</x:String>
<x:String>System.Collections.Generic</x:String>
<x:String>System.Data</x:String>
<x:String>System.Diagnostics</x:String>
<x:String>System.Linq</x:String>
<x:String>System.Net.Mail</x:String>
<x:String>System.Xml</x:String>
<x:String>System.Text</x:String>
<x:String>System.Xml.Linq</x:String>
<x:String>UiPath.Core</x:String>
<x:String>UiPath.Core.Activities</x:String>
<x:String>System.Windows.Markup</x:String>
<x:String>GlobalVariablesNamespace</x:String>
<x:String>GlobalConstantsNamespace</x:String>
<x:String>System.Linq.Expressions</x:String>
</sco:Collection>
</TextExpression.NamespacesForImplementation>
<TextExpression.ReferencesForImplementation>
<scg:List x:TypeArguments=""AssemblyReference"" Capacity=""22"">
Microsoft.CSharp
System
System.Core
System.Activities
System.Data
System.Runtime.Serialization
System.ServiceModel
System.ServiceModel.Activities
System.Xaml
System.Activities
Microsoft.VisualBasic
System.Private.CoreLib
System.Data
System
System.Core
System.Xml
System.Xml.Linq
System.Xaml
UiPath.System.Activities
UiPath.UiAutomation.Activities
UiPath.Studio.Constants
</scg:List>
</TextExpression.ReferencesForImplementation>
<Sequence DisplayName=""DisplayMessage_Chash"" sap:VirtualizedContainerService.HintSize=""400,175.2"" sap2010:WorkflowViewState.IdRef=""Sequence_1"">
sap:WorkflowViewStateService.ViewState
<scg:Dictionary x:TypeArguments=""x:String, x:Object"">
<x:Boolean x:Key=""IsExpanded"">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<ui:MessageBox Caption=""{x:Null}"" ChosenButton=""{x:Null}"" AutoCloseAfter=""00:00:00"" DisplayName=""Message Box"" sap:VirtualizedContainerService.HintSize=""356.8,85.6"" sap2010:WorkflowViewState.IdRef=""MessageBox_1"">
ui:MessageBox.Text
<InArgument x:TypeArguments=""x:Object"">
<CSharpValue x:TypeArguments=""x:Object"" sap2010:WorkflowViewState.IdRef=""CSharpValue`1_1"">""Test Message""

</ui:MessageBox.Text>
</ui:MessageBox>

";
////

@smithah
Copy link
Author

smithah commented Feb 12, 2023

Able to sucessfully convert the xaml string in demo given in the code with the attached image, but if i replace it with any other xaml string it throws null XAML type reference.
sucessxaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant