I'm writing a C# Gtk# application under Mono/MonoDevelop in Linux Mint 17. I have a ComboBox on a form with 3 items in it. I was able to place it and such fine however, I get an error in the designer code stating that the ComboBox doesn't contain a definition for 'NewText'. The Mono documentation at docs.go-mono.com says that this NewText method is how you add items, however, apparently mine doesn't have it.
My MonoDevelop version is 4.0.12
The projects target Gtk# version is 3.0
I have the following references and their versions referenced in the project
And finally, the designer code
//top of file declaration
private global::Gtk.ComboBox framestyle_Val;
//further down, this defines all the items
this.framestyle_Val = global::Gtk.ComboBox.NewText ();
this.framestyle_Val.AppendText (global::Mono.Unix.Catalog.GetString ("Single Sprite"));
this.framestyle_Val.AppendText (global::Mono.Unix.Catalog.GetString ("Left/Right Sprites"));
this.framestyle_Val.AppendText (global::Mono.Unix.Catalog.GetString ("Left/Right/Upside-Down Sprites"));
It's worth noting that apparently there's no AppendText definition/method either but I assume that'll be straightened out once we get this one straightened out.
Any ideas? I'm confused myself. Thanks in advanced,
Mike
I had the same problem. MonoDevelop seems to be unable to generate proper code to use with Gtk#3.
You may want to install Gtk#2, this will not override the GTK#3 installation, and target your project with this version to be able to use MonoDevelop's visual design abilities.
And maybe you will need to create the clean GTK#2 project once again.
If you have found a solution to use GTK3, please give me an idea.
Related
I have set up a local Azure Function project in VSCode as per the instructions here https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-csharp?tabs=in-process
The default templated function that is created works when I run it in VSCode, but I am seeing reference errors in the VSCode editor as per screen shot.
When I go to the definition of the HttpRequest class for example, I see no Query method.
How can I fix these?
The options I selected were C#, .NET 6, HTTP Trigger, Anonymous, Add to Workspace
I have installed .NET 6 SDK, Azure Function Tools, C# extension, Azure function extension.
Thank you
Edit:
The exact message I get when I mouseover one of the reference errors is
The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13 ...
I ran into the same problem today. I have the C# extension installed in VS Code and noticed this line in the extension description:
When I set that flag to true (and restarted OmniSharp or VSCode), the issue went away :)
I tried to reproduce the issue:
Firstly, I have selected my workspace folder from the VSCode,
Created the function project using func init command in the VS Code terminal.
Create the function using func new command in the terminal, selected Http Trigger from the dropdown display of triggers and given the function name as Hello.
Click on the Hello.cs file, then you will get a side dialog box on the bottom of the same VS Code window.
Click on Restore.
OR
If you get two dialog boxes, then click on Restore and Yes so that it will restore the NuGet packages and functions dependencies required for that environment.
You can also see in the output terminal opens immediately after clicking restore option:
After adding those, you will get clean error-free UI like below:
Note:
If you have written the class/function manually in the code, please check that you renamed the Function class name both in the code as well in the file explorer like:
Updated Answer:
As per your edits and comments, I also installed .Net SDK Version 6 and checked the project in VS Code and I got the restore dialog box again with that red squiggly lines. After clicking on restore option, all red squiggly lines went out and this is the Proof-Of-Concept:
I did get this resolved, though I am not sure exactly how/ why, so i'll just post what I did in case it helps someone else.
Firstly I removed the Microsoft C# extension and re-installed it. I dont think this had any effect and it didnt seem to fix the issue, I am just mentioning it as I will mention everything I did.
When I googled the error that is in my Edit above The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13 I found some references to the MS Build tool/ library shipped with Visual Studio (not VS Code) in regards to .NET 6 and how the .NET 6 requires a certain version of the Build utility.
The recommendation was to upgrade Visual Studio (not VSCode), which I already had installed and that would update the MS Build.
I didnt really understand quite a bit of what I read, but I updated my install of Visual Studio Community 2019 in the hope that it would update MS Build and it seems to have worked.
I expect there is another way to do this without Visual Studio, but I chose this way as I had it installed anyway.
One last thing was I went to bed and had a sleep, then checked it again in the morning.
Cant really say for sure which of the three things worked :)
I have superficial knowledge on referencing libraries in projects. Usually most of the time a simple 'add reference' and then browsing to the appropriate path, just works. I am following an issue I will try to explain , and show all the approaches I tried to tackle it.
I am trying to use AutoIt. In their website it is stated that simply adding the .dll and using it, is enough to integrate their functionality in visual studio.
I am doing just that but for the moment I can not get my head around what is happening.
AutoItX is a public static class, as also the Run function is the same (public static). After adding the reference I can navigate to the appropriate .cs (if I control click on it for example). So the class AutoItX is not something unknown for the project. Moreover, the function Run indeed exists
however not inside the project itself. AutoItX also needs staff from (dont know if it is important):
The main error is that AutoItX doesnt exist in this context.
I have tried to register the dll, I have tried to add the com reference and remove it, I have tried to move the .cs files inside the project. None of those corrected the issue.
Any help would be valuable. If I missed something and you need extra info, I am willing to provide it. (Latest vs, latest autoit version, .net framework type of project).
Actually the above works.
For future reference.
The reason I did not try it first was, that they propose in their website to reference the autoItX.assembly.dll. This is probably deprecated and does NOT work anymore.
Second, if you have already referenced it , downloading this from NuGet WONT fix it.
Finally, the NuGet package does NOT work with .net CORE but ONLY with .net Framework project
I installed AutoItX.Dotnet 3.3.14.5, my test is no problem.
You can refer to my steps to create a new project to test it.
Right click References=>Manage NuGet Packages=>Browse=>AutoItX.Dotnet=>Install
Running result:
I had my PC re-imaged for me. I have Visual Studio Version 14.0.25123.00 Update 2 installed on my computer. I'm getting this error when I try to use VS intellisense to reference another project.
CSharpAddImportCodeFixProvider encountered an error and has been disabled
I have two projects. One of them using namespace ProjectName.Web. And the other project using ProjectName.Web.Controllers. The provider crashes when I reference ProjectName.Web.Controllers, I believe because it is setup as a project. Any idea how to fix this?
I had the same issue on VS-2015 update 3.
I did was :
1) Closing visual studio
2) restarting as administrator
Happened to me when chose Add using System.Data.SqlClient automatically after typing using (SqlConnection...){} in DataLayer, in one of Repository classes.
Nothing helped (except creating new project), but I saw that the problem was with loading System.Data.SqlClient.dll file, although it existed in appropriate folder.
Found by trial and error that after removing Dependencies->Assemblies->System.Data.SqlClient from DataLayer (right click -> Remove, or just press Delete key when selected), I can Add System.Data.SqlClient without any errors.
Didn't try for other cases where CSharpAddImportCodeFixProvider encountered an error and has been disabled message appears, but the solution might be similar.
In my case the problem appeared probably due to .net Core version conflict or something like that, because the project was on external drive and created on another computer.
Edit: Also, some errors might be caused by .vs folder (hidden by default) inside Solution folder, especially if the project is moved between different computers. I know from experience that IntelliSense can seem to be broken and classes from other namespace would be unavailable although using namespace_name statement is present. The solution is to delete .vs folder or just avoid copying it with the project, as suggested here: https://weblog.west-wind.com/posts/2018/Aug/07/Fixing-Visual-Studio-Intellisense-Errors
There may be multiple reasons why this error occurs. So this answer may not apply to all situations, though it seems that it only occurs when another project is referenced.
The error does not occur for all statements. In my case I had the following code:
private System.Threading.Timer Timer;
public void Start()
{
Timer.Change(0, 60000);
}
As soon as intellisense would open for Timer.Change( the error occurred. Please note that I had no parameters at that point. If valid parameters are present there will be no error.
I could solve the issue by updating the version of the framework. I found out that both projects targetted different frameworks, resp. 4.5.2 and 4.6.
As long as the framework versions are different the error occurs. As soon as both are equal (either 4.5.2 or 4.6) the error no longer shows.
I have tested this with VisualStudioVersion = 14.0.25420.1 (Visual Studio Community 2015).
-- update --
I've reported this as a bug to Microsoft. Including steps to reproduce.
I end up with this same error.
what i did was to manually go and find the nuget packet for System.Data.SqlClient, installed and then invoke it in the class i was working on, like:
using System.Data.SqlClient;
Dont know if this is some kind of bug, cause it happens on a new blank project i create using visual studio 2019 community
hope it helps someone
Had the same problem solved by installing the sqlClient package from nuget package manager
right-click on the project choose manage nuget packages.. and go to browse tab and search for System.Data.SqlClient and install it. that easy :)
Judging from the label you were given, "CSharpAddImportCodeFixProvider", I'd guess your problem was due to Visual Studio trying to identify and/or correct a missing "using" statement at the top of your C# source code file in which you made reference to a class that needed it. The Visual Studio components that usually deal with this type of problem are Intellisense, or third-party syntax highlighting/correction plugins like JetBrains' ReSharper.
On second thought, I'm not quite sure it's Intellisense's fault as opposed to the plugin ReSharper's. That's to be determined.
I did file a similar bug report with Microsoft. The error in my case seemed to be a result of the Intellisense not knowing how to deal with a logic error in my own code (see https://connect.microsoft.com/VisualStudio/feedback/details/3133049).
In my case, I had inadvertently placed code for a method outside its class definition, though inside its similarly named namespace. Visual Studio 2015 Update 3 complained,
'GenerateVariableCodeFixProvider' encountered an error and has been
disabled.
The fix was to move my method back into its corresponding class definition, but it definitely brought a Visual Studio bug up to the surface.
Specifically, Visual Studio Intellisense had seen the line of code,
Response.Write("I did something");
placed in a method that was declared outside a class definition (i.e., inside a namespace, but inadvertently not inside its class). The "'FeatureLabel' encountered an error and has been disabled" error was then displayed in a yellow bar across the top of my editor window and an "Enable" button and an "Enable and ignore future errors" button were displayed next to it.
I believe that Intellisense (or ReSharper?) tried to automatically deal with the situation and attempted to generate a variable for the keyword, "Response", but it tripped trying to do so--which in turn caused the error that was displayed.
anyone trying this solution from here ?
https://developercommunity.visualstudio.com/content/problem/623872/add-import-not-working.html
the last reply solves my issue..
Tools > Options > Text Editor > C# > Advanced
turning off Suggest usings for types in NuGet packages
When I try to install IronPython on Debian with Mono (3.12), I get the following error:
socket.cs(1900,63): error CS0117: `System.Net.Sockets.SocketOptionName' does not contain a definition for `IPv6Only'
How can I solve this problem? According to the IronPython website, everything should compile without errors.
In the Mono mailing list there is already such a bug, but there is no answer to this bug. Therefore I thought that maybe this forum is a better place for this question.
I'm no expert on either IronPython or Mono, but out of curiosity I just tried this.
For whatever reason, the IPV6Only value in the SocketOptionName enum appears to be missing in the Mono implementation. The error message you're getting is from the code in IronPython.Module/Socket.cs attempting to reference this. It turns out that this is already recognised in the codebase as a feature that not all platforms have, so there's an easy workaround:
The Common.proj project file in the Solutions/ directory in your git checkout defines a number of possible ReferencedPlatform values. The default value is V4. Just below there in the XML, find a block starting:
<PropertyGroup Condition="'$(ReferencedPlatform)' == 'V4'">
Nested in there is a Features element with a list of the features that apply, and if you find and delete FEATURE_IPV6 at the end of the list, then you should find that the project will build using make. I briefly tried firing up the ipy.exe that is generated and it seems to work.
Obviously this isn't a very good solution. Probably the best thing would be to file a bug report with the IronPython project. I guess that Mono on Linux is probably a fairly low priority for the guys who are working to maintain it.
Correct, up to mono 4.0 throws Protocol option not supported when setting IPv6Only false.
This is probably resolved here: https://github.com/mono/mono/blob/mono-4.2.0-branch/mono/metadata/socket-io.c#L536
But do note the compile flag IPV6_V6ONLY
working with unity and c# and when I try these line
using System.Xml.Linq;
I get this error
The type or namespace name Linq' does not exist in the namespace
System.Xml'. Are you missing an assembly reference?
So I found online, through a lot of searching, that Linq can cause problems, and you need to manually add a reference in MonoDevelop. So I added a reference there (by right clicking References in the solutions pane, clicking Edit References and browsing for System.Xml.Linq)
Still no luck,
Any ideas?
I think this SO post will answer your question...
https://stackoverflow.com/a/875704/1246574
It's pretty much the same issue you're having.
You can't modify the monodevelop (or visual studio) solution or project manually. Because they are generated by Unity. Even if you modify it, Unity can overwrite your changes when it regenerates the solution files.
The reason you can't use some namespaces is the .net/mono version selected in your Unity project settings.
Search for "API Compatibility Level" in this documantation http://docs.unity3d.com/Documentation/Manual/class-PlayerSettings.html
C'mon people, Stop modifying the generated code files. This is 2013!
from this post, I found that Unity doesn't support .NET 3.5 by default (which is required to use Linq). In the settings Xtro talked about, you can only choose .NET 2.0. Instead, you need to drag the desired .dll file into Unity like a texture. Kinda hackish, but it works. Once again, like Xtro said, there is NO REASON to edit the MonoDevelop settings. They have no affect on the final compilation.
EDIT: See Xtro's answer for an alternate solution. He was able to make Linq work by changing the API Compatibility Level to .NET 2.0 (not Subset).
EDIT 2: I just updated from Unity 4.1 to 4.2 today and got an error that Linq was defined twice. by deleting the .dll, I solved the error. Note I'm still using .NET 2.0 Subset. Looks like they added Linq support by default.