question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect template key when using constructor that takes assembly

See original GitHub issue

When I’m using the constructor of EmbeddedRazorProjectItem it’s setting the template key to assembly.GetName().Name, which will not include the namespace. So the embedded views aren’t found, and there’s no way to override it.

I believe the issue is in this line: https://github.com/toddams/RazorLight/blob/744f545227083f17c63bcdef989bd5c2017ef53b/src/RazorLight/Razor/EmbeddedRazorProjectItem.cs#L23

There is also an issue that both the RootNamespace and Assembly properties that are exposed in the class have the setter exposed, but changing them won’t do anything, the fullTemplateKey is only set in the constructor.

Suggested fixes:

  1. Fix the constructor that takes an assembly so the full namespace is included, or require the root namespace to be specified (and overriding the full key)
  2. Either remove the settings on the properties, or implement it properly so setting them will change the fullTemplateKey.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jzabroskicommented, Jan 14, 2020

If I reformatted everything could you re-do the PR after that.

0reactions
RickFrankelcommented, Feb 11, 2020

Can this PR be merged please. This is a major bug for us using this library. We have no way around this particular issue that I can find at the moment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

templates, function uses wrong constructor to copy my object
I created a class template that initializes a simple array using the parameter pack expansion and the class has a copy constructor for...
Read more >
c++ - Problem using template with Default constructor.
This is supposed to be a constructor... I assume that if I create a new class using code: new vector(); then it should...
Read more >
Java Method/Constructor in Class Cannot be Applied to ...
This error is triggered by a method call attempted with the wrong number, type, and/or order of arguments. Arguments are the actual data...
Read more >
[accepts invalid] binding template template arguments with ...
[accepts invalid] binding template template arguments with mismatched signatureUnder ... {}; template typename Templ> using S = int; using T = template_;.
Read more >
An Idiot's Guide to C++ Templates - Part 1
Here we use the keyword template to let compiler know that we are defining a function template. Function Templates. Here is the templated ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found