Cannot resolve symbol 'Void' - c#

At the head of my class (I am taking over a project from someone else), I have the following:
using Java.Util;
using Object = Java.Lang.Object;
using Void = Java.Lang.Void;
Void, is showing in red, with a "Cannot resolve symbol 'Void'" and cannot see what I may be missing.
I have checked the PC where this came from (and the application does build on that one) and have installed the same (yes, I saw, newer, but specifically installed the "same" items) Java items:
Java 7 Update 45
Java 6 Update 31
Java SE Development Kit 6 Update 31
This hasn't made any change.
I have checked the 'References' branch of the project and everything is showing the same (in fact, I cannot see a specific reference to Java anywhere)
Any help would be appreciated to sort this.
Please understand that I am not looking to change the code; just to get the code (as is) to compile without error.
[Update]
When I type out Java.Lang. the intellisense does not show Void in the dropdown list
[Further Update]
This project is tied to the development for a tablet; for which I hadn't installed some of the development software - installing these has resolved the issue and I can only assume that the Java namespace is buried within the software. Whilst there's no specific answer in the responses, most of the comments have certainly helped to steer me in the right direction.

There are several possible ways a C# project consuming Java bits,
Microsoft J#, which has been dead for a long time.
IKVM.NET, which originates from Mono.
dot42, a C# to Android compiler, which compiles C# to Android.
Xamarin.Android (aka Mono.Android).
Based on the fragment you pasted I think you might be opening a Xamarin.Android project in Visual Studio, as the using clauses match,
http://androidapi.xamarin.com/?link=N%3aJava.Util
http://androidapi.xamarin.com/?link=T%3aJava.Lang.Void
http://androidapi.xamarin.com/?link=T%3aJava.Lang.Object
Thus, you need to have Xamarin.Android completely installed on this machine. What you have (JRE and JDK) is obviously not enough.
dot42 does not have Java.Lang.Void and Java.Lang.Object, http://docs.dot42.com/Reference/NS.Java.Lang

I think these links would be helpful for you.
What is the difference between java.lang.Void and void?
http://docs.oracle.com/javase/7/docs/api/java/lang/class-use/Void.html

FAIL:
using Java.Lang.Void;
import Java.Lang.Void;
SUCCESS:
import java.lang.Void;

You have to use import instead of using.
import Java.Util.*;
Object blah = new Java.Lang.Object;
If you want to create an object that is null, do this:
Object obj = new Object();
If you want to add data set it equal to data such as a number.
obj = 7;

Related

Epicor v9 to v10 Customization Reference Missing and BPM import

I'm working for a company that is upgrading from Epicor v9 to v10. They have a custom bit of code that was done by a 3rd party. I've been brought in well into the upgrade process so don't really know the history. Previous developer that was around when 3rd party developed install package left years ago.
Best I can tell is the form that utilizes the custom code is missing a reference. The error message starts off with:
'Erp.BO.PartPlantListDataSet' is defined in an assembly that is not
referenced. You must add a reference to assembly
I have install documents provided by the 3rd party company but V9 and v10 seem to differ a bit.
When I follow the instructions to go to "System Management/Business Process Management/Directive Import" and try to import the BPM I get the error message
"The file is not a BPM import file"
The file has the .bpm extension and is what was used in v9. I also have some files ending in .i and .p but the install instructions don't match up at all.
I'm well versed in C# and MS SQL which the new version of Epicor uses, but I can't get these customizations configured properly.
How can I successfully import the customizations? Will I need to do any conversion to the v9 code prior to getting the BPM imported?
For the form you will want to provide a reference to the PartPlant contract which should be Erp.Contracts.BO.PartPlant.dll. It sounds like that converted okay from the migration. You might double check that none of the E9 references lived. That one would be something like Epicor.Mfg.BO.PartPlant.dll.
I don't think you are going to be able to convert the E9 BPM by importing it into 10. Normally BPMs are "updated" as part of the 9 -> 10 migration process, but generally unless it is super vanilla it doesn't exactly work right. However, when they are migrated the custom ABL code appears in the BPM editor in E10 and you can reference it there while you fix the code that the converter spits out.
Additionally you can contact Epicor Support and they have an online code conversion tool that they might let you use. This will likely result in the same process of adjusting the code and making it readable.
Generally I believe it best that these be rewritten as it is really a different coding paradigm.

