DapperLib / DapperLib/Dapper

Problem with Table Type Parameter only in Release Mode

Open
#1,588 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

I am using Dapper with Xamarin Forms. If I use my code in Debug-Mode everything works perfectly. When I switch to release mode I get this error:

The table type parameter 'Kommbereiche' must have a valid type name.

I use the following Code

                var p = new DynamicParameters();
                p.Add("@Mandant", Prefs.Mandant);
                p.Add("@Kommbereiche", dt.AsTableValuedParameter("[dbo].[WDTTableType_Kommbereiche]"));

                var sql = "";
                sql += $"SELECT Kommbereich, MinBestand, MaxBestand, BestandKommbereich, BestandNachschub, BestelltOffen, KommissioniertOffen, Stufe, Ranking, 0 AS Split0, ";
                sql += $"Artikelnummer, Bezeichnung1, Matchcode, LME, NKS, Entnahmeverfahren, 0 AS Split1, ";
                sql += $"PlatzIDZiel AS PlatzID, KurzbezeichnungZiel AS Lagerplatz, 0 AS Split2, ";
                sql += $"BevorzugterGebindeTyp AS Artikelnummer, BevorzugterGebindeTypMatchcode AS Matchcode ";
                sql += $"FROM dbo.WDTFNX_Nachschub_Kandidaten(@Mandant, {stufe}, {filterModus}, {tage}, NULL, 0, @Kommbereiche) ORDER BY Prio";

                using var cnn = new SqlConnection(Prefs.ConnectionString);

                IEnumerable<NachschubModel> result = await cnn.QueryAsync<NachschubModel, LagerArtikel, LagerPlatz, LagerGebindeTyp, NachschubModel>
                (sql, (nachschub, artikel, lagerplatz, gebindeTypBvzgt) =>
                {

                    nachschub.Artikel = artikel;
                    nachschub.LagerPlatzZiel = lagerplatz;
                    nachschub.GebindeTypBvzgt = gebindeTypBvzgt;

                    return nachschub;

                }, p, splitOn: "Split0, Split1, Split2",commandType: CommandType.Text);

                return new ObservableCollection<NachschubModel>(result);

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the AsTableValuedParameter call and the subsequent QueryAsync invocation shown in the issue, comparing their behavior between Debug and Release builds in the Xamarin Forms environment. Reproduce the reported error using the WDTTableType_Kommbereiche parameter and determine the relevant release-mode configuration or handling needed for the table type name to remain valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.