Hi guys,
I faced very strange problem.
Prism application has 2 modules - TelerikLibsModule (all needed libs and nothing else) and MyModule which has dependency on TelerikLibsModule (all telerik libs in references have copy Local= False).
So Idea is to split telerik dlls and other modules.
MyModule project has StyleSelectorHelper class which overrides StyleSelector.SelectStyle (I need this for RadGridView)
Problem is that MyModule fails initializing if Telerik.Windows.Controls.dll is set to CopyLocal=false.
If I remove StyleSelectorHelper class, everything is working fine.
If I set CopyLocal=true for Telerik.Windows.Controls.dll in MyModule, it works fine as well.
Any ideas?
I have demo project to show this....
I faced very strange problem.
Prism application has 2 modules - TelerikLibsModule (all needed libs and nothing else) and MyModule which has dependency on TelerikLibsModule (all telerik libs in references have copy Local= False).
So Idea is to split telerik dlls and other modules.
MyModule project has StyleSelectorHelper class which overrides StyleSelector.SelectStyle (I need this for RadGridView)
Problem is that MyModule fails initializing if Telerik.Windows.Controls.dll is set to CopyLocal=false.
If I remove StyleSelectorHelper class, everything is working fine.
If I set CopyLocal=true for Telerik.Windows.Controls.dll in MyModule, it works fine as well.
Any ideas?
I have demo project to show this....
8 Answers, 1 is accepted
0
Hello Vitally,
I suppose you are building a Module to hold all the Telerik assemblies and setting the CopyLocal property for all Telerik references elsewhere in your project to false so as to not have the same Telerik assemblies in the package of each module, correct? In this case, wouldn't it be better to use Application Library Caching instead?
Best wishes,
Yavor Georgiev
the Telerik team
I suppose you are building a Module to hold all the Telerik assemblies and setting the CopyLocal property for all Telerik references elsewhere in your project to false so as to not have the same Telerik assemblies in the package of each module, correct? In this case, wouldn't it be better to use Application Library Caching instead?
Best wishes,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Vit100
Top achievements
Rank 1
answered on 06 Apr 2011, 03:17 PM
Yes, Yavor , you are right.
I don't use application lib caching because 2 reasons:
1. Application can be installed as OOB,
2. problems with versioning of telerik libs. We have few independed teams who use telerik libs in modules. So if I for example use telerik.dll ver.1, and they use ver.2, then big big trouble.... So I decided to pack all libs in one module and publish it in common place, so every module will use same teleriklibs.xap, so same version in different modules...
It was my idea, until I face problem with Telerik.Windows.Controls.dll reference in module....
I don't get how come that I inherit from class in this dll, and module crashes before dependency module loads.....Probably I missed something...
I don't use application lib caching because 2 reasons:
1. Application can be installed as OOB,
2. problems with versioning of telerik libs. We have few independed teams who use telerik libs in modules. So if I for example use telerik.dll ver.1, and they use ver.2, then big big trouble.... So I decided to pack all libs in one module and publish it in common place, so every module will use same teleriklibs.xap, so same version in different modules...
It was my idea, until I face problem with Telerik.Windows.Controls.dll reference in module....
I don't get how come that I inherit from class in this dll, and module crashes before dependency module loads.....Probably I missed something...
0
Hi Vitally,
What happens if you directly reference the telerik assemblies in your shell? I believe the module initialization fails because the Shell assembly cannot load the module's assembly if it references an external assembly which is not already loaded.
For example, create a new Silverlight application and place a RadGridView control on the page. In the code-behind, perform some manipulation of the Items property of RadGridView. For example: this.radGridView1.Items.FirstOrDefault().
This should fail because the default Silverlight application template doesn't reference System.Windows.Data. Even though the telerik assemblies reference System.Windows.Data, compilation will fail unless it is referenced directly in the application project.
Kind regards,
Yavor Georgiev
the Telerik team
What happens if you directly reference the telerik assemblies in your shell? I believe the module initialization fails because the Shell assembly cannot load the module's assembly if it references an external assembly which is not already loaded.
For example, create a new Silverlight application and place a RadGridView control on the page. In the code-behind, perform some manipulation of the Items property of RadGridView. For example: this.radGridView1.Items.FirstOrDefault().
This should fail because the default Silverlight application template doesn't reference System.Windows.Data. Even though the telerik assemblies reference System.Windows.Data, compilation will fail unless it is referenced directly in the application project.
Kind regards,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Vit100
Top achievements
Rank 1
answered on 06 Apr 2011, 04:17 PM
>>What happens if you directly reference the telerik assemblies in your shell?
Well, then telerik libs will be in shell if copy local=true, or shell fails loading if copylocal=false.
>>I believe the module initialization fails because the Shell assembly cannot load the module's assembly if it references an external assembly which is not already loaded.
I agree with you - it looks like true. In MyModule I have class with inherits from class located in dll in "not loaded yet" module...
But I have legimate question then.. if MyModule depends on module with telerikLibs, how come that myModule fails - it should not even initialize until dependency is loaded in initialized.
I did experiment - set messages to see sequence.
And same stuff for MyModule:
1. Clean IE cache.
Run application, load MyModule via ModuleManager.load("myModule");
And what I see....
2. Message: TelerikLib ctor
3. Message TelerikLib initialize
4. crash... exception. Telerik.Windows.Controls.dll can not be loaded.
Repeat steps 1-4 few times - same story.
Now repeat steps starting from 2 - leave cache dirty. MyModule may starts with correct sequence: MyModule ctor, MyModule init. I say may, because it is random..
Stupid prism even doesn't call constructor of MyModule but complains that module failed.....
I should admit that this problem is not related to telerik at all - as it applicable for any prism application.!!!
Well, then telerik libs will be in shell if copy local=true, or shell fails loading if copylocal=false.
>>I believe the module initialization fails because the Shell assembly cannot load the module's assembly if it references an external assembly which is not already loaded.
I agree with you - it looks like true. In MyModule I have class with inherits from class located in dll in "not loaded yet" module...
But I have legimate question then.. if MyModule depends on module with telerikLibs, how come that myModule fails - it should not even initialize until dependency is loaded in initialized.
I did experiment - set messages to see sequence.
[ModuleExport(
"TelerikLibsModule"
,
typeof
(Module))]
public
class
Module : IModule
{
public
Module()
{
MessageBox.Show(
"TelerikLib ctor"
);
}
public
void
Initialize()
{
MessageBox.Show(
"TelerikLib initialize"
);
}
}
And same stuff for MyModule:
[ModuleExport(
"MyModule"
,
typeof
(Module))]
public
class
Module : IModule
{
[Import]
public
IRegionManager RegionManager {
get
;
set
; }
public
Module()
{
MessageBox.Show(
"MyModule ctor"
);
}
public
void
Initialize()
{
MessageBox.Show(
"MyModule init"
);
if
(RegionManager !=
null
)
{
RegionManager.RegisterViewWithRegion(
"MyModuleRegion"
,
typeof
(MyView));
}
}
}
1. Clean IE cache.
Run application, load MyModule via ModuleManager.load("myModule");
And what I see....
2. Message: TelerikLib ctor
3. Message TelerikLib initialize
4. crash... exception. Telerik.Windows.Controls.dll can not be loaded.
Repeat steps 1-4 few times - same story.
Now repeat steps starting from 2 - leave cache dirty. MyModule may starts with correct sequence: MyModule ctor, MyModule init. I say may, because it is random..
Stupid prism even doesn't call constructor of MyModule but complains that module failed.....
I should admit that this problem is not related to telerik at all - as it applicable for any prism application.!!!
0
Hello Vitally,
I think the TelerikLibs module doesn't fail because, from what I've gathered from your descriptions, it doesn't contain any types. It's only MyModule that contains a type inheriting from a class in a telerik assembly that fails to load.
What if your shell was to hold the telerik assemblies, instead of a custom module? I believe this could resolve the problem.
Greetings,
Yavor Georgiev
the Telerik team
I think the TelerikLibs module doesn't fail because, from what I've gathered from your descriptions, it doesn't contain any types. It's only MyModule that contains a type inheriting from a class in a telerik assembly that fails to load.
What if your shell was to hold the telerik assemblies, instead of a custom module? I believe this could resolve the problem.
Greetings,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Vit100
Top achievements
Rank 1
answered on 06 Apr 2011, 05:38 PM
Yes, if shell referes to telerik libs - and copy local = true everything is working..
Also if tererikLibsModule is al loaded in InitializationMode="WhenAvailable", what is equal to referencing at compile time all other modules are OK.
But idea is to load havy telerik stuff on demand..
Also if tererikLibsModule is al loaded in InitializationMode="WhenAvailable", what is equal to referencing at compile time all other modules are OK.
But idea is to load havy telerik stuff on demand..
0
Accepted
Hello Vitally,
I'm sorry, but I can think of no other solution. I'd suggest to go with Application Library Caching again and make a separate version of your application for OOB. The reason is that the Silverlight API that updates an OOB application can only detect a change in your Shell XAP, but not your Module XAPs, which makes Prism with multiple modules in separate XAPs a bad idea for OOB.
This way you'll have one version of your app with multiple XAPs and Application Library Caching, and another version where all the modules' assemblies are packaged into a single XAP which you can install programmatically as an OOB application.
Greetings,
Yavor Georgiev
the Telerik team
I'm sorry, but I can think of no other solution. I'd suggest to go with Application Library Caching again and make a separate version of your application for OOB. The reason is that the Silverlight API that updates an OOB application can only detect a change in your Shell XAP, but not your Module XAPs, which makes Prism with multiple modules in separate XAPs a bad idea for OOB.
This way you'll have one version of your app with multiple XAPs and Application Library Caching, and another version where all the modules' assemblies are packaged into a single XAP which you can install programmatically as an OOB application.
Greetings,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Vit100
Top achievements
Rank 1
answered on 06 Apr 2011, 06:46 PM
Yeh,
Looks like it is the only way...
I asked same question on Prism web site - may be Prism gurus will advise something -)))
http://compositewpf.codeplex.com/discussions/252802
Anyway, thank you.
Looks like it is the only way...
I asked same question on Prism web site - may be Prism gurus will advise something -)))
http://compositewpf.codeplex.com/discussions/252802
Anyway, thank you.