Can't Fill DataSet using RemObjects.DataAbstract.RemoteDataAdapter with .netcore3.1 server

Hi,

I’m trying to migrate my servers from .net 4.8 to .net core to run it in linux.
But when my .net 4.8client tries to fill some dataSet using the RemObjects.DataAbstract.RemoteDataAdapter.Fill(…) it gets the Object reference not set to an instance of an object. message.

RemObjects.SDK.Types.ServerException: An exception occurred on the server: Object reference not set to an instance of an object.
   em RemObjects.SDK.Message.ProcessException()
   em RemObjects.SDK.BinMessage.InternalReadFromStream(Stream stream)
   em RemObjects.SDK.Message.ReadFromStream(Stream stream)
   em RemObjects.SDK.IpSuperTcpClientChannel.IntDispatch(Stream request, IMessage response)
   em RemObjects.SDK.ClientChannel.Dispatch(IMessage message)
   em RemObjects.SDK.DynamicRequest.InternalMakeRequest()
   em RemObjects.SDK.DynamicRequest.MakeRequest()
   em RemObjects.DataAbstract.RemoteDataAdapter.SendFillRequest(DataSet dataset, String[] tableNames, TableRequestInfo[] tableRequests, WhereExpression[] whereClauses, Boolean applySchema, IList`1 tablesThatNeedSchema)
   em RemObjects.DataAbstract.DataAdapter.InternalFill(DataSet dataset, String[] tableNames, TableRequestInfo[] tableRequestInfo, WhereExpression[] whereClauses, Boolean applySchema)
   em RemObjects.DataAbstract.DataAdapter.Fill(DataSet dataset, String[] tableNames, TableRequestInfo[] tableRequestInfo)
   em AdaptiveSoft.AdaptiveFW.FormPadraoManutencaoGrid.PreencheGrid()
   em AdaptiveSoft.AdaptiveFW.FormPadraoManutencaoGrid.InicializaTela()
   em AdaptiveSoft.AdaptiveFW.FormBase.doLoadForm()
   em AdaptiveSoft.AdaptiveFW.FormBase.FormBase_Load(Object sender, EventArgs e)
   em System.EventHandler.Invoke(Object sender, EventArgs e)
   em System.Windows.Forms.Form.OnLoad(EventArgs e)
   em DevExpress.XtraEditors.XtraForm.OnLoad(EventArgs e)
   em System.Windows.Forms.Form.OnCreateControl()
   em System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   em System.Windows.Forms.Control.CreateControl()
   em System.Windows.Forms.Control.WmShowWindow(Message& m)
   em System.Windows.Forms.Control.WndProc(Message& m)
   em System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   em System.Windows.Forms.Form.WmShowWindow(Message& m)
   em System.Windows.Forms.Form.WndProc(Message& m)
   em DevExpress.XtraEditors.DForm.WndProc(Message& m)
   em DevExpress.XtraEditors.XtraForm.WndProc(Message& msg)
   em System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   em System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   em System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Is there a sample project that uses DataAbastractServer in a .netcore application?

Any tips to complete the migration?

version 10.0.0.1521.

Thanks

Is this an exception that comes from the server (I assume so); if so, can you post the server-side call stack as well? thanx!

I can’t find it, its not in the server’s log, how do I generate log for the DataAbastractService functions?

It should be a property on the exception object in the client. For example, add a try/catch inside AdaptiveSoft.AdaptiveFW.FormPadraoManutencaoGrid.PreencheGrid around the call to Fill, and in the catch clause, inspect the Exception or log the ServerStackTrace (I tink that’s what its called, maybe serverCallStack) property.

Still no idea about it

Hmm. ServerStackTrace is null. that is strange.

are you able to run the server in the debugger, and enable to break on all exceptions, to see of you can catch the exception there?

Alternatively, pls try hooking up the OnServiceMethodException even on your service class (I assume a DataService descendant), and see if you get the exception and details reported there. :crossed_fingers:t3:

I’ve done what you suggested, but the server didn’t stop on the exception, is there a way I can log all the DataAbastract errors?

There should be an event on the server channel, yes. But really, if theres an exception in the server, it should break in VS, when configured properly. Can you also make sure that “Just my Code” is turned off in Debugger options, and that ALL exceptions types are checked (unchecked?) so they will be broken on?

System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=RemObjects.DataAbstract.Server
StackTrace:
at RemObjects.DataAbstract.Server.DataAbstractService_Invoker.Invoke_GetData(IROService __Instance, IMessage __Message, IServerChannelInfo __ServerChannelInfo, ResponseOptions& __oResponseOptions)

Hi,

Can you create a simple testcase that reproduces this behavior, pls?
You can drop email to support@ for keeping privacy

SampleApp.zip (3.9 MB)

ServerConsoleApp .netcore3.1

WindowsFormsApp .net4.8

Could you try moving the call to

  Assembly.LoadFile(Path.Combine(Path.GetDirectoryName(typeof(ServerConsoleAppService).Assembly.Location), "ServerClassLib.dll"));

to earlier in the setup process, before initializing ROSDK?

I’ve tried that but got the same result. Sorry, i’ve forgotten to add the dump (backup) file for you.

SampleApp.zip (3.9 MB)

1 Like

Thanx, I will investigate further.

Reproduced! :raised_hands:t3:

oddly, I had to switch the client to connect to http://8099/bin, and to remove the AES envelope for it to work. It seems that something mismatches between the client and server projects you sent.

I will probably run out of time today before finding anything, but I’ll resume first ting tomorrow.

Update, i’ve narrowed it down more (it’s something to do with the newfangled DependencyInjection stuff, for some reason the Activator doe snot instantiate the service type correctly, and returns n il instead.

I have no idea why yet, so I will need to dive deeper, tomorrow.

Logged as bugs://D19318.

It was as i expected, you load the assembly too late, after the services have already been discovered. if I move the call up here, all is fine:

namespace ServerConsoleApp
{
    internal class Program
    {
        public static string NOME_SERVICO = "Test Server - ";
        static void Main(string[] args)
        {
            HostFactory.Run(host =>
            {   
                // here!
                System.Reflection.Assembly.LoadFile(Path.Combine(Path.GetDirectoryName(typeof(ServerConsoleAppService).Assembly.Location), "ServerClassLib.dll"));

                host.ConfigureServices(services =>
                {
                });
                host.UseApplicationServer(configuration =>
                {
                });
                host.UseNetworkServer<ServerConsoleAppService>(server =>
                {
                    // server.Port = 8090;
                });

                host.UseHostedService();
            });
        }
    }
}

Side note: you’ll also need to create your connection manager earlier; else, by the time you get to the code that does it now, there’ll already be one and you’ll get an exception on that.

It worked!

Thank you!

1 Like

Happy to hear!