Tuesday, March 20, 2012

calling custom assembly just wont work...

i am trying to call a custom assembly from a
report and it just wont work.
my code is as follows:
--
Public Class Module1
Public Shared Function Hello() As Integer
Return 2
End Function
End Class
--
i want to use this function to calculate one of my
dataset parameters. i have used this expression:
=FundTrackHelper.Module1.Hello()
this is the error i get:
Error 102 [rsCompilerErrorInExpression] The Value expression for the query
parameter â'@.organ_pkeyâ' contains an error: [BC30389]
'FundTrackHelper.Module1' is not accessible in this context because it is
'Private'.
c:\srcsafe\vs2005\reports\fundtrackreports\fundtrackreports\TEST.rdl 0 0
i have copied the assembly into: C:\Program Files\Microsoft Visual Studio
8\Common7\IDE\PrivateAssemblies
i also did try to modify the rssrvpolicy.config file to grant the assembly
code
permissions beyond the default execute permissions but this had no effect
so i took the modification out. furthermore, i dont think a simple piece
of code like this needs any extra permissions anyway.
any ideas appreciated.
thanks.
t.Hi,
did you had a reference of the assemblie in the report property..
can you define the method as static function and access it?
"taz" wrote:
> i am trying to call a custom assembly from a
> report and it just wont work.
> my code is as follows:
> --
> Public Class Module1
> Public Shared Function Hello() As Integer
> Return 2
> End Function
> End Class
> --
> i want to use this function to calculate one of my
> dataset parameters. i have used this expression:
> =FundTrackHelper.Module1.Hello()
> this is the error i get:
> Error 102 [rsCompilerErrorInExpression] The Value expression for the query
> parameter â'@.organ_pkeyâ' contains an error: [BC30389]
> 'FundTrackHelper.Module1' is not accessible in this context because it is
> 'Private'.
> c:\srcsafe\vs2005\reports\fundtrackreports\fundtrackreports\TEST.rdl 0 0
> i have copied the assembly into: C:\Program Files\Microsoft Visual Studio
> 8\Common7\IDE\PrivateAssemblies
> i also did try to modify the rssrvpolicy.config file to grant the assembly
> code
> permissions beyond the default execute permissions but this had no effect
> so i took the modification out. furthermore, i dont think a simple piece
> of code like this needs any extra permissions anyway.
> any ideas appreciated.
> thanks.
> t.|||c
hi,
yes i did add to references but i am not sure what
to put in the report properties | class name and
instance name bits - any help appreciated.
here is my code (the project is called FundTrackHelper):
Namespace xyz
Public Class Module1
Public Shared Function Hello() As Integer
Return 2
End Function
End Class
End Namespace
"Bava Mani" wrote:
> Hi,
> did you had a reference of the assemblie in the report property..
> can you define the method as static function and access it?
>
>
> "taz" wrote:
> > i am trying to call a custom assembly from a
> > report and it just wont work.
> >
> > my code is as follows:
> >
> > --
> >
> > Public Class Module1
> > Public Shared Function Hello() As Integer
> >
> > Return 2
> >
> > End Function
> >
> > End Class
> >
> > --
> >
> > i want to use this function to calculate one of my
> > dataset parameters. i have used this expression:
> > =FundTrackHelper.Module1.Hello()
> >
> > this is the error i get:
> >
> > Error 102 [rsCompilerErrorInExpression] The Value expression for the query
> > parameter â'@.organ_pkeyâ' contains an error: [BC30389]
> > 'FundTrackHelper.Module1' is not accessible in this context because it is
> > 'Private'.
> > c:\srcsafe\vs2005\reports\fundtrackreports\fundtrackreports\TEST.rdl 0 0
> >
> > i have copied the assembly into: C:\Program Files\Microsoft Visual Studio
> > 8\Common7\IDE\PrivateAssemblies
> >
> > i also did try to modify the rssrvpolicy.config file to grant the assembly
> > code
> > permissions beyond the default execute permissions but this had no effect
> > so i took the modification out. furthermore, i dont think a simple piece
> > of code like this needs any extra permissions anyway.
> >
> > any ideas appreciated.
> >
> > thanks.
> >
> > t.|||I think the problem might be that as far as I know you can only call
static methods in classes. Try making it static and see if this works|||tried to make the method static and it tells me:
Methods cannot be declared 'Static'
doesnt the 'Shared' keyword do the same thing? if so, as
u can see i am already using that...
"Thomo" wrote:
> I think the problem might be that as far as I know you can only call
> static methods in classes. Try making it static and see if this works
>|||sorry Taz, I didn't notice this earlier, from what I understand the
Shared statment is the equivalent of static in C#
you said that you compiled the assembly into C:\Program Files\Microsoft
Visual Studio
8\Common7\IDE\PrivateAssemblies, the assemblies that I call from my
report however are simply placed under the GAC.
Can you check to see if your assembly is under the
c:\Windows\Assemblies\ folder
Also the error seems to be complaining about the access level of the
Class <i>'FundTrackHelper.Module1' is not accessible in this context
because it is 'Private'. </i>
Not sure why it would be doing this if the class and member are
declared as 'Public' as you say above, maybe write a small test app
that can reference the same class / method and make sure this works.|||this morning i basically deleted my custom assembly and
created a new one from scratch with a namespace and it
now works. thanks for your help. i am sure i'll have loads
of other questions as well !!!!!
"Thomo" wrote:
> sorry Taz, I didn't notice this earlier, from what I understand the
> Shared statment is the equivalent of static in C#
> you said that you compiled the assembly into C:\Program Files\Microsoft
> Visual Studio
> 8\Common7\IDE\PrivateAssemblies, the assemblies that I call from my
> report however are simply placed under the GAC.
> Can you check to see if your assembly is under the
> c:\Windows\Assemblies\ folder
> Also the error seems to be complaining about the access level of the
> Class <i>'FundTrackHelper.Module1' is not accessible in this context
> because it is 'Private'. </i>
> Not sure why it would be doing this if the class and member are
> declared as 'Public' as you say above, maybe write a small test app
> that can reference the same class / method and make sure this works.
>

No comments:

Post a Comment