The name DnsClient does not exist in the current context

I have created a C# console application using visual studio 2010.
We are migrating our hosted sites a new server, and I have been set the task of checking the domains on the new server map to the same place as the domains on the old server.
I have been told do so using the following example:
https://docs.ar-soft.de/arsoft.tools.net/#DNS%20Client.html
This is all pretty new to me and I am on the edge of my understanding, but I just about understand what I need to do.
My problem is, when I add the following line of code:
DnsMessage dnsMessage = DnsClient.Default.Resolve("www.example.com", RecordType.A);
It is not recognising either the
DnsMessage
OR
DnsClient
As far as I can understand, both of these are in:
using System.Net;
Which is present on the page.
So what can I do to make this piece of code work?
This makes me think I am using the wrong type of project otherwise I cannot understand why it does not recognise these commands?
This brings me to a related side note. It seems to me I am missing something about C#, because I sometimes come across bits of code that are not recognised at all in the project I amusing, for example in some web applications I just cannot get a message box to appear, as again it does not seem to be recognised in the environment I am working in.
It seems that not all C# code can be run in all C# applications, so if this is the case, how can I tell what can be run and where?
This isn't built in. Per your documentation link, it's a 3rd party library called ARSoft.Tools.Net. You can install from NuGet:
Install-Package ARSoft.Tools.Net
You could also download the binaries from the project's codeplex site

How to check in only some parts of the program in Visual Studio Team Services?

Additional info: I thought it might be helpful to say that my forms and classes are in the same solution as the already updated forms.
In our company we have this project which 3 people are working on it. One works on the database part, me and another colleague of mine are working on making the UI ready and relating it to database which is MS SQL Server 2012 and we are programming in C# in VS 2012.
The problem is that I made this one form ready, but the server version is ahead of me. That is, if I check in the whole program, I will damage the project as some forms has changed and the version I have is older. I tried right clicking and checking in only the forms and classes which I, myself made and I have their latest version. They check in without any error or anything, but the problem is, when my colleagues or myself(after deleting my source project) try to get latest version, my forms or classes doesn't show up.
We also tried to check in the whole program but only accept those pending changes which are made by me, still no success.
The problem is, we are kinda afraid to play with the server version as a lot of effort has gone into it.
Any help will be really appreciated as I'm stuck with this problem and the manager won't give me more parts of the program to make until we can come up with some way to deal with this.
You haven't mentioned merging at all but I think this is the answer to your question.
When you work on an older version of the code (because your local code is older, or maybe the whole branch of the code is older), you need to merge the code into the newer version. When you merge, any potential conflicts are detected and you can resolve all of them manually. There's obviously tools to help you - one is built into Visual Studio but you can replace it with an external tool which may work better for you. Either way, you need to decide how to merge the code. You have a few options:
take the whole code from the source (old code in this case),
take the whole code from the target (new code in this case),
merge the changes and take bits from each version based on your knowledge of the changes and how the code should look like.
As for why the forms don't show up, you probably didn't check in the changes to the project file so the new files are not part of the project as it exists in Team Services.

Monodevelop warning "Could not generate code for widgets of type: xxxx"

