Encountered a confusing error message? Please post here

skipper

Member
Licensed User
Adding DLL error

Hi all,

I'm doing some experiments creating and building custom libraries, using #develop and trying to learn C#.

After building a source library in VB.net found on Internet and targeting .NET 2.0 (not CF, it should be a Desktop only DLL), adding such DLL to a B4PPC project I got the attached error.

What's the meaning? Any suggestion on how to fix/avoid such message?

Thanks

Mimmo
 

Attachments

  • err.JPG
    8.9 KB · Views: 203

agraham

Expert
Licensed User
Longtime User
It usually means that you have a class in a library with a name that already exists in another library or in Basic4ppc. Namespaces are not respected in Basic4ppc libraries so name clashes must be avoided. Also Private is not respected so you will see unwanted objects appearing in the Add Object menu list. You can hide unwanted classes/structs/enums by prefacing their name with an underscore. However with VB you will probably unavoidably see extra stuff added by the VB compiler. C# doesn't (usually!) do this.

Private for fields is however respected and can be used to hide them Personally I make all fields Private and implement Properties to access them.

Also avoid nested classes in a Basic4ppc library, it doesn't handle them gracefully.
 

skipper

Member
Licensed User
Hello Agraham,

fast as usual....

many thanks for your suggestions... I'll have a depth look at the source (as I said the library is not the mine and I'm trying to learn from other).

thanks again

Mimmo
 

Graley

Member
Licensed User
Longtime User
Too many character in character literal

The app I'm working on used to compile fine, but I made a few changes and now it doesn't compile in any flavour. Here's the error message:

Error compiling program.
\\Profile\AppData(Roaming)\Anywhere Software\Basic4ppc\Tzor\Class1.cs(297,10): error CS1012: Too many characters in character literal

I've rem'd out swathes of code trying to identify the problem, but have drawn a blank. If I had a bit more to go on I may have a chance.

I'm using Vista and 6.80.01 of B4PPC.

Thanks for any light you can shed on this.
 
Last edited:

berndgoedecke

Active Member
Licensed User
Longtime User
Problem with optimized compilation

Hello erel,
I tried to compile a windows.exe in optimized compilation Mode and get an error. I know the error from a missing Object declaration. But now it is the line where a Sub begins. What is to do?
PS:I only paste the sub because the whole project is to large.
Best regards and a happy new year
bernd goedecke



Sub GetLen <--- Here the compiler produced the error: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
a = 0
tzerr = ""
f=False
Main.DatAnz=0
Dim Main.SpW(Main.SpAnz)
Dim Main.SpWM(Main.SpAnz)
Dim Main.SpTyp(Main.SpAnz)
Dim Main.SpForm(Main.SpAnz)
Dim Main.NumCol(Main.SpAnz)
Dim Main.DatCol(Main.SpAnz)
Dim Main.DezCol(Main.SpAnz)
FStr=""
For i = 0 To Main.SpAnz-1
Main.NumCol(i) = True
Main.DatCol(i) = True
Main.DezCol(i) = True
Next
Do While dum <> EndStr AND dum <> EOF
If Main.DatAnz Mod 100 = 0 Then
TBConDeb.Text = "Ermittle VarChar-Länge: " & Aktdat & " Datensatz:" & Main.DatAnz
DoEvents
End If
If TxtTyp = "SAP Dynamische-Liste" Then
dum = SubString (dum,1, dLen-3)
End If
Main.TempArr() = StrSplit(dum, Delim)
If ArrayLen(Main.TempArr()) <> Main.SpAnz Then
EdKStr = TZErrIn.Show("beheben..","Trennzeichenfehler",dum,0,0)
Main.TempArr() = StrSplit(EdKStr, Delim)
End If
For i = 0 To Main.SpAnz-1
If TxtTyp = "SAP Dynamische-Liste" Then
Main.TempArr(i) = StrEx.Trim(Main.TempArr(i))
End If
If ArrayLen(Main.TempArr()) = Main.SpAnz Then
Main.SpW(i) = StrLength(Main.TempArr(i))
If Main.SpW(i) > Main.SpWM(i) Then
Main.SpWM(i) = Main.SpW(i)
End If
If a > Main.SpAnz-1 Then
If Main.TempArr(i)<>"" Then
Match2.Value = Regex2.Match(Main.TempArr(i))
Match22.Value = Regex22.Match(Main.TempArr(i))
If Match2.Success=False OR Match22.Success=True Then
Main.DezCol(i) = False
End If
Match5.Value = Regex5.Match(Main.TempArr(i))
If IsNumber(Main.TempArr(i)) = False OR Match5.Success=True Then
Main.NumCol(i) = False
End If
Match1.Value = Regex1.Match(Main.TempArr(i))
If Match1.Success=False Then
Main.DatCol(i) = False
End If
End If
End If
Else
For j = 0 To ArrayLen(Main.TempArr())-1
FStr = FStr & CRLF & Main.TempArr(j)
Next
F=True
End If
Next
If F=True Then
tzerr = tzerr & Main.DatAnz+1 & ", "
Msgbox("Trennzeichenfehler in Zeile: " & Main.DatAnz+1 & " " & dum)
F=False
End If
dum = FileRead(c1)
a = a+1
Main.DatAnz = Main.DatAnz+1
Loop
TBConDeb.Text = " Datensätze:" & Main.DatAnz
For i = 0 To Main.SpAnz-1
If i < Main.SpAnz-1 Then
If Main.SpWM(i) < 256 Then
If Main.SpWM(i) < 1 Then
Main.SpTyp(i) = "VARCHAR"
Main.SpWM(i)=1
Main.SpForm(i) = Main.SpWM(i)
Else
Main.SpTyp(i) = "VARCHAR"
Main.SpForm(i) = Main.SpWM(i)
End If
Else
Main.SpTyp(i) = "TEXT"
Main.SpForm(i) = ""
End If
Else
If Main.SpWM(i) < 256 Then
Main.SpTyp(i) = "VARCHAR"
Main.SpForm(i) = Main.SpWM(i)
Else
Main.SpTyp(i) = "TEXT"
'SpForm(i) = ""
End If
End If
If Main.NumCol(i) = True Then
Main.SpTyp(i) = "INTEGER"
End If
If Main.DatCol(i) = True Then
Main.SpTyp(i) = "DATE"
End If
If Main.DezCol(i) = True AND Main.NumCol(i) = False Then
Main.SpTyp(i) = "REAL"
End If
Next
End Sub
 

