Skip to content

[design-time only] Assembly reference was not found or is invalid #3221

Closed

Description

@0x53A

This is only an issue at design time, build is ok.

image

The file exists on disk, and was built by a different (C#) project in the same solution.

image

image

Activity

  1. dsyme commented on Jun 19, 2017

    @dsyme
    Contributor

    @0x53A We'll need a step-by-step repro for this. Does rebuilding the project succeed?

    It could also be a manifestation of #3047

  2. 0x53A commented on Jun 19, 2017

    @0x53A
    ContributorAuthor

    @dsyme Yeah, thats the great thing about this and #3054 (comment), it's not reproducible in a small isolated project.

    Build and Rebuild work fine, but do not clear the error.

  3. 0x53A commented on Jun 19, 2017

    @0x53A
    ContributorAuthor

    I have this and #3054 (comment) in a base-lib which depends on 5 other projects. If I remove everything except these five projects from the solution, then the error stops happening, even though there should be no change from the view of these projects.

    For me it looks like something completely unrelated in the solution fucks VS up.

    The whole solution has ~60 projects, so I'm not going to try all permutations and check which of these causes this.

    For now I'm dropping VS and using Rider, not because of this bug, but because of #3054 (comment), which now happens always.

  4. dsyme commented on Jun 19, 2017

    @dsyme
    Contributor

    Build and Rebuild work fine, but do not clear the error.

    Did you check if switching between "Build" and "Build + Intellisense" clears the error?

    Re #3054 (comment) it feels likes this should be tracked by a separate bug.

  5. 0x53A commented on Jun 19, 2017

    @0x53A
    ContributorAuthor

    Did you check if switching between "Build" and "Build + Intellisense" clears the error?

    Yes and No. It is visible in the "Error List" for either "Intellisense Only" or "Build+IntelliSense", but is always visible as a red squiggle in the document at location (0,0). Switching does not affect the squiggle in the document.


    My previous remark

    The file exists on disk, and was built by a different (C#) project in the same solution.

    is not completely true: when VS was started, the file did not yet exist (if the solution was built before opening, I hit #3222), but building the project does not clear the squiggle.

  6. reopened this on Jun 19, 2017
  7. plainionist commented on Aug 7, 2017

    @plainionist

    hi,

    seems I have similar (same?) use with my project here: https://github.com/plainionist/Plainion.Windows revision 0af9a48.
    i tried endless things of clean + rebuild, changing .net version, updating fsharp.core .... the only "workaround" which i was able to apply successfully after several reopens of VS was to unload the fsharp project again and reload it after 2-4 seconds. (i have only one fsharp project among 3 c# ones).

    hope that helps ...

    regards,
    seb

  8. added
    Impact-Medium
    and removed on Aug 8, 2017
  9. dsyme commented on Aug 8, 2017

    @dsyme
    Contributor

    @plainionist OK, thanks, we will try your repro

  10. 0x53A commented on Aug 22, 2017

    @0x53A
    ContributorAuthor

    Now it repros reliably:


    Repro steps

    Solution1.zip

    • Load the solution. It contains one F# lib that references a C# lib. (this repros with any project for me, just create two new libs)
    • Open Library1.fs

    image

    • Build the solution
    • Still the same error
    • Restart VS
    • Everything OK
    • Clean Solution
    • Restart VS
    • Same Error

    Note: I think you always needed to build the C# project before F# recognized it, but it should not require a reload of the solution.

    Known workarounds

    Build + Restart VS (or just reload the F# project)

    Related information

    Provide any related information

    • Operating system: Win10
      image
      image
  11. 9 remaining items

  12. jzabroski commented on Oct 18, 2019

    @jzabroski

    Closing the solution in VisualStudio (without closing VisualStudio) appears to fix the problem. You can then safely re-open the solution.

    Probably the right way to fix this is to use .NET Core AssemblyLoadContext and load the entire F# toolchain inside a context, and hook any critical exceptions as a clue to unload the context and reload it. I'm not sure if DevENV supports such logic, but it seems in 2016 .NET added support for .NET Core global exception handlers. -- It's not clear how that works and how the DevENV would know "oh crap, F# died, need to reload" although maybe the "object sender" property or the EventArgs might contain clues.

  13. jzabroski commented on Oct 18, 2019

    @jzabroski

    @dsyme I suggest the simplest way to try to repro this problem is to load a "toxic alpha" verison of F# Plug-in into Visual Studio that crashes on any function named jzabroski (or similar). I think this will demonstrate the design-time only aspect of this bug.

  14. jzabroski commented on Oct 18, 2019

    @jzabroski

    I think I put together exactly what happens in my case.

    1. I'm right - Quick Watch can cause an unhandled exception, which appears to leave the F# engine in an unknown state
    2. I'm also right - when the engine is in an unknown state, the F# <-> C# bridge tooling seems to die, causing compile errors to appear around F# code calling c# code, especially if the c# code is a static class
  15. jzabroski commented on Dec 19, 2019

    @jzabroski

    @cartermp As per discussion on Twitter, just beeping a horn. Please don't add me to github-drama :)

  16. cartermp commented on Dec 20, 2019

    @cartermp
    Contributor

    @jzabroski Thanks, I think there are two or more separate issues based on what you're describing.

  17. cartermp commented on Dec 20, 2019

    @cartermp
    Contributor

    Just to clarify, are these valid for VS 2019 Update 16.4.?

  18. jzabroski commented on Dec 20, 2019

    @jzabroski

    Most likely. Definitely for 16.3.8 (I think) - I try not to touch the F# project as its a time sink. FWIW, These "basic compilation doesn't work smoothly" issues have only gotten worse and worse over time. It used to be the thing that would piss off my engineers is that the bootstrap of the FSharp.Core.dll and Tools from C# would cause weird nuget restore errors (my favorite was when the nuget package for the version we were using was somehow deleted). Then it precipitated into random runtime crashes while debugging.

    I'm not an F# expert, but I also noticed other weird things with F# IntelliSense that I could not understand based on the documentation. In particular, sometimes the tooltip that displays type inference would change the order of the expression. Maybe that's an expected behavior, but it went away when I added type annotations.

  19. jzabroski commented on Dec 20, 2019

    @jzabroski

    @cartermp Also verified I am not utilizing Resharper's Build Speed-up tool (I only use its refactoring engine).

    image

  20. jzabroski commented on Dec 20, 2019

    @jzabroski

    I did some tests for you - it does seem a bit more stable. Can I ask if you have any regression tests against things like referencing a c# static (or instance) class in the same project (not a nuget package).

    namespace CSharp.FooBarProject.Legacy.CustomEntities
    {
      public class FooBarMetadata
      {
        public int Id {get;set;}
      }
    }
    open CSharp.FooBarProject.Legacy.CustomEntities
    
    let GetRatioNonStandardlyFooBarsUpdateFun (nonStandardlyFooBars : NonStandardlyFooBar list) 
                                                   (clientSpecificFooBarRatios : ClientSpecificFooBarRatio list)
                                                   (fooBarMetadata : CSharp.FooBarProject.Legacy.CustomEntities.FooBarMetadata) // this would cause problems, especially if referenced without fully qualified namespace+class
                                                   (defaultPercent : float)
                                                   (fooBarTypes : NonStandardFooBarType list)
                                                   (executionContext : ExecutionContext) =
  21. added
    Area-LangService-ToolTips
    and removed on Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-LangService-ToolTipsBugImpact-Medium

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions