xsharp.eu • warning XS0436: The type 'Functions' in '' conflicts with the imported type....
Page 1 of 1

warning XS0436: The type 'Functions' in '' conflicts with the imported type....

Posted: Wed Jul 28, 2021 4:18 pm
by wriedmann
Hi Robert,
this message is a followup to this message:

https://www.xsharp.eu/forum/suggestions ... t=20#13811

I'm working on another WPF/Core dialect application, and have again this warning:

Code: Select all

warning XS0436: The type 'Functions' in '' conflicts with the imported type 'Functions' in 'rdm.AdsSql, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f5ab4fed2162a981'. Using the type defined in ''.	16,2	Start.prg	bnAngebotsTool.XStartupCode:Start
Is there anything I can do to suppress that warning?

I have that in all my applications where I'm using a similar startup code to detect startup errors:

Code: Select all

using System.Diagnostics
using System.Runtime.InteropServices

class bnAngebotsTool.XStartupCode

[STAThreadAttribute];
static method Start as void
	local oSB			as System.Text.StringBuilder

	try

	Functions.Start()

	catch oEx as Exception

	AllocConsole()
	oSB			:= System.Text.StringBuilder{}
	Output( oSB, "An unhandled exception has occurred" )
	Output( oSB, "===================================" )
	do while oEx != null
		Output( oSB, "Exception: " + oEx:Message )
		Output( oSB, "Callstack:")
		Output( oSB, oEx:StackTrace )
		Output( oSB, "" )
		oEx				:= oEx:InnerException
	enddo
	Output( oSB, "===================================" )
	Output( oSB, "Press return to close the application" )
	Wait()
	System.IO.File.AppendAllText( System.IO.Path.Combine( AppDomain.CurrentDomain:BaseDirectory, "ApplicationError.log" ), oSB:ToString() )

	end try

	return

static method Output( oSB as System.Text.StringBuilder, cText as string ) as void

	oSB:AppendLine( cText )
	Console.WriteLine( cText )

	return

static method Wait() as void

	Console.ReadLine()

	return

[DllImport("kernel32.dll", SetLastError := true)];
[return: MarshalAs(UnmanagedType.Bool)];
static extern method AllocConsole() as logic

[DllImport("user32.dll", CharSet := CharSet.Ansi)];
static method MessageBox(hwnd as IntPtr, lpText as string, lpCaption as string, uType as dword) as int pascal

end class

[STAThreadAttribute];
function Start() as int
	local oApp as App

	try

	oApp 		:= App{}

	oApp:Run()

	catch oException as System.Exception

	rdm.WPFLib.WPFUtility.DisplayException( oException )

	end try

	return 0
Wolfgang

warning XS0436: The type 'Functions' in '' conflicts with the imported type....

Posted: Wed Jul 28, 2021 6:51 pm
by robert
Wolfgang,

Can you try this:
Create a Helper function Named MyStart() with the following contents:

[STAThreadAttribute];
function MyStart() as int
return Start()

and then inside the Start method call MyStart() (do not prefix it with "Functions.")

Robert

warning XS0436: The type 'Functions' in '' conflicts with the imported type....

Posted: Wed Jul 28, 2021 7:03 pm
by wriedmann
Hi Robert,
thank you very much, that works.
Il will now implement it in all my WPF applications where I have that warning (at least a dozen.....)
Wolfgang