About 2 years ago I worked on a C# project, using MonoDevelop V1 and later V2 (beta release, compiled from source, what a mission) under Fedora. The project went dead. Now I am bringing it back to life, but I have changed my development platform to Debian (testing, i.e. squeeze), which has MonoDevelop V2.2.
I am mostly very pleased with the features of V2.2, but I have a nasty little problem. All the code compiles OK, but at the end of the compilation run I am left with lots of warnings as in the subject line. Obviously, as soon as I try and run the application, I get exceptions left, right and center when I open anything that uses these widgets.
The funny thing is that the library containing the widgets compiles just fine. But somehow these widgets (it's not all of them, only one or two) don't get exposed on the interface, and then subsequent dialogs or windows using them throw the above warning.
Has anybody had this problem? I have googled this and all that comes up is Michael Hutchinson throwing his hands in the air and saying "sorry, can't help here". I really need a fix for this, otherwise I will have to rewrite substantial chunks of code from scratch.
I would recommend trying MonoDevelop 2.4, but in any case here are some hints.
If you have an assembly which uses custom widgets implemented in the same assembly, you may be having a chicken-egg problem, since MonoDevelop needs the built assembly in order to find the custom widgets, but that's the assembly you are trying to build. This problem can be easily solved by building again the project after you get the warnings you reported. Beware, you have to build, not rebuild, since rebuild will delete the assembly and you'll hit the same problem again.
If you are not having the above problem, or if the solution doesn't work, the problem may be that the objects.xml file that contains the information about the exported widgets is not properly updated. You'll find that file in the project that implements the custom widgets, in a hidden gtk-gui folder. Open the file and check if the all the custom widgets are declared there. If a widget is missing, try opening the source code file of the widget and do a small change (e.g. a whitespace change) and then build the project again. MonoDevelop should be properly updating the file.
If you are still having trouble, please file a bug report.
I think I found a way out. Not sure whether this is the "official" method, but it seems to work.
In this library a normal widget's class definition starts like this:
namespace Amino.Common
{
//! A text entry combined with a pop-up date selector, very useful for otherwise busy dialogs
public class DatePicker : Gtk.Bin
{
If I now add two additional declarations right in front of the class statement, like this:
namespace Amino.Common
{
//! A text entry combined with a pop-up date selector, very useful for otherwise busy dialogs
[System.ComponentModel.Category("Common")]
[System.ComponentModel.ToolboxItem(true)]
public class DatePicker : Gtk.Bin
{
then
That widget gets included in the objects.xml file and
The entire solution compiles as expected (and runs as expected).
Maybe somebody could shed some additional light on this, I would love to understand this better.

C# Code Formatter for Linux and/or MonoDevelop

MonoDevelop 1.0 doesn't appear to have a code-formatter like Eclipse does for Java. Is there a preferred shell script (or MonoDevelop add-in?) that you've found to work well?
At the moment, source code formatting in MonoDevelop is marked as a future enhancement:
https://bugzilla.novell.com/show_bug.cgi?id=321946
In the meantime, you may want to check out Artistic Style for C# formatting:
http://astyle.sourceforge.net/
I'm planning to see how this might be wired up as an external tool within MonoDevelop. If I get to that, I will edit my answer with the information. UPDATE: I don't have enough reputation to leave a comment, so I'll make one here: Nice job, Dustin, and patch for MonoDevelop too :-) I wonder how recent the version is that is included with Ubuntu... Either way, I'm glad you found something that works for you.
Thanks, Brandon. I submitted a patch to MonoDevelop. The issue with MonoDevelop add-ins is that there is a mono compiler bug that doesn't handle anonymous delegates correctly. (bug report: https://bugzilla.novell.com/show_bug.cgi?id=394347)
The patch/workaround is to just cast the anonymous delegate to the proper delegate type. (bug report & patch: https://bugzilla.novell.com/show_bug.cgi?id=369538)
I'm running with the patched version now and am able to execute AStyle on the currently edited document by simply creating a new External Tool setting with the following settings:
TITLE: A_Style (put in an underscore _ to enable hotkeys)
COMMAND: astyle
ARGUMENTS: ${ItemPath}
Then, just execute it using Tools->AStyle (or ALT-T, S)
9/25/08 Edit -- I just put up a blog posting on how to patch MonoDevelop 1.0 and get it working with AStyle: http://dustinbreese.blogspot.com/2008/09/auto-formatting-code-in-monodevelop-10.html
It's a nice programming exercise to write your own formatter . I wrote one for C++ , and it was a nice challenge . You could learn a lot by writing it :)

Categories

Resources