I am facing a problem while using the
ITMSDLL.
The following is the C# code defined in my Application
public static string
Get_Month_Mask(string theByt,int theMon, string theYr)
{
string aMByte = theByt;
int aSt_Dow, aEn_Dow,
aSt_Wk, aEn_Wk;
DateTime aSDate = new
DateTime(Convert.ToInt32(theYr),Convert.ToInt32(theMon),01);
DateTime aEDate = aSDate.AddMonths(1).AddDays(-1.0);
string
aRetMask = "X".PadRight(120);
int aRc;
aSt_Dow =
Utility.GetDayNumber(aSDate.DayOfWeek.ToString());
aEn_Dow =
Utility.GetDayNumber(aEDate.DayOfWeek.ToString());
aSt_Wk =
Utility.GetWeekOfTheYear(aSDate);
aEn_Wk =
Utility.GetWeekOfTheYear(aEDate);
aRc =
Utility.objCITMSDLL.GetMonthMask(out aRetMask,out aMByte, aSt_Dow, aSt_Wk,
aEn_Dow, aEn_Wk);
return
aRetMask.ToString();
}
And the below is the code used in ITMSDOTNETDLL
where the wrapper method is written.
-
[DllImport("ITMSDLL.dll")]
-
internal static extern int get_month_mask(out string theMask,out string theByt, int
theSt_Dow, int theSt_Week, int theEn_Dow,
int theEn_Week);
-
public int
GetMonthMask(out string theMask,out
string theByt, int theSt_Dow,
int theSt_Week, int theEn_Dow,
int theEn_Week)
-
{
-
return CITMSDLLMethods.get_month_mask(out
theMask, out theByt, theSt_Dow, theSt_Week, theEn_Dow,
theEn_Week);
-
}
it throws error
The runtime has encountered a fatal
error. The address of the error was at 0x79e71bd7, on thread 0xc94. The error
code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or
non-verifiable portions of user code. Common sources of this bug include user
marshaling errors for COM-interop or PInvoke, which may corrupt the
stack.
if we use "ref" instead of "out" then it also
throws same(above) error.
If anybody can help then please help
me.