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

Preview does not work properly #417

Closed
madyyk opened this issue Aug 26, 2024 · 7 comments
Closed

Preview does not work properly #417

madyyk opened this issue Aug 26, 2024 · 7 comments
Assignees
Labels
kind:bug Something isn't working status:waiting-for-info The maintainers are waiting for the additional information from the issue reporter

Comments

@madyyk
Copy link

madyyk commented Aug 26, 2024

The preview doesn't work properly. It works on certain files but not on others..

AvaloniaRider 1.4.0
Avalonia 11.1.0
dotnet 8.0

This doesn't work:

<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:pages="clr-namespace:myprj.View.Pages"
             mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="450"
             x:Class="myprj.View.Pages.AddRecord"
             x:DataType="pages:AddRecord">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="127"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        
        <TextBox Name="myTb" IsVisible="False"/>
        
        <ContentControl Name="TabContentArea" Grid.Column="0"/>
        <ContentControl Grid.Column="1" x:Name="AddRecordContent"/>
        <ContentControl Name="ContentArea" Grid.Column="1" />
    </Grid>
</UserControl>

This DOES work

<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="myprj.View.Pages.NoPermissionAssigned">
    <Grid>
        <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="30" Text="Sometext." Foreground="White"/>
    </Grid>
</UserControl>

Preview log:

Initializing application in design mode
Obtaining AppBuilder instance from myprj.Program
Sending StartDesignerSessionMessage

@ForNeVeR
Copy link
Owner

Both seem to work for me. Could you please define "doesn't work"? The former is supposed to show a white screen, and it does so.

@ForNeVeR ForNeVeR added status:waiting-for-info The maintainers are waiting for the additional information from the issue reporter kind:bug Something isn't working labels Aug 26, 2024
@madyyk
Copy link
Author

madyyk commented Aug 27, 2024

It simply doesn't show up

image

@ForNeVeR
Copy link
Owner

Please attach the IDE logs.

@madyyk
Copy link
Author

madyyk commented Aug 27, 2024

Which logs are you exactly looking for? So I don't share my info with everyone.

@ForNeVeR
Copy link
Owner

Let's start from lines containing WARN and SEVERE from the idea.log (see Help → Diagnostic Tools → Collect Logs).

@madyyk
Copy link
Author

madyyk commented Aug 27, 2024

Im attaching the log file

idea.log

@ForNeVeR
Copy link
Owner

This seems to be a problem:

2024-08-27 19:57:41,419 [ 126535]   WARN - #me.fornever.avaloniarider.idea.editor.BitmapPreviewEditorComponent - XAML update error: InvalidOperationException: Cannot compile Build method. Parameters mismatch.Type needs to have a parameterless ctor or a ctor with a single IServiceProvider argument.Or x:Arguments directive with matching arguments needs to be set
System.InvalidOperationException: Cannot compile Build method. Parameters mismatch.Type needs to have a parameterless ctor or a ctor with a single IServiceProvider argument.Or x:Arguments directive with matching arguments needs to be set
   at XamlX.IL.XamlILCompiler.CompileBuild(IFileSource fileSource, IXamlAstValueNode rootInstance, IXamlTypeBuilder`1 declaringType, IXamlILEmitter codeGen, XamlRuntimeContext`2 context, IXamlMethod compiledPopulate)
   at XamlX.Compiler.XamlImperativeCompiler`2.Compile(XamlDocument doc, IXamlType contextType, IXamlMethodBuilder`1 populateMethod, IXamlTypeBuilder`1 populateDeclaringType, IXamlMethodBuilder`1 buildMethod, IXamlTypeBuilder`1 buildDeclaringType, IXamlTypeBuilder`1 namespaceInfoBuilder, String baseUri, IFileSource fileSource)
   at Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.AvaloniaXamlIlCompiler.Compile(XamlDocument document, XamlDocumentTypeBuilderProvider typeBuilderProvider, String baseUri, IFileSource fileSource)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.<>c__DisplayClass16_0.<LoadGroupSreCore>b__0(XamlDocumentResource document)
   at System.Linq.Enumerable.SelectListIterator`2.Fill(ReadOnlySpan`1 source, Span`1 destination, Func`2 func)
   at System.Linq.Enumerable.SelectListIterator`2.ToArray()
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadGroupSreCore(IReadOnlyCollection`1 documents, RuntimeXamlLoaderConfiguration configuration)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSreCore(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSre(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.Load(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration)
   at Avalonia.Designer.HostApp.DesignXamlLoader.Load(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration)
   at Avalonia.DesignerSupport.DesignWindowLoader.LoadDesignerWindow(String xaml, String assemblyPath, String xamlFileProjectPath, Double renderScaling)
   at Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.<>c.<OnTransportMessage>b__17_0(Object arg)

Previewer cannot find a constructor for something. This is not a plugin issue.

The plugin issue, though, is that we aren't currently showing any errors from previewer (since #203). In that issue, we've overestimated the number of issues the in-editor error highlighting would catch, so I have plans to return the visible errors into the preview in a less intrusive way (#316).

@ForNeVeR ForNeVeR closed this as not planned Won't fix, can't repro, duplicate, stale Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Something isn't working status:waiting-for-info The maintainers are waiting for the additional information from the issue reporter
Projects
None yet
Development

No branches or pull requests

3 participants
@ForNeVeR @madyyk and others