Skip to content
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

Compilation error of script (ambiguous reference) #246

Closed
dilvid83 opened this issue Aug 14, 2024 · 2 comments
Closed

Compilation error of script (ambiguous reference) #246

dilvid83 opened this issue Aug 14, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@dilvid83
Copy link

I've not looked into the NetPad code yet but pretty sure I know what it is and how to solve it. I think we need to fully qualify all functions within the NetPad app itself. We get an error when trying a simple script after bringing in some Nuget Packages. It's a simple 'ambiguous reference' error but obviously stops us using certain packages. So far I've only found one nuget package which causes this but haven't been looking.

If you bring in 'FuzzySharp' and do a simple script like the following...

var productName1 = "";
var productName2 = "";

Fuzz.Ratio(productName1, productName2).Dump();

You will get the following error when 'Play' is pressed.

Compilation failed:
(434,9): error CS0104: 'Process' is an ambiguous reference between 'System.Diagnostics.Process' and 'FuzzySharp.Process'
(437,29): error CS0104: 'Process' is an ambiguous reference between 'System.Diagnostics.Process' and 'FuzzySharp.Process'
(438,27): error CS1061: 'Process?' does not contain a definition for 'EnableRaisingEvents' and no accessible extension method 'EnableRaisingEvents' accepting a first argument of type 'Process?' could be found (are you missing a using directive or an assembly reference?)
(445,13): error CS0019: Operator '!=' cannot be applied to operands of type 'Process?' and '<null>'
(447,27): error CS1061: 'Process?' does not contain a definition for 'Exited' and no accessible extension method 'Exited' accepting a first argument of type 'Process?' could be found (are you missing a using directive or an assembly reference?)

Raising to track but will take a look and see what I can fix.

@tareqimbasher
Copy link
Owner

tareqimbasher commented Aug 14, 2024

Yep that sure looks like we need to fully qualify the usage of Process. I bet it's happening in the embedded Program file that is included in every running script. Fully qualifying the type there and removing the using should most likely take care of this.

Thanks for reporting this.

@tareqimbasher tareqimbasher added the bug Something isn't working label Aug 14, 2024
tareqimbasher added a commit that referenced this issue Aug 31, 2024
tareqimbasher added a commit that referenced this issue Aug 31, 2024
#246 Removes framework usings from embedded Program.cs to reduce chance of conflicts with other nuget packages
@tareqimbasher
Copy link
Owner

#257 is merged and fixes this issue. Will go out with next release soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants