-
Notifications
You must be signed in to change notification settings - Fork 798
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
Unexpected error when refencing an F# project from a C# project #16359
Comments
@francotiveron If you try to build the solution, does it still build with the build gesture? Or does that fail too? |
@jasonmalinowski It fails with the same error |
Then can you do a command line build and pass the /bl switch? That'll produce a binary log file that we can investigate further with. That file can potentially contain private info, so if you want to email me the file directly my email is on my GitHub profile. |
msbuild.binlog (481K) sent to your email |
Thanks for sending over the binlog. I see that The NinjaTrader.Core from "C:\Program Files\NinjaTrader 8\bin\NinjaTrader.Core.dll" " is being passed to the compiler. But when P1 was being built the underlying assembly resolution logic did say this:
This makes me think the problem here is there are two versions of NinjaTrader.Core floating around: one has a strong name (PublicKeyToken = 0907d8af90186095) and one does not have a strong name, and those are considered different per assembly resolution logic. The follow up question then is "where did the two copies come from?" Unfortunately your binlog doesn't show a build for P2 or P3 (just that they're up to date), but if you do a clean and build again, does the problem go away? Otherwise we might need a new binlog where not only passing /bl you are also passing /t:Rebuild to force a rebuild. |
(and marking this as Area-Compilers rather than Area-IDE since it's definitely not an IDE problem. I suspect this is still a build going funny in some way though and not really a compiler issue either.) |
Solution Cleaned |
@dotnet/fsharp-team-msft do you think you can take a look at this as a next step of investigation? It seems that the F# assembly is being recorded as having a reference to an assembly with a public key token, but the build shows it's getting the same input as the C# compiler. I don't see where the public key token for the reference is coming from anywhere else, so it almost feels like this is an F# compiler bug (although I don't know how!) |
So how do I fix it? Or is it a bug? |
@francotiveron Don't know yet, but at this point I'm not sure it's a Roslyn issue. We're getting the F# team to take a look. |
I'm not entirely sure how can that happen, but 17.7 ships with quite old compiler, we've had a bunch of fixes since. Does the same issue show with 17.8/17.9? @jasonmalinowski also - isn't Fsc task in binlog showing what was passed to it as reference when msbuild is invoking it? |
Yeah that's why I'm confused. I see the reference going in that looks like it doesn't have a public key token. But later when we try processing the output of it, it seems like output did have one. And to be very clear, I can't explain how the compiler could make a mistake like that, but I'm not seeing any alternative either. :-/ Actually @francotiveron that might be one more thing to ask: can you upload the P2.dll file that gets built? You can upload that here, no reason to email. |
@francotiveron , could I get the binary log file to look at. |
I've shared the logs internally. |
@francotiveron , So ... from the error message it looks as if the F# compiler is writing out the reference to NinjaTrader.Core incorrectly. When compiling P2.dll
Would it be possible for you to provide p1.dll and p2.dll so that I can look at them locally, You can put them in a zip and add them as an attachment to this conversation. It would also be very useful to be able to examine ninjatrader.core.dll, but their terms of use specifically prohibit decompilation So perhaps if you could run these commands on the assembly and provide the output:
and:
It's interesting to me, that the particular public key, has appeared in several issues on the internet, so I harbor the suspicion that whatever we are doing, is a bit more subtle than I outlined above. thanks Kevin Ransom. |
P2.dll attached. P1.dll is not generated because of the error we are dealing with Slight edit .... |
@vzarytovskii now using VS 17.8,2 - error persists |
Okay, I think I understand what is going on here. I believe the ninjatrader.core.dll has been obfuscated, when we import it we think it is a strong signed assembly, even though the dumpbin shows that it is clearly not. I'm guessing the obfuscator zero's out the strong signed flag, and the public key record as well as the KeyFile attribute filename. So the resulting assembly doesn't look quite the same as if it was originally unsigned. When we write out the reference because we thought it was signed when we imported it, we write the assembly reference into P2.dll with the public key set to the bytes we thought represented the public key on import. I don't think this is a regression, it's probably worked this way for a long time. l will try to work on a fix tomorrow, it shouldn't be too tricky. Thanks for persevering with the issue Kevin |
How do I install this version without waiting for an update of Visual Studio? |
@francotiveron, IMO the easiest for you ("works on your machine") only:
After this, if it is all fine:
|
build fails
|
@francotiveron, sorry you are facing issues, I just made a clean build and it comes green: Could you share which VS version you have installed? I ran the command from VS 2022 command prompt and I'm having 17.8 and 17.9 (preview) installed on the machine, just as a disclaimer, this repository generally needs pretty recent version of VS 2022, I sometimes have to update but don't remember if the error is explicit. Your version in this ticket seems rather old, could you try updating your VS 2022 installation and try again, from a VS 2022 developer command prompt so we are on same page? |
@smoothdeveloper I am using VS 17.8.2, the latest non-preview. I have updated the initial post to reflect this. |
Version Used:
Microsoft Visual Studio Professional 2022
Version 17.8.2
VisualStudio.17.Release/17.8.2+34322.80
Microsoft .NET Framework
Version 4.8.09037
Installed Version: Professional
ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools
ASA Service Provider 1.0
ASP.NET and Web Tools 17.8.358.6298
ASP.NET and Web Tools
Azure App Service Tools v3.0.0 17.8.358.6298
Azure App Service Tools v3.0.0
Azure Data Lake Tools for Visual Studio 2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio
Azure Functions and Web Jobs Tools 17.8.358.6298
Azure Functions and Web Jobs Tools
Azure Stream Analytics Tools for Visual Studio 2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio
C# Tools 4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Cookiecutter 17.0.23262.1
Provides tools for finding, instantiating and customizing templates in cookiecutter format.
Extensibility Message Bus 1.4.39 (main@e8108eb)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
File Differ 3.0.49
The easiest way to diff two files directly in Solution Explorer
ILSpy.AddIn 1.0
Integration of the ILSpy Decompiler into Visual Studio.
Microsoft Azure Hive Query Language Service 2.6.5000.0
Language service for Hive query
Microsoft Azure Stream Analytics Language Service 2.6.5000.0
Language service for Azure Stream Analytics
Microsoft Azure Tools for Visual Studio 2.9
Support for Azure Cloud Services projects
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.8.17 (957fbed)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 6.8.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Office Developer Tools for Visual Studio 17.6.34024.01
Microsoft Office Developer Tools for Visual Studio
Python - Django support 17.0.23262.1
Provides templates and integration for the Django web framework.
Python - Profiling support 17.0.23262.1
Profiling support for Python projects.
Python with Pylance 17.0.23262.1
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.
Razor (ASP.NET Core) 17.8.3.2353105+f0a326f3e15b2370371693a76fd379635387c74d
Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools 17.8.119.0
Microsoft SQL Server Data Tools
Text Macros for Visual Studio 2012-2022 1.18
Brings back text-editing macro support in Visual Studio 2012-2022
ToolWindowHostedEditor 1.0
Hosting json editor into a tool window
TypeScript Tools 17.0.20920.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.8.0-beta.23475.2+10f956e631a1efc0f7f5e49c626c494cd32b1f50
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info
Workflow Manager Tools 1.0 1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.
Xamarin 17.8.0.155 (d17-8@7042beb)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.8.3.6 (remotes/origin/d17-8@eccf46a291)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 17.8.16 (830b56a)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 13.2.2.0 (d17-5/45b0e14)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d
Xamarin.iOS and Xamarin.Mac SDK 16.4.0.23 (9defd91b3)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Steps to Reproduce:
1.
Create solution with 3 projects
P2.fsproj
P3.csproj
P1.csproj
Class2.fs
Class3.cs
Class1.cs
Note:
Expected Behavior:
Code should compile without errors
Actual Behavior:
Visual studio complains on the instantiation of Class2 in Class1, but not on Class3; the error is
The text was updated successfully, but these errors were encountered: