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

Change hardcoded assembly name to reflected assembly name #841

Open
foldax opened this issue Jan 2, 2023 · 6 comments · May be fixed by #842
Open

Change hardcoded assembly name to reflected assembly name #841

foldax opened this issue Jan 2, 2023 · 6 comments · May be fixed by #842

Comments

@foldax
Copy link

foldax commented Jan 2, 2023

There are two places in solution with hardcoded assembly name:

\src\Caliburn.Micro.Platform\ConventionManager.cs	line 66
\src\Caliburn.Micro.Platform\ActionMessage.cs	line 206

This:

    "<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' " +
                           "xmlns:cal='clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro.Platform'> " +
                "<ContentControl cal:View.Model=\"{Binding}\" VerticalContentAlignment=\"Stretch\" HorizontalContentAlignment=\"Stretch\" IsTabStop=\"False\" />" +
            "</DataTemplate>"

should be changed to this:

             "<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' " +
                           $"xmlns:cal='clr-namespace:Caliburn.Micro;assembly={Assembly.GetExecutingAssembly().GetName().Name}'> " +
                "<ContentControl cal:View.Model=\"{Binding}\" VerticalContentAlignment=\"Stretch\" HorizontalContentAlignment=\"Stretch\" IsTabStop=\"False\" />" +
            "</DataTemplate>"

I know it's generally not a mistake, but for some scenarios, second code is much better and currently I'm working on such

@vb2ae
Copy link
Member

vb2ae commented Jan 2, 2023

what platform are you using caliburn.micro with?

@foldax
Copy link
Author

foldax commented Jan 2, 2023

.net 4.8 WPF, so for my scenario changing \src\Caliburn.Micro.Platform\ConventionManager.cs is enough, but it's better to change both

@vb2ae vb2ae linked a pull request Jan 2, 2023 that will close this issue
@vb2ae vb2ae linked a pull request Jan 2, 2023 that will close this issue
@KasperSK
Copy link
Member

@foldax what is the issue with having the assembly name hardcoded?

@foldax
Copy link
Author

foldax commented Jan 12, 2023 via email

@eeevans
Copy link

eeevans commented Mar 21, 2023

This doesn't seem like a common scenario. What is the performance impact? Should this be cached in a static?

@a44281071
Copy link

This is a string template? We can use c# 11 'Raw string literals;';
https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-11#raw-string-literals

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

Successfully merging a pull request may close this issue.

5 participants