Anybody know how to prevent this?


  • BINNED

    0_1504784981050_43290179-d253-4193-a45e-daa269e1fd32-image.png

    On an ASP.net VB webforms project, I get hundreds of "errors" that indicate the codebehind isn't properly hooked up to the aspx files. They disappear a few seconds after opening each page, but I can easily have 600 of these spread across multiple files, which makes finding actual errors a shitty process of:

    • double clicking an error
    • closing the file
    • waiting for the 5-100 errors that come from that page to disappear from the log
    • repeat until the errors are all gone

    If this was only on first opening the solution, I wouldn't mind too much but they come back throughout the day (possibly after rebuilding?)

    I know I can change the dropdown from entire solution to open documents, but that doesn't help when I do something like changing a method signature and have to edit everything that touches it

    This is in Visual Studio 2015, but the project did the same in 2012 as well


  • SockDev

    @jaloopa I wish there was a way. However, I fear the only solution is for MS to fix it.



  • @jaloopa What happens if you build before opening any forms editor windows? Do you still get the errors?

    @jaloopa said in Anybody know how to prevent this?:

    I know I can change the dropdown from entire solution to open documents, but that doesn't help when I do something like changing a method signature and have to edit everything that touches it

    Manually, or using the built-in refactoring tools?

    Also since it causes all sorts of awful bugs, I have to ask: are you using ReSharper?


  • BINNED

    @blakeyrat said in Anybody know how to prevent this?:

    Manually, or using the built-in refactoring tools?

    Manually. There are limits to what auto refactoring can do when you add a parameter and need to decide on the value for each call

    @blakeyrat said in Anybody know how to prevent this?:

    Also since it causes all sorts of awful bugs, I have to ask: are you using ReSharper?

    No. Never been installed on this computer



  • @jaloopa You skipped my first question. I thought the error might appear for the forms editor when it's doing its reflection magic to display the end-result of the form on the screen, but honestly I don't know why it's happening. (And natch, I've never seen it in my own WinForms projects, but they're all C#.)

    But if you can narrow down the bug to not involving the forms editor at all, it might help find the cause. I mean, presumably none of these errors occur when manually calling msbuild from a CLI, right?

    EDIT: on that note, it might also help to see if the problem occurs with the build set on Debug, Release, or both.


  • BINNED

    @blakeyrat said in Anybody know how to prevent this?:

    You skipped my first question

    Oh, sorry. Managed to miss that.

    Opening the solution with no forms open and building gives no errors. If I run it, I get 2190 errors, possibly the highest I've seen.

    Running build or rebuild doesn't actually fail.

    ========== Rebuild All: 3 succeeded, 0 failed, 27 skipped ==========

    That's with the 2000 errors shown. Similarly, I can run the solution fine with these errors polluting the error window.

    Probably related, changing the "build + intellisense" dropdown shows they're all intellisense errors



  • @jaloopa said in Anybody know how to prevent this?:

    Probably related, changing the "build + intellisense" dropdown shows they're all intellisense errors

    Have you tried all the suggestions at this link: https://stackoverflow.com/questions/7674574/handles-clause-requires-a-withevents-variable-defined-in-the-containing-type-or

    I'm kind of stumped, but at least we've narrowed the problem down.


  • BINNED

    @blakeyrat I think I did encounter that answer when I looked for solutions a while back, but everything is assuming it's a build blocking issue rather than just clogging the error list window.

    That's also not the only error that comes up. Lots of foo is not defined. It may be inaccessible due to its protection level on accessing controls reclared in the aspx as runat="server". Those ones also disappear on opening the aspx.vb file

    I have just noticed that the documentation on withevents only goes up to VS2008. That could mean the handles stuff is ridiculously out of date and should be replaced by onclick="..." stuff in the aspx, which would be a bit of a ballache but doable



  • There are some VB specific strange aspects that you may be running into. Without a (minimal) set of source files it can be virtually impossible to determine which one.

    Errors can appear when files are open that are not part of the build per se. The IDE is attempting to dynamically build the open file in the context of the current solution. In these cases [presuming nothing else is broken] the most likely cause is that it can not find the .designer.vb file that is associated with the form.

    Other items which can cause problem include copy/cut and paste of controls between containers.

    Feel free to Chat me if you want to dig into some more details, and then (if found) a solution could be posted back here....


  • BINNED

    @thecpuwizard said in Anybody know how to prevent this?:

    Errors can appear when files are open that are not part of the build per se

    That's the weird thing, though. They disappear when the files are open. I think it must be something to do with intellisnese trying to scan the whole project but things not being properly linked when the page isn't fully built.

    Another probably relevant aspect: the website isn't precompiled. It's using some weird configuration that means you deploy the VB files rather than a dll, and it's effectively run as an interpreted application.



  • @jaloopa said in Anybody know how to prevent this?:

    It's using some weird configuration that means you deploy the VB files rather than a dll

    Is it a "Web Site" project or a "Web Application" project.... The latter has been recommended for a very long time: https://msdn.microsoft.com/en-us/library/dd547590(v=vs.110).aspx?f=255&MSPPError=-2147217396


  • BINNED

    @thecpuwizard A web site. That decision was made by the outsourced company who originally wrote it, and it's probably too late to change it now.

    Also:

    You like to keep your source code on the production server because it can serve as an additional backup copy.

    :wtf:? Is there really anyone who chooses a project type based on that criterion?



  • @jaloopa said in Anybody know how to prevent this?:

    Is there really anyone who chooses a project type based on that criterion?

    Probably big fans of Classic ASP who only went into the .NET era kicking and screaming.



  • @jaloopa said in Anybody know how to prevent this?:

    and it's probably too late to change it now.
    Also:

    In general it is usually not too hard to change, often the biggest problem is getting approval. Of course, having some type of automated system tests to catch problems is quite helpful, but likely non-existent or limited.

    One word of caution...Many "older things" are being pruned from the Microsoft eco-system, and elements are reaching their End of Life for support. Of course, you may stay in an archaic unsupported environment, but that is generally not recommended - and can sometimes be the leverage for change...

    Good Luck!


  • Impossible Mission Players - A

    I seem to have the exact opposite problem in my MVC 5 app, in which issues with cshtml files (usually caused by changing the DB models) don't get detected at any time until I open the file.

    But then, I don't think the cshtml files get compiled into the dll in whatever mode it's in, so :man_shrugging_tone3:


  • And then the murders began.

    @tsaukpaetra said in Anybody know how to prevent this?:

    I seem to have the exact opposite problem in my MVC 5 app, in which issues with cshtml files (usually caused by changing the DB models) don't get detected at any time until I open the file.

    But then, I don't think the cshtml files get compiled into the dll in whatever mode it's in, so :man_shrugging_tone3:

    They don't get compiled into the DLL by default, no.1

    You can have MSBuild run the compiler on any ASP.NET views/pages/controls during build.

    1 If you really want to get them in the DLL, you can set your views up as embedded resources and provide a VirtualPathProvider that pulls them from the resources instead of the file system. But there's no good reason to do that. And I'm not sure that would get you the compile time checking you want anyways without invoking AspNetCompiler per above...


  • Impossible Mission - B

    @blakeyrat said in Anybody know how to prevent this?:

    Also since it causes all sorts of awful bugs, I have to ask: are you using ReSharper?

    ???

    I've never seen R# cause "all sorts of awful bugs." What sort of things have you seen?



  • @masonwheeler said in Anybody know how to prevent this?:

    I've never seen R# cause "all sorts of awful bugs." What sort of things have you seen?

    Every time I hit "Build" on our medium-sized web app, VS would just sit there doing literally nothing for 45 seconds. Turning off ReSharper? Suddenly it built right away with no delay.

    That and crashes. Whenever someone says "man I hate how much VS crashes" ask if they use ReSharper, they inevitably do.



  • @blakeyrat

    I personally use DevExpress CodeRush, and I find that to be quite stable. Never had any major issues with it (the one issue I did have I reported, and it was fixed in the next release). I tried R# once, and saw what you describe. R# is good in theory, but in practice, meh.


  • BINNED

    Does resharper even still do anything that visual studio hasn't added in the base product?



  • @jaloopa said in Anybody know how to prevent this?:

    Does resharper even still do anything that visual studio hasn't added in the base product?

    If is a constant game of leap frog. So the question isn't "is there anything it does?", but "are the things it does useful/important to me?"

    I tend to find the answer to be yes the stuff is useful. I also tend to have very few problems (not zero) largely because of the way I structure my solutions (which is something that is also subjective)....



  • @blakeyrat said in Anybody know how to prevent this?:

    I've never seen R# cause "all sorts of awful bugs." What sort of things have you seen?

    Every time I hit "Build" on our medium-sized web app, VS would just sit there doing literally nothing for 45 seconds. Turning off ReSharper? Suddenly it built right away with no delay.
    That and crashes. Whenever someone says "man I hate how much VS crashes" ask if they use ReSharper, they inevitably do.

    I remember using resharper during VS2005 - VS2010 era, where it really added a lot of missing functionality. But MS has been busy, and they've pretty much caught up feature-wise. IMO there's little reason to install resharper in modern Visual Studios, other than habit.

    Even JetBrains has seen which way the wind is blowing, as they took resharper and shoved it into its own IDE, Rider. I have yet to try it, though. My initial attempt was stymied by .NET Core's total inability to work reliably on my linux VM.



  • @cartman82 I think even in its "golden age" it was still too ugly and buggy to make up for the admittedly useful functionality it added.

    But yes, now it's ridiculous. If you run unit tests in the ReSharper test runner (which is has, for some reason?) it takes literally 4 times longer than VS' test runner. Once you actually start looking at that, you'll disable more and more of ReSharper until there's nothing of it left.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.