Hi Chris,
[quote user="Christian M"]Consider our scenario: [/quote]
You are correct, I did not think about this upgrade way.
[quote user="Christian M"]In my opinion, when the platform toolset changes, some versioning should be done in the MA file to prevent Update 3 ma's from being Loaded on Update 5.[/quote]
That's impossible now from technical reason I guess. Such mechanism has to be implemented in MicroStation but it's not. To test runtime (MicroStation version and used msvcrt) from the application itself can be implemented, but it's not robust, because if an application is started in different environment, it's not ensured it will work at all.
It would be nice to have a metadata / manifest that will say in what products and versions the application can be started, so MicroStation can check it when loading the application as ma (native code) or dll (managed code).
[quote user="Christian M"] Similar to if a user tries to load a MicroStation V8i ma into Connect and it won't work.[/quote]
Well, users do a lot of weird things, but if the application is designed for V8i, it's the user's fail and not developer's it does not work.
[quote user="Christian M"]The 'kludge' i'm considering to protect our users is to detect the MicroStation version on startup, and if the DLL that happens to be loaded is the incorrect one. We can notify the users to correct their installation and unload gracefully. - It could be unsafe, but in practice as long as we use standard windows calls with no shared memory use, then mixing Dlls with a different compiler should work.[/quote]
In my opinion this solution is good, but I don't think it's robust enough to implement only this one. The problem is in "should work". If such test will be done in main after the application is loaded, it's not defined what will happen when runtime and application compilers are not the same as API or ABI can be broken or changed between versions.
But such test or protection is still valuable, because it solves I guess the most of situations and in the worst case it crashes, which is the same result as without the test, but earlier (which is also good ;-).
As proposed in this discussion, my solution is to check a product in configuration file and if it does not fit into approved ones, simply stop configuration loading with error. A configuration file for application compiled using Visual Studio 2013, which is valid for MicroStation CONNECT Edition U0 (original) - U4 and I guess also current OpenRoads Designer and maybe Building Designer, can be similar to this one:
# Test if runtime is a right one # Allowed applications: # MicroStation CONNECT Edition original to U4 # OpenRoads Designer original # MicroStation CONNECT Edition Update 4 test %if $(MS_PRODUCTCODEGUID) == "{9E4041C3-B271-3C2C-99B1-9F147E017FDB}" _MYAPP_ALLOWED_PLATFORM = OK %endif # MicroStation CONNECT Edition Update 3 test %if $(MS_PRODUCTCODEGUID) == ... _MYAPP_ALLOWED_PLATFORM = OK %endif # OpenRoads Design Test ... %if !defined(_MYAPP_ALLOWED_PLATFORM) %error Application "myapp" cannot be used with this product. %endif # Do any configuration here %undef _MYAPP_ALLOWED_PLATFORM
With regards,
Jan