Attachments

  • GetLen Error.jpg
    27.6 KB · Views: 213

agraham

Expert
Licensed User
Longtime User
EDIT :sign0013: PLease disregard this post, I read your's too quickly and assumed it was a runtime error not a compile time error


For performance reasons optimised compiled applications don't report the line number where an error occurs. Try my DebugRecompiler here http://www.b4x.com/forum/additional...-legacy-optimised-applications.html#post27120 which will add the line number to the error message box of an optimised compiled application - but at the expense of lower performance and a larger exe.
 
Last edited:

berndgoedecke

Active Member
Licensed User
Longtime User
I'm searching, but I didn't find it as yet. The program runs in the IDE as well as in normal compilation mode. I don't know if Agrahams Debugger is the right choice to find it. The Demo runs with the ini-File, but I don't know how to get the line number with the error, because it is only recognized by the optimized compiler, during compilation.
If you have a hint it should be great.

Best regards

berndgoedecke
 

agraham

Expert
Licensed User
Longtime User
I thought you said that it was a a compile time error, which was why I posted a retraction as I immediately, wrongly, assumed it was run time error. My library is for runtime debug only so if it won't optimise compile the library is of no help.

From your message box picture it does look like the IDE has thrown an exception while compiling. If you don't want to post the entire code for us to try reproducing the problem I would suggest stripping out the code a Sub at a time and trying to optimise compile it - it doesn't have to be in a runnable state - until you identify where the error might be then post the bit of code.

@Erel - It looks like an exception caught in CMesharsher.Start!
 
Last edited:

panic

Member
Licensed User
Longtime User
External compiler error CS1026

I have encountered the same problem with my own and sample applications. They all work in the IDE but do NOT compile as device EXE. For example I load the GPS4PPC-v2.sbp in the IDE and try to compile it with optimized compilation checked. I get the following message:

Error compiling program.
Error message: error CS1026: ) expected
Line number: 133
Line: txtLat.Text = StringFromLatLon(LL.Lat, SharedControls.selectedFormat)


with optimized compilation unchecked I get:
Error compiling program:
Object reference not set to an instance of an object.


The same happens with my own program. It seems that the external compiler does not understand Subs with parameters
 
Last edited:

panic

Member
Licensed User
Longtime User
Ref: Error CS1026

I am using v6.80, .NET version 2.050727.1433

I also tried with other sample applications for example SerialTerminal, Accounts, GPSDriverDemo (that apparently do not have parameterized subs) and they compile OK.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…