I've upgraded from ReSharper 7 on vs2012 pro to ReSharper 8.1 on vs2013 pro, and ReSharper is now warning me a lot of my partial views cannot be resolved.
It seems to be only happening:
In ASP master pages (i.e. not razor)
When the .ascx partial is in the same controller folder as the partial
E.g. Home.Master, located in ~/Views/Home/Home.Master renders UserProfile.ascx, located in ~/Views/Home/UserProfile.ascx.
Both <%: Html.RenderPartial("UserProfile") %> and <%: Html.RenderPartial("~/Views/Home/UserProfile.ascx"%> are flagged by ReSharper as invalid.
Additionally, shared partials in the ~/views/shared folder seem to be picked up fine when I reference just by name:
However, referencing the view by path doesn't seem to work:
(NB. Both images are taken inside Home.Master, in ~/Views/Home)
When I run the application, the partials work correctly, so it seems to be a change in ReSharper 8.1. Is there anything I can do to fix this?
It's a bug in ReSharper.
The best thing for now is to set it to ignore this type of error.
You can do this by selecting 'inspection options' from the 'red light bulb' on the left hand side and setting it to another option. Hopefully it will be fixed soon!
Edit: See this ticket for the problem. http://youtrack.jetbrains.com/issue/RSRP-395642
There's a simpler fix I've got around it by using relative references. So in my case I had a view in another project (and if you try to go outside of the current project without starting with a forward slash "/" you'll get a warning like this. For your problem change the line that reads
<%Html.RenderPartial("UserProfile")%>
to
<%Html.RenderPartial("../../Views/Home/UserProfile")%>
or
<%Html.Partial("../../Views/Home/UserProfile.cshtml")%>
Not sure if this is the exact path in your solution but hopefully you understand what I am saying - you cannot use the tilde (~) symbol. You have to use HTML's navigation symbol. Not ideal obviously but I dare say it is better than changing inspection rules.
Also - if you do need to remove an inspection, just comment it out by adding the line
// ReSharper disable once Mvc.PartialViewNotResolved
... // code goes here
or
// ReSharper disable Mvc.PartialViewNotResolved
... // code goes here
// ReSharper restore once Mvc.PartialViewNotResolved
You can use T4 templates POCO string properties to generate the paths. It's a good idea to update these T4 generated classes regularly and use them inside your code.
I was getting this error today from ReSharper 2018.2.3 when did this:
#Html.Partial("_StatusMessage", Model.StatusMessage)
I also noticed a warning from the IHtmlHelper.Partial method itself:
Use of IHtmlHelper.Partial may result in application deadlocks. Consider using <partial> Tag Helper or IHtmlHelper.PartialAsync.
So I changed the code to:
<partial name="_StatusMessage" model="Model.StatusMessage" />
That fixed it for me.
Related
I am trying to add a custom block. I followed the steps in following two links:
http://piranhacms.org/docs/extensions/blocks
and
http://piranhacms.org/docs/manager-extensions/resources
In the CMS manager, I added the custom block to a page, but the block content is empty. Looks like the Vue.js didn't get associated to the custom block. I have set the block component attribute to the Vue.js.
I added the Vue.js by calling below method in the startup. Did I miss something to create a custom block?
App.Modules.Get<Piranha.Manager.Module>().Scripts.Add("~/assets/js/myscripts.js");
Move your "mycustomblock.js" file to the folder "wwwroot/js/" instead of the default "assets/js/". That way the file will be visible to Vue.js
Something is not working with the assets folder, probably it cannot be reached by Vue.js
after the Project is compiled. I had the same problem and this solution worked for me.
void Configure in Startup.cs will then look something like this (I simplified the syntax a bit compared to the documentation):
App.Modules.Manager().Scripts.Add("~/js/mycustomblock.js");
Adding a custom block and many other tasks have been difficult for me. Trial and error, and no knowledgebase to fall back on. The documentation is a fantastic start, and "Step by step" guides would be a good idea for the future (but I guess time is very limited).
Moving and copying some files, now I have this exception on my project, used to work fine.
The thing is that this failing project is a copy of another one, that is working fine, so every critical file inside i´m sure it´s ok.
web.config --> from solution is ok.
web.config --> from views is ok.
viewStart --> ok.
I found out the fix for this, so if you have the same problem than me even if you did what other posts said about adding razor sections to the config, check this solution.
Regards!.
Ok. So I´m assuming that you have all your configs ok, and all of the DLLs ok and updated.
If you did all of that and still having the exception, try to check and DOUBLE check if you don´t have any undesired "_viewStart" files placed somewhere wrong, and also check if is not excluded from solution.
In my case, this was the problem: I removed wrong "_viewStart" that I copied by mistake and the web start working again.
I´m sure that most of scenarios that everybody has this exception is caused by moving this file to another folder or creating a new one.
try it!
hope it helps.
Regards.
I have an issue with App.xaml in a Silverlight 5 application project. Basically, I can remove everything (resources inside <Application.Resources>, such as styles and converters) from it, until I am left with only this:
<Application x:Class="SomeProject.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</Application>
But Visual Studio 2013's Error List window will still list below three (ignorable) design-time errors:
The property "Resources" can only be set once. (App.xaml, Line 1, Column 1)
The "Key" attribute can only be used on an element that is contained in "IDictionary". (App.xaml, Line 1, Column 1)
The specified value cannot be assigned. The following type was expected: "ResourceDictionary". (App.xaml, Line 1, Column 1)
These are purely design-time errors; I can successfully compile and run the project. However, the errors don't make any sense, and they are annoying.
Does anyone know how to get rid of them?
Some things I've tried already:
Cleaning and rebuilding the whole solution.
Manually wiping the App.g.i.* files in the obj artifact directory.
Manually deleting the obj and bin directories.
I made sure that App.xaml is in the main Silverlight application project (not in some other class library); and there is no other project item of type "ApplicationDefinition".
Ah the joys of Silverlight development... While I don't have a completely competent technical answer to your question, I've found that restarting your machine can do magical things (I know, no true developer ever wants to hear the word "magical" in a fix) but one could assume there's a caching issue somewhere...
However the point is restarting can often clear up erroneous errors related to build time resources that you would normally expect a quick clean to fix.
Anyhow, glad you got a remedy. Cheers!
I've just installed mogenerator using one of tutorials. I have added run script to my new target, and clicked Cmd+B. I should get some new files, but i didn't. In my .xcdatamodeld i have 2 entities (User and Repos). Below you can find my print screen of my project.
Where is the problem in my thinking? What should i do more? Please, help me, because i haven't found the solution on the web yet.
This all looks fine (judging by your screenshot).
One thing to check - which caused me the same issue - is that, when you've created your Entities in the xcdatamodelId file, make sure that you click on the Data Model Inspector icon, and that each entity has a Name value, and a matching "Class" value.
Miss out the Class name, and nothing will get generated.
Btw, when you click on Build, do you get a "Build succeeded" message ?
Here's the tutorial I followed to get mogenerator working:
RaptureInVenice
I should say, I've used mogenerator in a few projects, and this command line bit is always the piece that gives me trouble. Sometimes, I have to select my xcdatamodelId file, and create a new Version of it, before mogenerator will use it. But once it is working, it's a blessing.
Anything to avoid having to use the needlessly over-complicated CoreData stuff.
Someone should remind Apple that it's 2014...
On the safari browser, the standard <asp:Menu> doesn't render well at all. How can this be fixed?
Thanks for the advice, it led me into the following solution;
I created a file named "safari.browser" and placed it in the App_Browsers directory. The content of this file is shown below;
<browsers>
<browser refID="safari1plus">
<controlAdapters>
<adapter controlType="System.Web.UI.WebControls.Menu" adapterType="" />
</controlAdapters>
</browser>
</browsers>
As I understand it, this tells ASP.NET not to use the adaptor it would normally use to render the control content and instead use uplevel rendering.
You can use ControlAdapters to alter the rendering of server controls.
Here's an example:
http://www.pluralsight.com/community/blogs/fritz/archive/2007/03/27/46598.aspx
Though, in my opinion it might be equal amount of work to abandon the menu control for a pure css one (available on many sites).
Oooof - was hoping it would be a simmple case of adding a browserCaps item in web.config with appropriate values or similar...
The best and simplest solution I've found for this problem is to include this bit of code in your page_load event.
if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
Request.Browser.Adapters.Clear();