Page 1 of 1

ImageSource throws ArgumentException when content is on separate line

Posted: 20 Nov 2018, 12:08
by KeldorKatarn
Creating an ImageSource resource like this works fine:
<ImageSource x:Key="Image.DNA">pack://application:,,,/HelloWorld;component/Assets/NoesisGUI/HelloWorld/Resources/Images/DNA.jpg</ImageSource>
if I use a tool like XAMLStyle to reformat the code, which ends up looking like this:
<ImageSource
    x:Key="Image.DNA">
    pack://application:,,,/HelloWorld;component/Assets/NoesisGUI/HelloWorld/Resources/Images/DNA.jpg
</ImageSource>
I get this:
ArgumentException: Illegal characters in path.
System.IO.Path.IsPathRooted (System.String path) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
System.IO.Path.InsecureGetFullPath (System.String path) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
System.IO.Path.GetFullPath (System.String path) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
NoesisPostprocessor.NormalizePath (System.String uri) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:124)
NoesisPostprocessor.AbsolutePath (System.String parent, System.String uri) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:152)
NoesisPostprocessor.ScanTexture (System.String directory, System.String text, System.String extension, System.Collections.Generic.HashSet`1[T] textures) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:201)
NoesisPostprocessor.ScanTextures (NoesisXaml xaml, System.String directory, System.String text) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:220)
NoesisPostprocessor.ScanDependencies (NoesisXaml xaml, System.String directory) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:311)
NoesisPostprocessor.ImportXaml (NoesisXaml xaml, System.String directory, System.IO.FileStream file) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:323)
NoesisPostprocessor.ImportXaml (System.String filename) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:336)
NoesisPostprocessor.ImportAssets (System.String[] assets, NoesisPostprocessor+UpdateProgress d) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:67)
NoesisPostprocessor.OnPostprocessAllAssets (System.String[] importedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetPaths) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:82)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets) (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:140)

Re: ImageSource throws ArgumentException when content is on separate line

Posted: 22 Nov 2018, 18:19
by sfernandez
That is clearly a bug in our parser, could you please report it in the bugtracker?
We recently did some changes to our Uri parser for the next release that could have solved that, anyway is better to have it as a ticket to better keep track of the problem.