Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MarkMpn.Sql4Cds.Engine.Sql4CdsException: 'Common Language Runtime detected an invalid program.' #484

Closed
sybaris opened this issue Jun 5, 2024 · 1 comment

Comments

@sybaris
Copy link

sybaris commented Jun 5, 2024

Hi,

Using nuget 9.0.1 version, I have this exception :
image

On the following code :
image

Note that I do not have this issue on 8.0.1 nuget package.

Here the code :


            using (Sql4CdsConnection sqlConnection = new Sql4CdsConnection(ServiceClient))
            {
                using (var cmd = sqlConnection.CreateCommand())
                {
                    cmd.CommandText = @"select '%Object reference not set to an instance of an object%' as ExceptionName, 
                                           SUBSTRING(typename, 1, CHARINDEX(',', typename)-1) as TypeName, count(*) as Count
                                        from plugintracelog
                                        where createdon between '2024-06-04 00:00:00' and '2024-06-05 00:00:00'
                                        and  exceptiondetails like '%Object reference not set to an instance of an object%' 
                                        group by typename
                                        order by 3 desc
                                        ";
                    cmd.ExecuteReader();
                }
            }

Regards
Sybaris

@MarkMpn
Copy link
Owner

MarkMpn commented Jun 8, 2024

This seems to be related to a difference between .NET Framework and .NET Core - the query runs as expected in .NET Framework but produces this error in .NET Core. I've opened an issue at dotnet/runtime#103197 to see if this can be resolved properly in the .NET runtime, but in the meantime I've added a workaround for the next update.

@MarkMpn MarkMpn mentioned this issue Jun 8, 2024
@MarkMpn MarkMpn closed this as completed Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants